My first advice is always have a visit with your vet to rule out any medical problems, make sure to mention all the details you know of when the cat is attacking like this.

Next try reading some of these, they might help narrow down what is going on if it's not medically related and some tips on helping to solve each type of aggression

Aggressive cats

Aggressive cats


Good luck and don't forget to have a check up with the vet first.