Dr Max Grossmann

Gift cards are a solved problem

For teaching purposes, I recently purchased several Coles gift cards. As it happens, some of them reverted to me, so I attempted to spend them.

Several things immediately caught my eye:

The first issue made it impossible for me to fully read my PIN, which subsequently led to the card being frozen after I unsuccessfully attempted to enter the PIN multiple times. I did not investigate further and instead decided to discard the gift cards altogether, as I do not have time to spend on such things.

This leads me to my first point: companies issuing gift cards should be legally required to disgorge unspent balances on expired gift cards in favor of the public at large instead of being allowed to simply keep the money.

More significantly, however, I did some research on issues with gift cards in Australia and noticed that Coles is at the forefront of a scandal involving fraudulent gift card sales. To my astonishment, the gift card industry and supermarket chains are able to pretend that the last fifty years of progress in card security and asymmetric cryptography have not happened.

Here is how the scam works: Thieves copy the spending codes, return the cards to the shelves, and wait for customers to buy them. Activation cannot protect the money when a thief already has the code needed to spend it. Gift cards can essentially be stolen with a photograph.

Let me be clear: It is virtually trivial to design a gift card system that is both easier to use and vastly more secure than this. Any amateur cryptographer and cypherpunk could do it.

For offline cards, meaning physical cards used in stores, we can use a contactless chip like those in all modern Visa and Mastercard cards. The checkout contacts the gift-card issuer to check the balance. You may wonder how it is possible that, although you can read and even issue commands to contactless cards through a smartphone’s NFC reader, they still cannot be copied. That is the magic of asymmetric cryptography:

Each card has a secret number, its private key, which stays inside a protected chip. The chip never reveals it to a reader and is designed to make extracting it almost impossible, requiring astonishingly expensive specialist equipment and expertise (and physical tampering with the card). The issuer, on the other hand, keeps a matching public key that can be derived from the private key, but not the other way around.

At checkout, the reader sends the chip a random number and potentially some other data. The chip then uses its private key to calculate a reply, called a digital signature, which the company checks with the public key. The digital signature works only for that particular purchase, so even someone who records it, or someone who generates such signatures en masse, cannot pay for another one. The company then checks the balance; and if everything looks good, accepts the reply, and deducts the money at the same time.

Just to repeat how amazing this is: The customer simply taps the card while the chip proves it has the secret without ever revealing it. The same principle is used in EMV, the technology behind modern bank cards, which the popular YouTube channel Veritasium explains here.

Both loading and spending should require a tap of the actual chip, with no option to pay by entering a printed number. A card meant to work like cash needs no PIN at all. The PIN as currently constituted is laughable security theater.

For online cards, you could create a new gift card at home through the company’s website or app, then print or save a QR code for adding money to it. At checkout, the cashier scans the code and adds whatever amount you pay. Amazon launched exactly this as “Amazon Cash” in 2017. Since online cards are also issuer-specific (e.g., Steam or Apple), it’s easy to ensure that any gift card is only ever added to one account that can spend from that card.

By the way, it’s also quite easy to allow money to move between the offline and online cards: Coles and others simply need to stop prohibiting the use of gift cards for the purchase of other gift cards. It is simply none of their gosh-darned beeswax what the money is spent on.

In the ABC report, Coles said there is “no single measure that will eliminate gift card fraud” and that it “isn’t an issue that can be solved by retailers alone.” True, but the core problem is that thieves can copy codes before a sale occurs and use them to spend the customer’s money. Woolworths is testing “‘anti-tamper’ hangers,” but better packaging still leaves customers with a card whose balance can be trivially stolen. All of these measures are pre-antediluvian pseudo-solutions that are unnecessary and harmful to consumers.

Chipmaker NXP already offers chips specifically for securing gift cards. Gift cards are a solved problem.