I just repeated what JK wrote....
Maybe Malfoy and Dumbledore were able to stupefy Harry under the cloak because they knew he was there. Remember, Malfoy saw Harry's foot sticking out - which is what lead him to cast the stupefy spell in the first place.
LTS