Lewis Hamilton attracted a five-second penalty after his Ferrari's brakes failed at the Singapore Grand Prix.