that crow had shisui's eye
and it was a MS
and it had a technique called koto amatsukami
the technique can enter opponents minds and make them do whatever the user wants
itachi placed the order "protect konoha" into the eye and gave it naruto.
and he made it so, it would be activated when naruto sees itachi MS (because itachi thought that in order to gain more power sasuke would transplant his eyes)
but before naruto can use it on sasuke, he saw itachi's eyes on edo-itachi and the technique was activated
protect konoha was written on itachi's brain, and with it he broke free of kabuto's control
now naruto cannot use it on sasuke