Update 9/26: Samsung has issued a security fix for its flagship Galaxy S3 smartphone addressing this issue. The update can be found under Software Update feature in Settings. No word yet on when the Galaxy S II and other affected devices will be patched as well.

A security researcher has discovered that a single line of code can start a factory reset on a number of Samsung handsets including the Galaxy S II. The payload can optionally include code that is capable of killing the SIM card inside a phone. Worse over, there's no way to stop the procedure once it has been initiated.

Ravi Borgaonkar outlined his findings during the recent Ekoparty security conference. Anyone with bad intentions could use a simple USSD code to wipe the devices in question. The malicious line of code can be activated by visiting a booby trapped website either by directly clicking a link, through NFC, via a WAP-push SMS message or from a rigged QR code. In each case, there is no warning given to the user before the reset begins.

We are hearing that only devices running TouchWiz are vulnerable to the attack. As of writing, the best advice is to disable automatic site-loading from QR scans and NFC reader software and as always, use safe surfing habits.

The hack has been confirmed to work on the aforementioned Galaxy phones as well as the Galaxy Beam, S Advanced and the Galaxy Ace. Early reports listed the Galaxy S III as vulnerable but we according to a tweet from TeamAndIRC, the USSD code issue on that phone has been patched. They say current i747 (AT&T) and i9300 (European Galaxy S III) firmware aren't vulnerable; AT&T reportedly fixed the loophole with a patch just last week. No word yet from Samsung on the matter, however.