Proxmark3 community

Research, development and trades concerning the powerful Proxmark3 device.

Remember; sharing is caring. Bring something back to the community.


"Learn the tools of the trade the hard way." +Fravia

You are not logged in.

Announcement

Time changes and with it the technology
Proxmark3 @ discord

Users of this forum, please be aware that information stored on this site is not private.

#1 2008-10-18 22:15:24

rule
Member
Registered: 2008-05-21
Posts: 417

Some mifare traces

              ISO 14443-A Anti-Collision
        REQA: 26
        ATQA: 04  00
 SELECT(all): 93  20
    UID, BCC: de  ad  be  af  62
 SELECT(tag): 93  70  de  ad  be  af  62  db  98
         SAK: 08  b6  dd
              Decrypted read sequence
    Read(00): 30  00  02  a8
   Block(00): 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  37  49
    Read(01): 30  01  8b  b9
   Block(01): 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  37  49
    Read(02): 30  02  10  8b
   Block(02): 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  37  49
        Halt: 50  00  57  cd
              Initialization values
         UID: de  ad  be  af
         KEY: ff  ff  ff  ff  ff  ff

              Decrypted random nonces
          Nt: b0  0b  77  90
         Nt': cc  02  30  82
        Nt'': eb  4e  fb  2e
          Nr: ae  99  ca  99

              Mifare Classic trace, []=Encrypted
    Auth(00): 60  00  f5  7b
          Nt: b0  0b  77  90
    [Nr,Nt']: ca  fe! ba  be  48  76! af  fa
      [Nt'']: 69  1e  8d  21

  [Read(00)]: 3c  ce  19  28
 [Block(00)]: c7! 84! b5! 92! a4! 16! 82  fe  eb! 0b! ac  22! ed! 89  e1! 6d  1e  6e!
  [Read(01)]: c5! 0a  84! c6
 [Block(01)]: a7  2b! e7! 1b  12! 75! 3a! 13  ef  d1! a3! 5f  28! a5! 69  1a! 4d! 0b
  [Read(02)]: b0! 7c  a2  29!
 [Block(02)]: 6a! 15  87! 4b! 25  99! ed! 0f! 6b! f4  85! 3e  77! 6f  4c! c0! 8c! 9c
      [Halt]: f5  d0  de! 59!
              Initialization values
         UID: 1a  60  31  b7
         KEY: 00  00  00  00  00  00

              Decrypted random nonces
          Nt: 07  a2  d6  6b
         Nt': 72  bf  bb  fa
        Nt'': 97  44  04  ff
          Nr: ee  62  1d  9c

              Mifare Classic trace, []=Encrypted
    Auth(00): 60  00  f5  7b
          Nt: 07  a2  d6  6b
    [Nr,Nt']: 84! 3b! a2  cf! eb! 48  ac! b9
      [Nt'']: 3a  0f! ff  4c

  [Read(00)]: 13  6b! fe  4a
 [Block(00)]: ac! a1! e0  a1  a1! ee! b5  e1! 55! 13! da! 56! 1f  19! 78  f6  6b! fc!
  [Read(01)]: c4! 51  df! 51
 [Block(01)]: 06  06  80! 0e  b3! d2  1a! 9c  3a  b0  59! c1! b4! 55  f4  ff! 12  d0!
  [Read(02)]: e5  23  02! de!
 [Block(02)]: 53! 25  03  ae  71  36! 67! 22  2c! 7e  3c  20! e0  37  f1! c2! 6f  22
      [Halt]: db! 1d! fa  04!
              Initialization values
         UID: c1  08  41  6a
         KEY: 62  be  a1  92  fa  37

              Decrypted random nonces
          Nt: ab  cd  19  49
         Nt': 6b  01  17  99
        Nt'': b8  68  c4  dc
          Nr: 16  05  49  0d

              Mifare Classic trace, []=Encrypted
    Auth(00): 60  00  f5  7b
          Nt: ab  cd  19  49
    [Nr,Nt']: 59! d5  92  0f! 15  b9  d5! 53!
      [Nt'']: a7! 9a  3f! ee!

  [Read(00)]: 7e  6c! a1  3a
 [Block(00)]: 45  a5  d2! 29  07  eb! a5! 5f! 31  2b  cc! 9d! 22  f4  d9! 84  95! c3!
  [Read(01)]: d4! c0! 0d  e4
 [Block(01)]: 41  b8! 5f  10  cb  67! d8  1c  55  ac  76! 34  cd  cb  21  f8  48  c0!
  [Read(02)]: ac! df  e4  3e
 [Block(02)]: a9  14! af  1c! 10  b1  c0! f5! 15  a5  30! 55  1c! be  26! 7e! c8  e7!
      [Halt]: 20  ef! 4f  bd!

Offline

#2 2009-02-12 06:16:04

Dennyxiao
Contributor
Registered: 2008-11-01
Posts: 43

Re: Some mifare traces

One question .for multi-sector access traces . Is any solution to cal the next sector's password?

I need some help on this.

Offline

#3 2009-03-10 02:20:15

joker
Contributor
Registered: 2008-11-17
Posts: 34

Re: Some mifare traces

roel(or anybody) could you publish a multiple sector trace?

It's ambiguous in the docs whether or not the UID is still xorred against Nt

my best guess with no uid xorring, and some 'funny' keys

[Nt] 6F! 3F A4 77
[Nr,Nt'] 4B! F5! 76 19! 48 68 E8 82!
[Nt''] F6 A4! BD! D8!

Offline

#4 2009-03-10 11:38:04

rule
Member
Registered: 2008-05-21
Posts: 417

Re: Some mifare traces

Sorry, I don't have one here at the moment.
I will look one up for you soon, the UID is still needed, it is XORed against Nt.
It is harder to determin Nt though, since it is transmitted encrypted this time.

Offline

#5 2009-03-10 16:29:59

joker
Contributor
Registered: 2008-11-17
Posts: 34

Re: Some mifare traces

bah that's messing up my layout somewhat. Doesn't seem to cause too many other problems, would be cool to have some public test vectors though

Offline

#6 2009-03-10 17:12:07

rule
Member
Registered: 2008-05-21
Posts: 417

Re: Some mifare traces

There you go, as you can extract from this trace:
UID = 0x9c599b32
KEY = 0xffffffffffff

 + 561882:  1 :     26    
 +     64:  2 : TAG 04  00    
 +  10217:  2 :     93  20    
 +     64:  5 : TAG 9c  59  9b  32  6c    
 +  12313:  9 :     93  70  9c  59  9b  32  6c  6b  30    
 +     64:  3 : TAG 08  b6  dd    
 + 923318:  4 :     60  00  f5  7b    
 +    112:  4 : TAG 82  a4  16  6c    
 +   6985:  8 :     a1  e4! 58  ce! 6e  ea! 41  e0!       !crc
 +     64:  4 : TAG 5c! ad  f4  39!   
 + 811513:  4 :     8e  0e! 5d! b9        !crc
 +    112:  4 : TAG 5a! 92  0d! 85!   
 +   6946:  8 :     98! d7  6b! 77  d6  c6  e8  70        !crc
 +     64:  4 : TAG ca  7e! 0b! 63!   
 + 670868:  4 :     3e! 70  9c! 8a        !crc
 +    112:  4 : TAG 36! 41  24! 79    
 +   9505:  8 :     1b! 8c  3a! 48! 83  5a  4a! 27        !crc
 +     64:  4 : TAG 40! 6a! 99! 4b    
 + 905612:  4 :     c9  7c  64! 13!       !crc
 +    112:  4 : TAG b5! ab! 1d! 2b    
 +   6936:  8 :     7e! d2  5c! ca! 4b! 50! 88! c4        !crc
 +     64:  4 : TAG bf  dd  01  be!   
 + 987853:  4 :     56  98  49  d6!       !crc
 +     72: 18 : TAG 09  bf! f5! f6! fc! b9! 5e! 51! 07  ac  f6  72  f8  73  3b! 1b  73! ad!       !crc
 +  94864:  4 :     5c! 7b  24! 02        !crc
 +     72: 18 : TAG a0  1f! 0b! b7  0d! ba  c9  e7! fa! 36! 47  d2  a0! 01! 40! 87  ff  95!       !crc
 +  94827:  4 :     c9  90  dc! a3        !crc
 +     72: 18 : TAG df  b8! 7a  bc! 17! 99  82! 5c  55  d5! 98! 68  8b  f8  e7  89  dc  42!       !crc
 +  99081:  4 :     9f! d5  0f! d8!       !crc
 +     72: 18 : TAG ca! 40  fa! 34  82  cc  3e  de  1f! 7f  f7! f0  62! 18! 77! 34  30  07        !crc
 +  93995:  4 :     ad  7f! 3e  0c!       !crc
 +     72: 18 : TAG f4! 2b  17! 4c  a2! 5a  0c! a0! d8  03! 05  cc  cc  4c  1f  12! 0c! 78!       !crc
 +  94857:  4 :     f1! b4  f0  3b!       !crc
 +     72: 18 : TAG 8f  da  ca  17! 42  8e  24  c9! 8e  fb! 38! aa! 39  e2! dd  dd! a8  a6        !crc
 +  94850:  4 :     c4  03! 7b! 9a        !crc
 +     72: 18 : TAG 9f! 42! 42  49! cd  d1! 3d! fd  8e  8f  d3  8d! d5! ca! ef! 15  84  c9!       !crc
 +  93961:  4 :     33! 3b! ae  0a!       !crc
 +     72: 18 : TAG 74  ed! 58  46! e7  cc  48  d1! 5a  4b  b0! 3a! c1  79! 8a! bf! e7! 42        !crc
 +  93193:  4 :     f6  ec! 36  91!       !crc
 +     72: 18 : TAG 79! 63  89! 21! 24  1e  3e! 03! a8! c3! 9b  95! a1  ad! 6c! 34  52  94        !crc
 +  94866:  4 :     ad! 5c! 47  c5!       !crc
 +     72: 18 : TAG 68  d4  9d  c2! 2b  18  46! f7  e8! 28  ea  03  a4  df  d5! 9f  23  00!       !crc
 +  93994:  4 :     41  4c! 40! 11        !crc
 +     72: 18 : TAG b1  95  17! 84! ac  fc! 31  b8! 02  40  97! ec! 4c  19  6f  e9  f0! 8c!       !crc
 +  94818:  4 :     b8! b5! 5c! 74!       !crc
 +     72: 18 : TAG c6  03  b9  92! 7d! eb! 13  8a  56  b7  9c  7c  07  3d! 6a  95! 7e! 44        !crc

And for those who want to confirm their understanding of this puzzle

>   0 | RD  |  -  | REQUEST   | 26 
>   1 | TAG |  -  | AWAKE     | 04 00 
>   2 | RD  |  -  | ANTI COLL | 93 20 
>   3 | TAG |  -  | UID       | 9C 59 9B 32 6C 
>   4 | RD  | ok  | ANTI COLL | 93 70 9C 59 9B 32 6C 6B 30 
>   5 | TAG | ok  | TAG TYPE  | 08 B6 DD 
>   6 | RD  | ok  | AUTH      | 60 00 F5 7B 
>   7 | TAG |  -  | Nt        | 82 A4 16 6C 
>   8 | RD  |  -  | Nr + Nt'  | EF EA 1C DA 8D 65 73 4B 
>   9 | TAG |  -  | Nt"       | 9A 42 7B 20 
>  10 | RD  | ok  | AUTH      | 60 00 F5 7B 
>  11 | TAG |  -  | Nt        | A5 5D 95 0B 
>  12 | RD  |  -  | Nr + Nt'  | EF 60 E2 6F 14 91 FB DB 
>  13 | TAG |  -  | Nt"       | A5 38 5D 38 
>  14 | RD  | ok  | AUTH      | 60 00 F5 7B 
>  15 | TAG |  -  | Nt        | C9 BE 54 A3 
>  16 | RD  |  -  | Nr + Nt'  | 13 7A 91 4A 09 C5 C2 3A 
>  17 | TAG |  -  | Nt"       | FC 52 8B B6 
>  18 | RD  | ok  | AUTH      | 60 00 F5 7B 
>  19 | TAG |  -  | Nt        | 4A 9C 33 94 
>  20 | RD  |  -  | Nr + Nt'  | F5 6D 23 9A AC 65 5F AB 
>  21 | TAG |  -  | Nt"       | B9 39 2D B9 
>  22 | RD  | ok  | READ      | 30 00 02 A8 
>  23 | TAG | ok  | DATABLOCK | 9C 59 9B 32 6C 88 04 00 47 C1 2D 2A C9 00 28 07 5A 41 
>  24 | RD  | ok  | READ      | 30 00 02 A8 
>  25 | TAG | ok  | DATABLOCK | 9C 59 9B 32 6C 88 04 00 47 C1 2D 2A C9 00 28 07 5A 41 
>  26 | RD  | ok  | READ      | 30 00 02 A8 
>  27 | TAG | ok  | DATABLOCK | 9C 59 9B 32 6C 88 04 00 47 C1 2D 2A C9 00 28 07 5A 41 
>  28 | RD  | ok  | READ      | 30 00 02 A8 
>  29 | TAG | ok  | DATABLOCK | 9C 59 9B 32 6C 88 04 00 47 C1 2D 2A C9 00 28 07 5A 41 
>  30 | RD  | ok  | READ      | 30 00 02 A8 
>  31 | TAG | ok  | DATABLOCK | 9C 59 9B 32 6C 88 04 00 47 C1 2D 2A C9 00 28 07 5A 41 
>  32 | RD  | ok  | READ      | 30 00 02 A8 
>  33 | TAG | ok  | DATABLOCK | 9C 59 9B 32 6C 88 04 00 47 C1 2D 2A C9 00 28 07 5A 41 
>  34 | RD  | ok  | READ      | 30 00 02 A8 
>  35 | TAG | ok  | DATABLOCK | 9C 59 9B 32 6C 88 04 00 47 C1 2D 2A C9 00 28 07 5A 41 
>  36 | RD  | ok  | READ      | 30 00 02 A8 
>  37 | TAG | ok  | DATABLOCK | 9C 59 9B 32 6C 88 04 00 47 C1 2D 2A C9 00 28 07 5A 41 
>  38 | RD  | ok  | READ      | 30 00 02 A8 
>  39 | TAG | ok  | DATABLOCK | 9C 59 9B 32 6C 88 04 00 47 C1 2D 2A C9 00 28 07 5A 41 
>  40 | RD  | ok  | READ      | 30 00 02 A8 
>  41 | TAG | ok  | DATABLOCK | 9C 59 9B 32 6C 88 04 00 47 C1 2D 2A C9 00 28 07 5A 41 
>  42 | RD  | ok  | READ      | 30 00 02 A8 
>  43 | TAG | ok  | DATABLOCK | 9C 59 9B 32 6C 88 04 00 47 C1 2D 2A C9 00 28 07 5A 41 
>  44 | RD  | ok  | READ      | 30 00 02 A8 
>  45 | TAG | ok  | DATABLOCK | 9C 59 9B 32 6C 88 04 00 47 C1 2D 2A C9 00 28 07 5A 41 

Last edited by rule (2009-04-20 22:21:41)

Offline

#7 2009-03-10 21:57:05

joker
Contributor
Registered: 2008-11-17
Posts: 34

Re: Some mifare traces

Thanks, all works as predicted ;-)

Offline

#8 2009-03-10 22:55:08

rule
Member
Registered: 2008-05-21
Posts: 417

Re: Some mifare traces

If you are playing around with your software implementation, you may want to to check out libnfc.
For 30,- USD you are able to test your software against a real card wink

Offline

#9 2009-03-11 10:27:38

sook
Member
Registered: 2008-12-18
Posts: 3

Re: Some mifare traces

the above trace why the key i running with this http://code.google.com/p/crapto1/ it doesn't work.

UID   :                              0x9c599b32, len:8
Tag Challenge :                  0x82a4166c, len:8
[Reader Challenge] :           0xa1e458ce, len:8
[Reader response] :            0x6eea41e0, len:8
[Tag response] :                0x5cadf439, len:8
nt': 8d65734b   nt'': 9a427b20  ks2: 7eb8c2ca   ks3: 1ff2fb32

Found Key: [2f d4 25 9e 32 21]

why the result from test.c  is 2f d4 25 9e 32 21 instead of KEY = 0xffffffffffff as you mention
Is there anything wrong?.

Last edited by sook (2009-03-11 10:46:37)

Offline

#10 2009-03-11 10:40:59

rule
Member
Registered: 2008-05-21
Posts: 417

Re: Some mifare traces

To verify you can download this proof of concept and change the following values:

  uint32_t uid                = 0x9c599b32;
  uint32_t tag_challenge      = 0x82a4166c;
  uint32_t nr_enc             = 0xa1e458ce;
  uint32_t reader_response    = 0x6eea41e0;
  uint32_t tag_response       = 0x5cadf439;

Compile and run the code

gcc -o test2 test2.c crapto1.c crypto1.c
./test2
nt': 8d65734b
nt'': 9a427b20
ks2: e38f32ab
ks3: c6ef8f19
Found Key: [ff ff ff ff ff ff]

Offline

#11 2009-03-11 10:57:54

joker
Contributor
Registered: 2008-11-17
Posts: 34

Re: Some mifare traces

How did you calculate your ks2,ks3?

I ask this ofcourse because:
- they are wrong
- they are valid keystreams (and the chance of a random error value being possible keystream is only 1 in 1<<16 )

Did you just copy them from another example?

Last edited by joker (2009-03-11 11:05:59)

Offline

#12 2009-03-11 11:43:18

sook
Member
Registered: 2008-12-18
Posts: 3

Re: Some mifare traces

Ok i got it that is my mistake

Here Crypto1Win32.exe, Below i just test Crypto1 code running on Win32.
I have create with Visual Studio2005 everything based on win32 environment.

Using

C:\Crypto1Win32.exe UID Tag_challenge nr_enc Reader_resonse Tag_response

Try to play this

// Crypto1Win32.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "crapto1.h"
#include <stdio.h>
#include <windows.h>

LPSTR UnicodeToAnsi(LPCWSTR s);
uint32_t HexStrToUINT32(const PBYTE inBuf, unsigned int uiLen);

int _tmain(int argc, wchar_t* argv[])
{
  struct Crypto1State *revstate;
  uint64_t lfsr;
  unsigned char* plfsr = (unsigned char*)&lfsr;
   
  uint32_t uid                = 0xc108416a;  //UID
  uint32_t tag_challenge      = 0xabcd1949;  //Nt
  uint32_t nr_enc             = 0x59d5920f;  //[Nr,
  uint32_t reader_resonse     = 0x15b9d553;  //    Nt']
  uint32_t tag_response       = 0xa79a3fee;  //[Nt'']

  uint32_t arguments[5];
  char name[5][20] = {"UID \t\t","Tag Challenge","[Reader Challenge]","[Reader response]","[Tag response]"};

  if(argc == 6)
  {
    for(int i=1; i<=5; i++)
    {
      LPCSTR tmp = UnicodeToAnsi(argv[i]);
      printf("%s : \t\t 0x%s, len:%d\n", &name[i-1], tmp, strlen(tmp));
      arguments[i-1] = HexStrToUINT32( (const PBYTE)tmp, (int)strlen(tmp) );
      delete[] tmp;
    }

    uid = arguments[0];
    tag_challenge = arguments[1];
    nr_enc = arguments[2];
    reader_resonse = arguments[3];
    tag_response = arguments[4];
  }
  else
  {
    printf("This cmd requires a set of arguments :\n");
    printf("UID Tag_challenge nr_enc Reader_resonse Tag_response\n");
    return 0;
  }
  uint32_t ks2                = reader_resonse ^ prng_successor(tag_challenge, 64);
  uint32_t ks3                = tag_response ^ prng_successor(tag_challenge, 96);

  printf("nt': %08x\t",prng_successor(tag_challenge, 64));
  printf("nt'': %08x\t",prng_successor(tag_challenge, 96));

  printf("ks2: %08x\t",ks2);
  printf("ks3: %08x\n",ks3);

  revstate = lfsr_recovery(ks2, ks3);
  lfsr_rollback(revstate, 0, 0);
  lfsr_rollback(revstate, 0, 0);
  lfsr_rollback(revstate, nr_enc, 1);
  lfsr_rollback(revstate, uid ^ tag_challenge, 0);
  crypto1_get_lfsr(revstate, &lfsr);
  printf("\nFound Key: [%02x %02x %02x %02x %02x %02x]\n",plfsr[0],plfsr[1],plfsr[2],plfsr[3],plfsr[4],plfsr[5]);

  return 0;
}

uint32_t HexStrToUINT32(const PBYTE inBuf, unsigned int uiLen)
{
  int niblePair=0x0;
  int j,k,bytecount=0;
  uint32_t rtn = 0x0;

  for( UINT c=0 ; c<uiLen-1 ; c++ )
  {
    // check character pair, loop if either j,k is over range
    do 
    {
      j = toupper(inBuf[c]);
      k = toupper(inBuf[c+1]);
      ++c;

      // interpretor and matching for parenthesis ignorance.
      if(j == '(')do{
        j = toupper(inBuf[c]);
        k = toupper(inBuf[c+1]);
        ++c;
      }while(j != ')');

      // NOT[(Is-j-valid)AND(Is-k-valid) OR Is-c-in-range]
    } while( !(((j>='A')&&(j<='F')||(j>='0')&&(j<='9')) &&
      ((k>='A')&&(k<='F')||(k>='0')&&(k<='9')) || (c>=uiLen)));

    /***  After a pair is ok!, proceed the step belows.  ***/

    // convert char of MSB' nibble to hex
    if ((j>='A') && (j<='F'))
      niblePair = 10+j-'A';
    else if(j>='0' && j<='9')
      niblePair = j-'0';
    else
      continue;

    niblePair<<=4;

    // convert char of LSB' nibble to hex
    if ((k>='A') && (k<='F'))
      niblePair|= (10+k-'A');
    else if(k>='0' && k<='9')
      niblePair|= (k-'0');
    else
      continue;

    // store int32
    rtn |= (uint32_t)niblePair;
    if(c < uiLen-2)rtn<<=8;
  }

  return rtn;
}

LPSTR UnicodeToAnsi(LPCWSTR s)
{
  if (s==NULL) return NULL;
  int cw=lstrlenW(s);
  if (cw==0) {CHAR *psz=new CHAR[1];*psz='\0';return psz;}
  int cc=WideCharToMultiByte(CP_ACP,0,s,cw,NULL,0,NULL,NULL);
  if (cc==0) return NULL;
  CHAR *psz=new CHAR[cc+1];
  cc=WideCharToMultiByte(CP_ACP,0,s,cw,psz,cc,NULL,NULL);
  if (cc==0) {delete[] psz;return NULL;}
  psz[cc]='\0';
  return psz;
};

Offline

#13 2009-03-11 17:30:30

joker
Contributor
Registered: 2008-11-17
Posts: 34

Re: Some mifare traces

Just a friendly tip.

If you need to convert from hex to uint, you might want to try strtoul(), or to do it the std c++ way
        stringstream ss("45e678");
        uint32_t u;
        ss >>hex>> u;

At the same time you might want to filter out spaces and exclamation marks ... just for good measure

Offline

#14 2009-03-16 01:36:21

touf
Contributor
Registered: 2008-12-11
Posts: 27

Re: Some mifare traces

once you had recovered the secret key, how do you uncrypt the data ?

Offline

#15 2009-03-20 02:10:28

Dennyxiao
Contributor
Registered: 2008-11-01
Posts: 43

Re: Some mifare traces

More trace samples. the first key should be  0x5cfd00c3a302  .
Could you please help me on calculate the block 36 password?
Many thanks


 +   1168:    :     52    
 +     64:   0: TAG 02  00    
 +    664:    :     93  20    
 +     64:   0: TAG 5c  fd  00  c3  62    
 +   1480:    :     93  70  5c  fd  00  c3  62  bc  87    
 +     64:   0: TAG 18  37  cd    
 +  74712:    :     60  04  d1  3d    
 +    112:   0: TAG 4e  68  16  8c    
 +   1128:    :     c3  83  b7  20  fb  84  19  78    !crc
 +     64:   0: TAG 58  8e  37  ec    
 +    904:    :     94  56  32  fb           !crc
 +     72:   0: TAG b6  a4  aa! 8c! e0! 88  ac  72! ad! a4! a5! 86  d7  11  5f  e6  48  5f          !crc
 +   2095:    :     a2  c9  2a  d7          !crc
 +  25989:    :     1d  fc  2c  24           !crc
 +   1248:    :     73  22  eb  14  2d  82  c2  bf    !crc
 +     80:   0: TAG 47! f7! 06  3c!   
 +    896:    :     c2  df  c5  b8            !crc
 +     72:   0: TAG 8f! e8! 64! df  21  75! c2! 7b  72  a8  47! 30  f2! 95! d8! 2e! 19! 90         !crc
 +   2088:    :     db  c4  2d  76          !crc
 +     72:   0: TAG 37  77  f7! f6  7d  5d  2d  15  4f  19  4e  9a  2a! 7c! e5! 4e! 3c! 5e!         !crc
 +   2850:   0: TAG 01    
 +    853:    :     e3  ee  8d  64  07  23  4f  f0      !crc
 +    976:    :     13  45  bf  d5           !crc
 +   2144:    :     33  ae  d1  ba          !crc
 +    208:   0: TAG 0b    
 +    824:    :     38  75  62  c8  8c  de            !crc
 +   5647:    :     b9  a8  7d  0b          !crc
 +   2816:   0: TAG 00!   
 +    672:    :     29  8f  44  83           !crc
 +     72:   0: TAG b3! 42! 81  9c! f3  52! 18! 8d! 63! 21! bc! c1! b9  35! 9d  cf! d1! e3             !crc
 + 598250:    :     c2  00    
 +   1176:    :     52

Offline

#16 2009-03-20 11:52:14

rule
Member
Registered: 2008-05-21
Posts: 417

Re: Some mifare traces

I suggest you paste this between [ code ] [ /code ] tags wink

Btw, this is not the place where to get your keys recovered. This is a development forum where you can share/discuss your development progress. I suggest you start up a development project for this. I'm sure there are other members who want to help you.

Offline

#17 2009-03-26 15:07:54

sook
Member
Registered: 2008-12-18
Posts: 3

Re: Some mifare traces

the following traces i got it from 3 kind of MiFare Cards
-Java Card + MiFare Emulator Vendor 1
-Java Card + MiFare Emulator Vendor 2
-MiFare Card from OpenPCD

Are there any differnce?

> hi14alist    // COS-MIFARE
recorded activity:
 ETU     :rssi: who bytes
---------+----+----+-----------
 +      0:    :     26    
 + 860814:    :     26    
 +   1672:    :     93  20    
 +   2584:    :     93  70  20  64  c8  9a  16  c7  0f    
 +2029462:    :     60  00  f5  7b    
 +   1584:    :     6b  db  22  6f  f9  52  bb  5b      !crc
 +2352079:    :     6b  f4  fc  b6      !crc
 +   1186:   0: TAG 01    
 +    110:   0: TAG 03!  

> hi14alist   // Java Card Emulator + MiFare
recorded activity:
 ETU     :rssi: who bytes
---------+----+----+-----------
 +      0:    :     26    
 +   1672:    :     93  20    
 +   2584:    :     93  70  7c  57  a5  fd  73  6e  82    
 +2015452:    :     60  00  f5  7b    
 +   1480:    :     25  1d  82  cd  47  63  77  7b      !crc
 +3034118:    :     26    
 +   1680:    :     93  20    
 +    108:   0: TAG 03!   
 +    216:   0: TAG 07    
 +   2260:    :     93  70  7c  57  a5  fd  73  6e  82    
 +    252:   0: TAG 03!   
 +1806624:    :     60  04  d1  3d    
 +    228:   0: TAG 03!   
 +     48:   0: TAG 03!   
 +   1196:    :     d6  41  f5  dc  03  17  c6  a0      !crc
 +    220:   0: TAG 03!   
 +2094574:    :     8a  fe  6c  82      !crc
 +    180:   0: TAG 01  

 > hi14alist  // OpenPCD Mifare
recorded activity:
 ETU     :rssi: who bytes
---------+----+----+-----------
 +      0:    :     26    
 +     64:   0: TAG 04    
 +   1616:    :     93  20    
 +     64:   0: TAG 04    
 +   2520:    :     93  70  2c  ba  60  d3  25  be  75    
 +     64:   0: TAG 08    
 +     61:   0: TAG 07    
 +4223499:    :     60  04  d1  3d    
 +    112:   0: TAG 09!   
 +    124:   0: TAG 03!   
 +   1292:    :     af  f5  76  aa  80  55  41  be      !crc
 +     64:   0: TAG 82!   
 +1325756:    :     a1  10  38  59      !crc
 +     72:   0: TAG 11!   
 +   1164:   0: TAG 03!   

Does anyone know how to capture trace of FeliCa, Can the proxIII does?

Last edited by sook (2009-03-26 15:08:54)

Offline

#18 2009-03-26 16:28:41

rule
Member
Registered: 2008-05-21
Posts: 417

Re: Some mifare traces

You should know that after every reader command there should be tag reaction (except for the HALT: 50 00 57 CD).
I suggest you play with the location and positioning of the reader, tag and antenna to make a complete (valid) trace.
Look for an example of a complete trace here.

I'm also interested in traces made from Felica cards, please let me know when there are some available.

Offline

#19 2009-04-20 15:34:04

RFlD
Member
Registered: 2009-03-13
Posts: 12

Re: Some mifare traces

I want to know how can i get the parity bits?
It seems there are not any parity bits, are there?

Offline

#20 2009-04-22 02:58:24

RFlD
Member
Registered: 2009-03-13
Posts: 12

Re: Some mifare traces

Johann_Gamblepudding, thanks a lot~!

Offline

#21 2009-11-22 18:53:03

*dudux
Member
Registered: 2009-10-04
Posts: 7

Re: Some mifare traces

roel wrote:

To verify you can download this proof of concept and change the following values:

  uint32_t uid                = 0x9c599b32;
  uint32_t tag_challenge      = 0x82a4166c;
  uint32_t nr_enc             = 0xa1e458ce;
  uint32_t reader_response    = 0x6eea41e0;
  uint32_t tag_response       = 0x5cadf439;

Compile and run the code

gcc -o test2 test2.c crapto1.c crypto1.c
./test2
nt': 8d65734b
nt'': 9a427b20
ks2: e38f32ab
ks3: c6ef8f19
Found Key: [ff ff ff ff ff ff]

hi,

guepardo crapto1 # vi test.c
guepardo crapto1 # ls
crapto1.c  crapto1.h  crapto1-v3.1.tar.gz  crypto1.c  qrapto1  readme  test.c
guepardo crapto1 # gcc -o test test.c crapto1.c crypto1.c
test.c: In function ‘main’:
test.c:25: warning: assignment makes pointer from integer without a cast
/tmp/ccvmoJPi.o: In function `main':
test.c:(.text+0xe9): undefined reference to `lfsr_recovery'
test.c:(.text+0x107): undefined reference to `lfsr_rollback'
test.c:(.text+0x122): undefined reference to `lfsr_rollback'
test.c:(.text+0x13c): undefined reference to `lfsr_rollback'
test.c:(.text+0x15b): undefined reference to `lfsr_rollback'
collect2: ld returned 1 exit status
guepardo crapto1 #

Roel,Why not compile?

Offline

#22 2009-11-22 21:06:32

hat
Contributor
Registered: 2009-04-12
Posts: 160

Re: Some mifare traces

Well I know you asked roel, but i'll jump in and tell you that it *does* compile.

The problem is that it isn't being *linked* properly. Not a trivial distinction.

However i'm sure you are only interested in the solution. So i'll tell you all you have to do is change

every occurance of "lfsr_rollback"
into
lfsr_rollback_word

and then it will link properly.

Offline

#23 2011-12-12 08:02:42

alabama_2000
Member
Registered: 2011-12-10
Posts: 2

Re: Some mifare traces

Hi Roel,

I used your first set of example to test my cpypt algorithm:

              Initialization values
         UID: de  ad  be  af
         KEY: ff  ff  ff  ff  ff  ff

              Decrypted random nonces
          Nt: b0  0b  77  90
         Nt': cc  02  30  82
        Nt'': eb  4e  fb  2e
          Nr: ae  99  ca  99

              Mifare Classic trace, []=Encrypted
    Auth(00): 60  00  f5  7b
          Nt: b0  0b  77  90
    [Nr,Nt']: ca  fe! ba  be  48  76! af  fa
      [Nt'']: 69  1e  8d  21
	  

I obtain next parity bites:
  1, 1, 0, 1, 1, 1, 1, 1

Coverting ca  ca fe ba  be  48  76 af  fa + parity bites -> ca fd eb f2 8d d4 ee 6b fd (this data should be send to card/tag)
Apply same algorithm for a Mifare clasic 1K -> tag doesn't reply. Do you have some suggestion?
Thank you very much in advance.

Offline

#24 2012-06-27 20:13:22

edo1
Contributor
Registered: 2012-05-02
Posts: 18

Re: Some mifare traces

roel wrote:

There you go, as you can extract from this trace:
UID = 0x9c599b32
KEY = 0xffffffffffff

 + 987853:  4 :     56  98  49  d6!       !crc
 +     72: 18 : TAG 09  bf! f5! f6! fc! b9! 5e! 51! 07  ac  f6  72  f8  73  3b! 1b  73! ad!       !crc

And for those who want to confirm their understanding of this puzzle

>  22 | RD  | ok  | READ      | 30 00 02 A8 
>  23 | TAG | ok  | DATABLOCK | 9C 59 9B 32 6C 88 04 00 47 C1 2D 2A C9 00 28 07 5A 41 

What software do you use to decode sniffed trace?

Last edited by edo1 (2012-06-27 20:57:06)

Offline

#25 2012-07-07 11:28:13

rule
Member
Registered: 2008-05-21
Posts: 417

Re: Some mifare traces

This is a piece of software that a colleague of me has developed. We decided at the time to keep such a tool private. Maybe in the future it will be released, if this will be the case, you can probably find a post about it in this community.

Offline

Board footer

Powered by FluxBB