Reverse Engineering British Rail Tickets

There was a time when to take a British rail journey was to receive a ticket barely changed since Victorian times — a small cardboard rectangle printed with the destination through which the inspector on the train would punch a hole. In recent decades these were replaced by credit-card-sized thin card, and now increasingly with scanable 2D codes from an app. These caught the attention of [eta], and she set about reverse engineering their operation.

The codes themselves are Aztec barcodes, similar to a QR code but with a single central fiducial mark. At first glance they resemble the codes used by non-UK ticketing systems, but she soon found out that they don’t follow the same standard. There followed a lengthy but fascinating trail of investigation, involving app decompilation of a dodgy copy of the ticket inspector app to find public keys, and then some work with a more reputably sourced app from another ticketing company.

Along the way it revealed a surprising amount of traveler data that maybe shouldn’t be in the public domain, and raises the question as to why the ticketing standard remains proprietary. It’s well worth a read.

If you’d like more UK rail ticket hacking, it formed the subject of a talk at EMF 2022.

21 thoughts on “Reverse Engineering British Rail Tickets

  1. I went to the UK recently and everything was absolutely exorbitant. A sheep-shearing operation. If I lived there, I’d want to reverse-engineer that barcode too. People were just getting absolutely screwed there.. Nobody could afford to heat their homes, so even though the walls were a yard thick it still felt like you were standing outside in the middle of the night. Why do they take it? Leftover habits from the blitz? You don’t have to live that way.

    1. It’s not all that way. I live in a modern house, built a little over 100 year ago. We heat it to a cosy 17C in the morning and evening, and a tad over 14C during the day and at night. And we pay a mere £238/month for the privilege

      1. Ouch, that’s gotta sting.

        Here in Idaho, USA I pay an average of $30 USD (£25) to heat my home to a constant 69F (20.5C) with natural gas, even when it’s -5F (-20.5C) outside for weeks at a time.

        The cost of living sure does vary hugely, doesn’t it?

        1. For context: Idaho has the cheapest natural gas rates in the USA. Also average natural gas heating costs in Idaho was ~$65 per month, so $30 seems possible, although would be an outlier.

          For comparison Alaska, 4th cheapest natural gas rates in the USA, the average heating bill ran about $289 per month.

          Enjoy the cheap heat while it lasts!

        2. We live in the middle of New York (the state, not the city, where there’s mountains and trees and cows) and pay $120 a month averaged over the year, for natural gas and electricity. 3 BR house built 1960. Some weatherization and solarization done since. Gov. Hochul can come get our gas appliances when she stops burning gas for electricity.

        3. Interesting comparison. In Cape Town (South Africa} heating is not really an issue, winters are too short, but our electricity bill runs to around $80 a month for a 5 BR house, including a pool, and in winter heating adds around $17 for maybe 2-3 months, and that is not every day.

      2. Went to UK during the 90′, I was living in a house of an upper middle-class family : while the house was recent built there was not much insulation from the outside winter and no double-glazing windows. I eventualy got a cold !

        1. For the 90s no double glazing was an anomaly on a decent house, even in the UK. However every time someone tries to put a policy to improve home insulation, the Tories will scupper it, as they did just a few years ago.

    2. Tourists are the fat of the land. To be harvested, drained and sent on their way.

      As a wise man once sang ‘God save the queen, ’cause tourists are money!’

      They should have an wide open single elimination mixed martial arts tourney to name the new king. Open to all Citizens of the UK or former English colonels.
      Gnarly Charlie can enter if he wants. Royal trust goes to winner.

      If your impression of the USA was the tourist parts of Manhattan, you’d think the same thing of us. All the shit you’d say about the USA would actually be about your tourist ass.

    3. It’s the Tory government that’s screwed it all up – pure neo-libertarian right-wing policies means that everything costs loads. Things worked better before they were in power. Every time they get into power they privatise things, which is very hard to reverse afterwards.

  2. Maybe it can answer the question why reservation and the actual tickets are on separate pieces of paper? If you travel with a change return you may end up with 8 little pieces of paper which you have to scrabble through when the ticket inspector arrives. e-tickets are sometimes available but are not universal

    1. E-tickets are great, yes.
      But the reason they have all these is that they have barriers at most stations which read the mag-strip on old-school tickets. and then keep your ticket at your end destination. So if you need to keep it for expense claims, it sucks. When you print

  3. I’m always blown away with how disorganised and inefficient trains are in English speaking countries. I speak English natibely and yet I find it easier to book and ride a train in Germany, France, Czechia, Poland, Serbia etc than in England, USA or Australia. I suspect it is due to aome of the political issues addressed above, wherein rail infrastructure is viewed as a cost centre and political football instead of public infrastructure that requires investment to provide benefits.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.