Cybergibbons 🚲🚲🚲 Profile picture
Dec 17 23 tweets 7 min read Twitter logo Read on Twitter
I finally caved and bought a Flipper Zero.

Whilst it's useful, there's a fair few bits of it that aren't particularly well explained.

Let's start with the Mifare Classic reading!

What's it doing, and how is it doing it? Image
There are two dictionaries stored on the SD card in the device - both in /nfc/assets/

mf_classic_dict.nfc (built-in dictionary)
mf_classic_dict_user.nfc (user dictionary) Image
The built-in dictionary in the stock firmware has 1244 keys in it.

The built-in dictionary in XFW firmware has 3851 keys in it.

(not sure why the number shown differs on the device)
The stock one has the four "standard" Mifare keys right at the top.

I'd say 90% of cards will be caught by these four.

github.com/flipperdevices…
Image
Oddly, XFW pushes the A0A1A2A3A4A5 and
D3F7D3F7D3F7 keys way down the list to rows 3474 and 3487.

These are stock keys when using the Mifare tags to store NDEF data, which is very common! Not sure why they have been pushed down. Image
You can add your own keys into mf_classic_dict_user.nfc and it will be scanned before the other file.

By default this is empty - you store specific keys you have found in here.

You don't want to fill it with thousands of keys that won't work as it will use this first.
If you do fill it up, you end up skipping FFFFFFFFFFFF or 000000000000 - which will be nearly all cards!

The odd thing is there are loads of file packs drifting around with thousands of rows in the user dictionary - so you will spend a *lot* longer finding default keys.
An example are the files promoted in the very popular @TalkingSasquach "getting started" videos. This will massively slow down reading most cards.

github.com/skizzophrenic/…
Nearly all cards will be read with the default keys, but you will get ones that won't be.

A good example is this Premier Inn hotel card. The Flipper has found 29/32 keys, leaving one sector unread and one only read.

But what keys were actually found? The UI does not tell us. Image
We can use the debug logging over the USB cable.

Here we can see that block zero, key A was found to be A0A1A2A3A4A5 on block 0, the first block of sector 1.

It then goes through and tries the same key on all other sectors on the card - it also works on block 8 (sector 3). Image
It keeps on going through and finds most of the keys.

It's a bit painful to keep an eye on serial logging though.

An upside of the Mifare format is the keys are in the data you read back. Image
Now, once it is done, we can save the Mifara card data to a file on the SD card, and examine it.

First up, notice how the first chunk of data in block 0 is the UID of the card. You can never write to this on a genuine card. Image
It can also tell us the keys and what we can do with them.

Block 3 contains the key A, access bits, and key B of Sector 0.

keyA = A0A1A2A3A4A5
keyB = 0D258FE90296 Image
The access bits - 787788 - are a bit complex to explain concisely.

It decodes as:
Block 0,1,2 - Read with Key A/B, Write with Key B.
Block 3 (sector trailer) - Key B can write Key A/B, that's all.

(you can never write block 0 on real Mifare cards, or you could change the UID). Image
That's a pretty standard config - a set of keys to read the data (e.g. door readers would do this) and set of keys to write the data (e.g. the programmer at the front desk).
Sector 1 is still locked - this is the one that we didn't find key A or B for!

It's likely this is used for access control. It's likely to be a different set of keys for each hotel. Image
And sector 2 - we only found key A, which allows us to read block 8,9,10 but not write.

These are all 00 anyway, so there is a chance this doesn't matter if cloning the card. Image
The blocks with the keys set to FFFFFFFFFFFF for both A and B, and with the access bits set to FF0780 are in what is called "transport condition" - there are no restrictions in reading or writing. Image
So, a quick summary:
* 4 sectors in transport condition (unused)
* 10 sectors with non-default keys but in the XFW dictionary
* 1 sector where we didn't find key B so can't write
* 1 sector where we found neither key
But looking through the key dictionary of the Flipper, it looks like there is a lot of fluff there.

I'm probably going to trim mine right down so that it only contains the most useful keys, and then add ones to the user dictionary for specific situations.
The search strategy across the blocks seems quite sensible though - if the Flipper finds a key on a sector, it will then try it across all the sectors immediately to see if the same key is used across multiple.
For those who care about the access bits:


And a calculator, for the other direction:

blog.saltedbrain.org/2023/03/decodi…
calc.gmss.ru/Mifare1k/
So, given that most Mifare cards use the default keys, and so many systems just use the UID anyway, I think the Flipper will be fairly successful at cloning access control cards.

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Cybergibbons 🚲🚲🚲

Cybergibbons 🚲🚲🚲 Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @cybergibbons

Dec 18
After the #FlipperZero threads, there's been a few people questioning the ethics and legality of these devices, particularly with respect to NFC cloning.

I think explaining some of the history of NFC security - particularly Mifare Classic - attacks might help. Image
Mifare Classic cards are everywhere.

In the UK and US, most hotels and a very large proportion of commercial access control systems will use Mifare Classic.

We've known that they have serious security weaknesses in these cards for over a decade, yet they are still used. Image
The cards have a number of "sectors" of memory, and to be able to read or write these, you need to know a 48 bit key for that sector.

For a Mifare Classic 1K, there are 16 sectors, with two keys per sector, so possibly 32 keys!
Read 24 tweets
Dec 17
Onto another aspect of the Flipper Zero... and not really knowing what it does.

The Frequency Analyzer seems pretty opaque. When it works, it works, but under what conditions does it work? Image
There is documentation, but it doesn't really explain any of the limitations.

docs.flipper.net/sub-ghz/read#b…
The sub-GHz part of the Flipper is driven by a TI CC1101 RF transceiver. This is in the same family as the CC1110 that was famously turned into a spectrum analyser in the IM-ME instant messenger toy.

hackaday.com/2010/03/17/im-…
Read 22 tweets
Jan 21
I'm looking at the VDDI-PROG and how it bypasses security mechansisms on many automotive microcontrollers.
It's a nice device, in a good plastic case.

Double-sided board, no components on back.

Minimal silkscreen.

The 3V lithium cell is interesting - I'm not sure what needs backup.

No 32.768kHz crystal for an RTC and no real need.
Main microcontroller is an STM32F407.
Read 61 tweets
Jan 20
Remember: seek out those to troll, do not let them seek out you.
Remember.
They don't learn, do they?
Read 6 tweets
Jan 14
How is your weekend going?
I think I am going to get vanned.
Do I need more or less beer?
Read 12 tweets
Jan 12
Trance songs that I like but also have really strange low budget videos.

Delerium - Silence AKA woman going for a run on a beach with her man but he can't keep up and they are both very serious.

Image
Darude - Sandstorm.

Lady steals briefcase and weird chase starts with handguns.

Image
Stretching trance.... but

Bomfunk MC's - Freestyler

Dude learns how MP3 players work on a train.

Image
Read 17 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(