From the spell Animate Undead,
If you issue no commands, the creature only defends itself against hostile creatures.
There are two troubling terms here, for me. One is defends, and the other is hostile. The trouble cannot be answered in separate questions, because it is the combination of the two terms that causes the question.
Hostile is a keyword, but I’m not positive it is being used as a keyword in this situation. The keyword states
A hostile creature opposes the adventurers and their goals but doesn’t necessarily attack them on sight.
I can imagine that an animated undead might defend itself against hostiles by rushing toward them and engaging them in combat. This is what a tiger or mastiff would do, and they are of similar intelligence. If nothing else it would certainly ready an attack. This is a defensive action.
How does an animated undead defend itself against hostile creatures? To put the same question differently, must it wait to receive an attack, or could it engage on its on volition under basic principles of defense?
The implications: An undead frequently may not need to receive a command depending on how it might defend itself against hostile creatures.