Image: Salvador Mendoza/YouTube

A security researcher has discovered limitations in Samsung Pay's security, which, if exploited by an attacker, could be used in another phone to allow someone else to fraudulently make payments.

The magnetic-based contactless payment system, which comes standard in many newer Samsung phones, works by translating credit card data into tokens so that a hacker can't grab credit card numbers from the device.

But those tokens aren't as secure as one might hope.

Salvador Mendoza found that the tokenization process is limited and the sequencing of the tokens can be predicted. In an email prior to his Black Hat talk in Las Vegas on August 4, he explained that the tokenization process gets weaker after the app generates the first token from a specific card, meaning that there's a greater chance that future tokens could be predicted.

Those tokens can be stolen and used in other hardware to make fraudulent transactions -- effectively a new form of card skimming -- without restrictions.

He said an attacker could steal a token from a Samsung Pay device and use it without restrictions.

Mendoza said he sent a token to one of his friends in Mexico, and he could use it with magnetic spoofing hardware to buy something -- even when Samsung Pay is not yet available in Mexico.

He demonstrated in a YouTube video (in Spanish but with English subtitles).

The big question is: how do you steal a token? It can be surprisingly easy, said Mendoza.

Mendoza built a contraption that straps to his forearm and wirelessly steals magnetic secure transmission (known as an MST) when he picks up someone's phone, which can then email the token to his inbox, so he can compile it into another phone. Or, you can hide that hardware to a legitimate card-reading machine like you would with a traditional card skimmer.

He then loaded the token into a homebrew MagSpoof device, an open-source wireless magnetic stripe spoofer -- and, as simple as that, you can buy products.

Mendoza said that "every credit card, debit card, or prepaid card from any affiliated bank" is affected by this kind of attack. But, he said, it will not work with gift cards, because Samsung Pay throws up a barcode to be scanned rather than transmits a signal.

Samsung did not say outright if it would fix the flaw.

"Samsung Pay is built with the most advanced security features, assuring all payment credentials are encrypted and kept safe, coupled with the Samsung Knox security platform," said a spokesperson for Samsung.

"If at any time there is a potential vulnerability, we will act promptly to investigate and resolve the issue," the Samsung spokesperson added.