The Israeli Defence Force (IDF) has claimed Hamas managed to hack the phones of soldiers by pretending to be attractive young women on Facebook.

In a modern twist on the traditional "honeypot" trap, the IDF said Hamas created fake social media profiles to "make a human connection" with the soldiers.

Once the soldiers were lured in and a connection was made, the person behind the fake account would ask soldiers to download an app called apkpk, the official said.

If installed, the app reportedly turns your phone into an open book, making all the data readily retrievable to the perpetrator, according to The New York Times.

It is not clear how the IDF determined Hamas was behind the alleged fake profiles, but they say dozens of soldiers were affected.

A spokesman for the IDF said: "Hamas has opened dozens of fake profiles, each with their own names and pictures, that they find through stealing the identities of unsuspecting civilians.

"They find social media accounts of soldiers by browsing through selfies, tags, and posts, and target them. This time, their weapon isn't a bomb, gun, or vehicle. It's a simple friend request.

"After some back and forth, the operative sends him a few pictures, mirror shots and beach portraits, to prove that she's real, and asks him if he'd like to video chat, but all the apps he has won't work for her – she needs him to download another one. She sends him a link to an app store called apkpk. He downloads the app she requested.

"The app isn't working, not for the soldier, at least. He tries to tell the pretty girl on the other end, but she won't respond.

"This 'video chatting' app is actually a virus. It can turn a mobile device into an open book – leaving contacts, location, apps, pictures, and files accessible to Hamas. What's more, it can stream video from the camera and audio from the microphone."

The actual damage done to the army was limited and the virus has been dealt with, the official added, but the army has decided to raise the issue publicly to warn soldiers of the potential dangers of social networks.

Hamas, which controls the Gaza strip, has been in three wars with Israel since 2008.