India has vowed to strengthen online security measures after high school exam papers were leaked in advance, forcing millions of students to resit their finals.

The education minister, Prakash Javadekar, said an investigation was under way into how the mathematics and economics papers were accessed and spread via WhatsApp before the exam.

“The criminals who did this won’t be spared. I am sure police will catch these people soon. Let me assure that we will further improve the system and make it foolproof,” he said.

It is another embarrassment for the government, which has weathered storms over alleged cracks in its Aadhaar system, a database containing the personal details of more than 1 billion Indian people.

It comes as Facebook reels from a scandal over user data, and India’s ruling and main opposition parties accuse each other of mining and sharing followers’ personal information.

That row erupted this weekend after a French security researcher flagged flaws with the prime minister Narendra Modi’s personal app, alleging that users’ data was being shared without their consent.

Rahul Gandhi, of the main opposition Congress party, used the exam leak to revive an attack on Modi’s administration over digital security.

“2.8 million students to take exams again!! I mean is it a bloody joke? Who is accountable for this big mess?” he tweeted.

The Central Board of Secondary Education exams are crucial for students hoping to secure admission to some of India’s most prestigious public universities, and there was widespread anger at the leak.

Javadekar said he “understood the pain and anguish and frustration” of parents and students over the breach.

Police in Delhi investigating the leak said 25 people, including students and tutors, had been questioned as part of their inquiries but no arrests had been made so far.

“For now, we are trying to establish the trail of this leak. Most people we have spoken with only received it on WhatsApp,” said the special commissioner of police, RP Upadhyay.

Cheating in exams is common in India, including paying large bribes to buy test papers, as well as more elaborate ruses. In 2015, hundreds of people were arrested in eastern Bihar state for scaling the walls of schools and providing crib sheets and study materials to their relatives during exams.

In May last year school authorities created a furore when a student was made to remove her bra in public before an exam to ensure she had not hidden notes inside.

Last week India’s information technology ministry formally requested that Cambridge Analytica, the data analysis company at the centre of a Facebook privacy scandal, provide clarity over its practices by the end of the month.