The two hostile regimes are said to pose an “increasingly diverse and dangerous” threat to global security.
Speaking at a conference on cyber attacks on Tuesday, White House counter-terrorism advisor Lisa Monaco said that North Korea and Iran have shown they can carry out “destructive attacks” on “critical” infrastructure in the US.
Hackers could target nuclear power stations, transport and the nation’s defence systems, causing havoc across America.
Ms Monaco said: “To put it bluntly, we are in the midst of a revolution of the cyber threat – one that is growing more persistent, more diverse, more frequent and more dangerous every day.”
Citing North Korea and Iran as increasingly dangerous cyber operators, she threatened the use of “targeted” sanctions against “malicious” hackers targeting the US.
But stressed that sanctions will only be used against aggressors “when the time is right”.
Her comments come after a North Korea defector revealed hackers in the totalitarian nation are capable of launching catastrophic attacks.
According to Professor Kim Heung-Kwang, the regime has trained more than 6,000 hackers.
Heung-Kwang, who fled the country in 2004, said he was not taught the lethal techniques, but revealed many of his colleagues went to to work for Kim Jong Un’s notorious unit bureau 121.
Professor Heung-Kwang told the BBC: “The size of the cyber-attack agency has increased significantly, and now has approximately 6,000 people.
“The reason North Korea has been harassing other countries is to demonstrate that North Korea has cyber war capacity.
“Their cyber-attacks could have similar impacts as military attacks, killing people and destroying cities.”
North Korea was blamed for a major cyber attack against Sony Pictures.
And earlier this year, Iran hackers were accused of infiltrating the computerised controls of a small dam 25 miles north of New York City.
The attacks, heralded as a new way of war on US soil, heightened tensions with the US amid a backdrop of nuclear weapons disputes.