[Import]Decoding Aztec code from polish vehicle registration certificate

NOTE: This post was imported from my previous blog – v3l0c1r4pt0r.tk. It was originally published on 1st August 2015.

About a year ago I interested in mysterious 2D code placed in my car’s registration certificate. After quick research on Google it turned out to be even more mysterious because nobody knew how to decode it. There was even no official document like act or regulation that describes the code somehow. People knew that the code is Aztec code and that’s it. Some companies shared web and Android apps to decode this. And all of them was sending base64 to some server and receive decoded data.

Of course for me it wasn’t rewarding so I started my research on it. After initially scanning the code I’ve seen long string that I immediately recognized as base64. The real fun started after that, because stream I’ve got after that was so strange that at first I had no idea what to do. Upon closer examination it was clear that this data is not damaged but encoded in somewhat strange way. Few days later I was almost sure that this is not encoding but rather compression, because some unique parts of stream was easily readable by human. About a month of learning about compression, looking for even most exotic decompression tools and I was left with almost nothing. I had only weak guess on how decompression parameters could be encoded. I gave up…

Polish vehicle registration certificate (source: pwpw.pl)

About a year later I tried one more time. This time I was a bit more lucky. I found a program that decodes the code. Again. But this time was different. I shut down my network connection to make sure. And it worked! So now a bit of reverse engineering and it’s done. I will skip any details because I do not want to piss off the company which created this, even though I was right and I HAD right to do this.

As usual the source code is available on my Github profile. There is also a bit more information about whole scanning/decoding process. If you like to know more technical details about the algorithm or how to decode the data, everything can be found in README file in the repo.

13 thoughts on “[Import]Decoding Aztec code from polish vehicle registration certificate

  1. Stealing algorithms from other binaries is a crime and admitting to it is just stupid. I’ve collected all the evidence of this (screenshots, text) and I will report a crime.

    PS. I just hope all those expensive reverse engineering tools you own are legal, because I will mention that too to check the licenses.

    1. Hi Troll,
      I am lucky to not live in a country with a highly oppressive government like United States so I had right to publish algorithm bought for taxes I paid. Moreover reverse engineering is legal in Poland for compatibility purposes. It’s a pity that you were not brave enough to give me your real email and IP address (not TOR exit node) so we could discuss more about it.
      Cheers,
      v3l0c1r4pt0r 🙂

      1. Hi,

        I noticed that not every binary data is “unpacked” correctly. In some cases I got errors (iconv invalid argument) or blank output file. Could you explain what it depends on?

        Cheers

    1. Any decompression error is caused by invalid input. Are you sure you provided binary file as input, not its base64 encoded form?

        1. same problem here 🙁

          I also have zeto app and for given string from scaner
          zetodecode.bin 1wMAANtYAAJDAP8xAH….

          It returns nice data.

          @v3l0c1r4pt0r I’d be glad if u provide steps necessary to use your library with strings from scaner.

          Thanks!!

          1. Exact steps depends on platforms you use. On Linux you should use base64 program to decode output from scanner and write it to separate file. Then it will ready to decompress. As I have written in the post above, instructions can be found on github README file. There you can also find basic overview of the whole process.

  2. Hi, nice works, indeed!

    One question, i do not understand well the process to scan and convert in base64 the image. What you guys are you using to scan the Aztec code and convert it to a binary file ? Which scanner ? Which converter to base64 ?

    1. Personally, I was using Atena Aztec Reader app on Android to get base64-encoded data. Then ordinary Linux base64 program works just fine. Unfortunately, still there is no complete solution. However, I heard that there are some open source libraries that are able to read Aztecs from picture, so creating it should be now possible, basing only on free code.

  3. Czy mozesz gdzieś wstawić ponownie swoją prace. Ponieważ widzę że panowie od biznesu uznali że to ich od i poblokowali.

    1. A, raz kozie śmierć. Niech wszyscy widzą: https://webcache.googleusercontent.com/search?q=cache:eHfVLiICOr4J:https://github.com/v3l0c1r4pt0r/delz/blob/master/src/lz.c+&cd=9&hl=pl&ct=clnk&gl=pl&client=firefox-b-ab
      Póki jeszcze nie wprowadzili żadnej ACTy, mogę sobie linkować 🙂

      Skoro już to jest publicznie dostępne, to przy okazji apel ode mnie: reuploadujcie! Prędzej czy później z cache’a to zniknie. Ja nie planuję tracić czasu na chodzenie po sądach z jakimiś firemkami co to uważają, że kupili sobie państwo na własność.

Leave a Reply

Your email address will not be published. Required fields are marked *