If it's the 400D kit lens your dealing with (EF-S 18-55 II) the problem is most likely with the aperture unit flex cable. The aperture unit will become (partially) unresponsive in part of the zoom range.
Put the camera in Av or M mode and set the aperture at 3.5 (i.e. wide open), check if the problems presents.
If it does not, but the problem reappears as soon as you set a smaller aperture, you know the aperture unit is indeed the culprit.
If you can get a spare (you'd probably need to replace the entire aperture unit) replacing it is relatively easy, the unit can be taken out after removing the front assembly with a pin spanner (that's what the two small holes in the front bezel are for) and of course you have to take the rear cover off to detach the flex from its connector.
+
Note, if the aperture unit costs more than $30 or so, just buy the entire lens second hand on ebay, since $30 is about the going rate for this model in decent condition. Or you might want to upgrade: the latest iteration of Canon's 18-55 kit lens, the IS STM, eats all the older versions for breakfast and can be had at about 80...90US$.
If it's the 400D kit lens your dealing with (EF-S 18-55 II) the problem is most likely with the aperture unit flex cable. The aperture unit will become (partially) unresponsive in part of the zoom range.
Put the camera in Av or M mode and set the aperture at 3.5 (i.e. wide open), check if the problems presents.
If it does not, but the problem reappears as soon as you set a smaller aperture, you know the aperture unit is indeed the culprit.
If you can get a spare (you'd probably need to replace the entire aperture unit) replacing it is relatively easy, the unit can be taken out after removing the front assembly with a pin spanner (that's what the two small holes in the front bezel are for) and of course you have to take the rear cover off to detach the flex from its connector.