Project: Read, Collect & Decode SD Card CID Register Data

Buying flash memory from poorly reputed places, such as Chinese computer markets, and online auction sites is an often known way to collect BAD flash memory cards that fall short on performance, longevity and data security. SD cards, along with their “counterparts” mini and microSD cards, all contain manufacturer defined information in a set of registers. One is known as the CID, short for Card Identification Register. There is also another called the CSD or Card Specific Data Register. These can only be accessed directly via hardware and not via most card readers. I am aware that it was possible to do this via the SD Card Shield and Arduino, but since I have a Chromebook, things got really easy. Under the Chromebook, the SD reader slot on the side is directly connected to the SD bus of the ARM CPU and is not a USB based reader. By running Chrubuntu, getting the CID or CSD data from a card is as simple as:

cat /sys/block/mmcblk1/device/cid
cat /sys/block/mmcblk1/device/csd

Et voila! You will be rewarded with a hexadecimal string with the data in it. By comparing some cards that you own with the known signatures, you can have some reassurance whether your cards are similar, or genuine. Unfortunately, I haven’t seen a large CID database online, nor have I seen a CID decoder that will decode the hex string into the component parts (some BCD, some ASCII, others Unsigned Int or best as Hex), so I went on a journey to code one up for CID. I used this reference by Sandisk for the data field lengths and types. The CIDs for the cards I have in my possession that are in reach are as follows:

45010053454d31364790e03506aebf4d CHROMEBOOK INTERNAL EMMC
1b534d3030303030100337410200d13b RASPBMC SDHC CARD
1b534d3030303030107d11463800c199 SAMSUNG 32Gb CLASS 10 SDHC
8903034e43617264000000667000b285 TEAM 32Gb CLASS 10
41343253443132383002b800b600da6f KINGSTON 128Gb SDXC CLASS 10
02544d534430324728ad78243300793d KINGSTON 2Gb SDSC
035344534430324780019acc7600844b SANDISK 2Gb Blue SDSC
275048534433324730b018bd6700abe5 PATRIOT 32Gb CLASS 10 SDHC
035344535533324780718848c800b7fb SANDISK 32Gb CLASS 4 MicroSDHC
035344535530314780401c751300637d SANDISK ULTRA II 1Gb MicroSDSC
0353445355363447801013d98600d6d3 SANDISK ULTRA 64Gb UHS-I MicroSDXC
1234564d532020201000004c6300c853 UNBRANDED 2Gb MicroSDSC
8803023132333220100000cea40071b9 PRETEC 2Gb MicroSDSC

Please note, while the code below works using the Javascript of your browser, I have no prior Javascript coding until today, with much help from Google searches and W3schools. I won’t warrant the below decoder as being bug free, but it’s free so give it a whirl! If you want a full-screen one, so you can use it side-by-side and compare two separate CIDs, try this “framed” wrapper here. Hope you find this useful! Maybe I’ll get around to coding one for the CSD in the future.

About lui_gough

I'm a bit of a nut for electronics, computing, photography, radio, satellite and other technical hobbies. Click for more about me!
This entry was posted in Computing, Electronics, Flash Memory and tagged , , . Bookmark the permalink.

6 Responses to Project: Read, Collect & Decode SD Card CID Register Data

  1. Hi, thanks for the online CID decoder, very useful.
    Additionally thanks for linking to my blog post about reading the SD card serial number from CID, very appreciated.

    • lui_gough says:

      Dear Mike,

      Thanks for the comment – always nice to receive some comments in return. I will always link to the resources I find helpful during my experiments and discoveries, and while I can’t link to everything, I definitely only link to those pages which are truly helpful and valuable. The pleasure is all mine :).

      – Gough

  2. Ken Fisher says:

    There’s an android app, SD Insight, that can read and decode CID from a slotted Micro SD. I think it references an internal database.

    I suspect the reason that information on the internal workings is so limited is because the DRM relies on the information for decryption authentication.

    I’ve read that in system programming to update the firmware / configuration that runs on the SD cards controller is possible, and that a few vendors will custom manufacture a card to clone an existing cards signature. In theory that 100% breaks the DRM allowing cloned cards to access the media as if it was the original license holding card..

    Personally I’m more interesting in hacking the controllers Flash Translation Layer. I suspect the cheap cards are actually good cards de-tuned for slower performance. I already do this with USB Flash drives, and the results are impressive. A $5 USB drive that writes 17 MBPS when it’s only rated at 4.

  3. Rishabh sharma says:

    I’m trying to find where my sd card is from. Can I use the serial number to find the batch country ?

    • lui_gough says:

      Not that I know of, no. It’s not like a UPC barcode that uses the first three digits to denote country. The serial is essentially random and defined by the manufacturer. The vendor code (two digits) is the closest to knowing your SD card manufacturer, and even then, only the SD Association has the official two-digit to manufacturer mapping and they don’t release this publicly. There is information that seems to suggest that CSD and CID of some cards may be altered after manufacturing, with some limitations (e.g. change of bits from 1 to 0 only, or only some fields alterable), so even this information alone may not be enough to guarantee authenticity.

      – Gough

  4. ginbot86 says:

    After doing some of my own investigation, the CID for the Chromebook’s internal eMMC corresponds to the SanDisk SDIN8DE2-16G.

    There’s even a full datasheet if you look up the chip by its internal MMC name (SEM16G – MMC uses a 6-byte long name string):

    eMMC’s been a bit of a hobby thing for me lately; if you’d like more entries on your list, I have a few CIDs and CSDs of various eMMC devices I can provide.

Error: Comment is Missing!