Using white light is one way to fend off these kinds of vibrations. Another, better way is to clear your energy system and maintain its good health. QiGong is very good for this, as are certain practices of Reiki (not always taught by all teachers), and simply doing Donna Eden's "5 minute" routine is also excellent. If you keep your energy system in top notch condition, your aura is strong and such vibrations tend to sort of "bounce off."
And I usually do refer to this as "vibrations" rather than "attacks." There are several reasons for this. Often, they are not attacks at all--just people thinking about you negatively. They intend no real harm, they're just griping in their minds. Even when they are actually trying to attack, it's still just vibrations, and unless you give them permission, they have no power over you.
Also, many times what people think is an "attack" is actually being confronted with their own thoughts or thought-forms. We can throw a lot of real garbage into the world with our own negative thoughts. When we notice it for one reason or another, it can feel like an attack. But it's really only something we put out, and then forgot about.
Finally, by using the term "attack" there is an implication that we are somehow "victims." The LAST thing we want to be is a victim. Worse, it usually implies a sense of helplessness--and we are not helpless.
But I think the main thing is to work on your energy system. Get rid of the clogs in the flow, make sure there IS a flow. White light often helps, but you can do more, as mentioned above.