In the severest warning yet to Rouhani's one-year-old administration, chief prosecutor Gholam-Hossein Mohseni-Ejei accused Communications Minister Mahmoud Vaezi of failing to unplug social networking sites and apps "with immoral and criminal content."
"Despite a three month grace period to allow you and your colleagues enough time, no effective action has been taken to filter out immoral and un-Islamic offences" relayed through WhatsApp, Viber and Tango, said Mohseni-Ejei, an influential cleric and judge.
His ultimatum, in a letter carried by Iranian media late on Saturday, came amid reports of a police investigation into "widespread dissemination of offensive material" against the leader of the 1979 Islamic revolution, Ayatollah Ruhollah Khomeini.
No details have been released, but the news has set off fresh right-wing attacks on President Rouhani who has called the Internet "an opportunity, not a threat."
Like satellite television and music videos in earlier decades, cyberspace has been considered a threat to public morality and potentially subversive to the Shi'ite clerical rule in Iran.
Scores of online activists, users and bloggers have been jailed and reportedly mistreated since the crackdown on popular protest over former president Mahmoud Ahmadinejad's disputed re-election in 2009.
But the climate has eased slightly since Rouhani's landslide election last year.
To stave off conservative opposition to limited freedom of information, Communications Minister Vaezi promised last May to introduce what he called "smart filtering" to only keep out "obscene" material, which could be applied to anything from partial female nudity to outright pornography.
© Thomson Reuters 2014