Double agent
A double agent is someone sent to work as a spy against another country but is secretly spying on the country that he or she works for on behalf of the country he or she is supposed to be spying on.