President Donald Trump has called US intelligence agencies "naive" on Iran and also dismissed their assessment of the threat posed by North Korea.
"Be careful of Iran. Perhaps Intelligence should go back to school!" Mr Trump tweeted.
The testy response came after a US intelligence report said Iran was not making nuclear weapons.
It also said that North Korea remained "unlikely to give up" its weapons stockpiles and production abilities.
National intelligence director Dan Coats and other intelligence chiefs presented the Worldwide Threat Assessment report to the Senate yesterday.
Last year, the US pulled out of the 2015 Iran nuclear deal, triggering widespread criticism from Washington's allies.
Mr Trump also launched a diplomatic push to improve relations with North Korea, meeting the country's leader Kim Jong-un in Singapore last June to discuss denuclearisation of the Korean peninsula.
At the time, Mr Trump said this meeting had ended the North Korean nuclear threat - a claim questioned by a number of US politicians and experts.
The Intelligence people seem to be extremely passive and naive when it comes to the dangers of Iran. They are wrong! When I became President Iran was making trouble all over the Middle East, and beyond. Since ending the terrible Iran Nuclear Deal, they are MUCH different, but....— Donald J. Trump (@realDonaldTrump) January 30, 2019
....a source of potential danger and conflict. They are testing Rockets (last week) and more, and are coming very close to the edge. There economy is now crashing, which is the only thing holding them back. Be careful of Iran. Perhaps Intelligence should go back to school!— Donald J. Trump (@realDonaldTrump) January 30, 2019
The US intelligence report also warned that cyber threats from China and Russia were a growing concern, and both countries may be seeking to influence the 2020 US presidential elections.
In a series of tweets, Mr Trump said US intelligence officials "seem to be extremely passive and naive when it comes to the dangers of Iran. They are wrong!"
Iran, he continued, was "making trouble all over the Middle East, and beyond" in 2016, but had been "much different" since the US pullout from the "terrible" Iran nuclear deal.
However, Mr Trump warned that Tehran remained "a source of potential danger and conflict", referring to reported recent Iranian rocket tests.
At the Senate hearing, CIA director Gina Haspel said Iran was "technically... in compliance" with the nuclear deal, despite the US withdrawal and the imposition of stricter sanctions against Tehran.
However, the intelligence report warned that Iran's "regional ambitions and improved military capabilities" would probably threaten US interests in the future.
The president wrote that "time will tell what will happen with North Korea, but at the end of the previous administration, relationship was horrendous and very bad things were about to happen.
"Now a whole different story. I look forward to seeing Kim Jong Un shortly. Progress being made - big difference!"
The US intelligence report earlier concluded that North Korea was "unlikely to give up" its weapons stockpiles and production abilities while it tried to negotiate "partial denuclearisation steps to obtain key US and international concessions".
Having nuclear weapons was seen as "critical to regime survival", the report added.
In Singapore, Mr Trump and Mr Kim signed an agreement pledging to "work toward complete denuclearisation" - but there was no agreed pathway and little progress has been made since then on the issue.
The White House has said there will be a second summit in February, but no date or location has yet been confirmed.