The hackers that breached Target had highly customized the malware to avoid dectection and specifically work on Target's Windows XP Embedded for POS systems.
Now how did the hackers know Target was running Windows XP Embedded for POS systems? One of two ways. First, they had prolonged access to Targets systems so they could have discovered on their own that was the OS running Target's POS Systems OR Second, it was an inside job.
It's one of the two, and wouldn't I love to be a fly on the wall listening to the FBI discussions when they were trying to figure it out (if they even HAVE figured it out!)
I’ve heard that it was likely the Russian mafia that was involved and it wouldn’t be that hard to get hired as an IT security specialist.