In a targeted attack, it's likely the foreign agency would be using a 0-day attack.
The only way to protect against that is by reducing the OS monoculture, offline backups, and using network air gaps on critical data.
But those practices are extremely rare in my experience.
If I was on unfriendly terms with the US, I'd use this as a case study on how to cripple the economy by taking advantage of the large monocultures created by lax IT in a hundred or so of the largest firms.