Protection from a quality causes four things, remembered by the acronym DEBT: the permanent can't be Damaged, Enchantered/Equipped/Fortified, Blocked, or Targeted by anything with that quality. The 'E' portion means an Aura with the relevant quality cannot legally enchant the protected permanent (CR 702.16b).
State-based actions are checked continuously. CR 704.5n specifically states that if an Aura is attached to an object it is not legally able to enchant, the Aura is put into its owner's graveyard. This check happens the moment the permanent gains protection, before any player can take another action (CR 704.3).
It doesn't matter that the Aura was legally attached when it first entered the battlefield — what matters is the current legal state. Once the enchanted creature has protection from enchantments, the Aura's attachment is no longer legal, and state-based actions remove it immediately.
Concrete example: You control a Soldier enchanted with Pacifism. Your opponent casts Spectra Ward on that Soldier (giving it protection from all colors). Pacifism is a colored enchantment, so it is now illegally attached. Before anyone gets priority, state-based actions move Pacifism to your graveyard.
Note: If the Aura itself were somehow colorless and protection was only from colored enchantments, the Aura would remain. Protection must match the Aura's qualities for it to fall off — so the exact scope of protection granted matters.
Unofficial fan resource — not affiliated with or endorsed by Wizards of the Coast. Answers are AI-generated estimates grounded in the Comprehensive Rules and are not a substitute for an official judge. Verify anything match-critical.