{"id":844,"date":"2020-10-19T09:37:24","date_gmt":"2020-10-19T13:37:24","guid":{"rendered":"https:\/\/dc540.org\/xxx\/?p=844"},"modified":"2020-12-08T15:57:27","modified_gmt":"2020-12-08T20:57:27","slug":"decoding-mifare-data-pointless","status":"publish","type":"post","link":"https:\/\/dc540.org\/xxx\/2020\/10\/decoding-mifare-data-pointless\/","title":{"rendered":"Decoding MIFARE data &#8212; pointless?"},"content":{"rendered":"\n<p>Now that I can read, dump and clone cards, of course my natural inclinations lead me toward the next goalpost, which is determining what hidden data can be retrieved from the cards. All indications from that forums were that the issue date\/time, expiration date\/time and room number are stored somewhere on the card, so I knew vaguely what I was looking for, but still had some learning to do.<\/p>\n\n\n\n<p>I wrote a quick script to dump what I know about the cards, which makes it easier to add further definitions as I learn the more detailed structure of the data:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"593\" src=\"https:\/\/dc540.org\/xxx\/wp-content\/uploads\/2020\/10\/Screen-Shot-2020-10-19-at-9.35.54-AM-1024x593.png\" alt=\"\" class=\"wp-image-846\" srcset=\"https:\/\/dc540.org\/xxx\/wp-content\/uploads\/2020\/10\/Screen-Shot-2020-10-19-at-9.35.54-AM-1024x593.png 1024w, https:\/\/dc540.org\/xxx\/wp-content\/uploads\/2020\/10\/Screen-Shot-2020-10-19-at-9.35.54-AM-350x203.png 350w, https:\/\/dc540.org\/xxx\/wp-content\/uploads\/2020\/10\/Screen-Shot-2020-10-19-at-9.35.54-AM-300x174.png 300w, https:\/\/dc540.org\/xxx\/wp-content\/uploads\/2020\/10\/Screen-Shot-2020-10-19-at-9.35.54-AM-768x445.png 768w, https:\/\/dc540.org\/xxx\/wp-content\/uploads\/2020\/10\/Screen-Shot-2020-10-19-at-9.35.54-AM.png 1460w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>Here&#8217;s what I&#8217;ve learned so far:<\/p>\n\n\n\n<p>All of the MIFARE cards in my collection (63 of them at last count) have sixteen sector of data.  Sector 0 is three blocks and if my understanding is correct, contains immutable manufacturer and other ata. This makes sense, as the very first thing in sector 0 is the UID of the card.  What else is that hex data in sector 0?  Dunno.  Here&#8217;s a sector 0 example:<\/p>\n\n\n\n<p><strong>FD65D88A<\/strong>CA880400C825002000000017<br>E7C0995613BD20D15F58EA614C1020B6<br>8A000400010000000000000000000000<\/p>\n\n\n\n<p>The bolded hex is the card&#8217;s UID.<\/p>\n\n\n\n<p>Sectors 1 through 15 are all four blocks of hex, structured identically. The first block is the keys and access bits.  For each sector, there are two keys defined. The access bits define which key or keys are required to read from, or write to, that sector. Example: <\/p>\n\n\n\n<p>2A2C13CC242AFF078069FFFFFFFFFFFF<br>02D7C800000000000000000000000000<br>00000000000000000000000000000000<br>00000000000000000000000000000000<\/p>\n\n\n\n<p>In this case, Key A is 2A2C13CC242A, Key B is FFFFFFFFFFFF, and the access bits field is FF078069, which I found is a very common schema.  <\/p>\n\n\n\n<p>The remaining three blocks are data, and here&#8217;s where it gets fuzzy.  I believe that there is no structure whatsoever to that data. No standard, no default, no pattern. In fact, the bulk of cards had no data stored in most sectors. And I have yet to find a discernible pattern in the data that is stored. I have looked for hex-to-decimal date translations, and so far been unlucky.<\/p>\n\n\n\n<p>Here&#8217;s the breakdown of &#8220;data stored in sectors&#8221;:<\/p>\n\n\n\n<p>Of my 63 cards:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>48 had data stored in Sector 1<\/li><li>34 had data stored in Sector 2<\/li><li>3 had data stored in Sector 4<\/li><li>5 in Sector 5<\/li><li>1 in Sector 6<\/li><li>1 in Sector 7<\/li><li>Zero cards had data stored in Sector 3 or Sectors 8 through 15.<\/li><\/ul>\n\n\n\n<p>What I&#8217;d love to be able to do is to extract the &#8220;stay data&#8221; from all of these cards. Keep in mind that these are all actual cards from hotels that I and my family have stayed in over the past 4-5 years. So if the data is retrievable, I should be able to cross-reference it to a trip.<\/p>\n\n\n\n<p>And now I just remembered that I have that batch of DEF CON room keys hanging in the basement that should scan and add to the collection.<\/p>\n\n\n\n<p>So here&#8217;s my question for the hackers out there. How you determine, or CAN you determine the nature of hex data stored in blocks with no apparent standard of default structure?<\/p>\n\n\n\n<p>The dumps are on https:\/\/github.com\/dc540\/hfdumps if you&#8217;re interested in exploring this data.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Now that I can read, dump and clone cards, of course my natural inclinations lead me toward the next goalpost, which is determining what hidden data can be retrieved from &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/dc540.org\/xxx\/2020\/10\/decoding-mifare-data-pointless\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Decoding MIFARE data &#8212; pointless?&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":846,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[73],"tags":[],"class_list":["post-844","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-rfid"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/dc540.org\/xxx\/wp-content\/uploads\/2020\/10\/Screen-Shot-2020-10-19-at-9.35.54-AM.png","jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/dc540.org\/xxx\/wp-json\/wp\/v2\/posts\/844","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dc540.org\/xxx\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dc540.org\/xxx\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dc540.org\/xxx\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dc540.org\/xxx\/wp-json\/wp\/v2\/comments?post=844"}],"version-history":[{"count":1,"href":"https:\/\/dc540.org\/xxx\/wp-json\/wp\/v2\/posts\/844\/revisions"}],"predecessor-version":[{"id":847,"href":"https:\/\/dc540.org\/xxx\/wp-json\/wp\/v2\/posts\/844\/revisions\/847"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dc540.org\/xxx\/wp-json\/wp\/v2\/media\/846"}],"wp:attachment":[{"href":"https:\/\/dc540.org\/xxx\/wp-json\/wp\/v2\/media?parent=844"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dc540.org\/xxx\/wp-json\/wp\/v2\/categories?post=844"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dc540.org\/xxx\/wp-json\/wp\/v2\/tags?post=844"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}