SlideShare une entreprise Scribd logo
1  sur  30
Télécharger pour lire hors ligne
Mifare Classic
          analysis
    in Czech Republic / Slovakia
        Ing. Pavol Lupták, CISSP, CEH
           Lead Security Consultant
                      

                                   www.nethemba.com       
                                    www.nethemba.com      
Legal disclaimer
   Nethemba s.r.o. is not responsible for a public 
    misuse of Mifare Classic cards in Czech or 
    Slovak republic
   this presentation is supposed to be Mifare 
    Classic security analysis in Czech / Slovak 
    environment, not a manual that can be misused 
    for commiting crimes

                            

                                            www.nethemba.com       
Contents
   Background
   Mifare Classic basics & security
   Mifare Classic attacks in theory
   Available hardware tools & software 
    implementations
   Vulnerabilities in Slovak Mifare Classic cards
   Our Mifare Classic Offline Cracker 
                            

                                            www.nethemba.com       
Mifare Classic technology
    one of the most used RFID card (more than 1 
     billion smart card chips are used)
    is based on ISO/IEC 14443 Type A, 1kB or 4kB
    uses 13.56 Mhz contactless smartcard standard
    uses a proprietary CRYPTO1 with 48 bits keys
    had a lot of security problems in the past but 
     nobody cares :­)
    it's cheap (about 1 €)    

                                             www.nethemba.com       
Usage in Czech/Slovak republic
   all University/ISIC/Euro26 cards
   public transport ID (“električenka”) in Bratislava
   Slovak Lines, Slovak railways cards
   parking cards
   for the current list see http://www.emtest.biz/sk/

                             

                                             www.nethemba.com       
Mifare Classic structure




                

                            www.nethemba.com       
Mifare Classic security
   read­only Unique Identifier (UID)
   mutual authentication between reader and 
    writer and encrypted communication
   CRYPTO1 non­public algorithm implementation
   obfuscated parity information
   hardware implementation only

                           

                                             www.nethemba.com       
Mifare Classic commands
   authenticate
   read, write, increment, decrement – always 
    sent in encrypted session
   transfer – writes the result of decrement, 
    increment/restore to non­volatile memory
   restore – prepares the current value of a block 
    for being rewritten to non­volatile memory
                            

                                           www.nethemba.com       
Mifare Classic default keys
   a lot of publicly used cards (even in Czech 
    Republic / Slovakia) use at least one block 
    encrypted with default keys:
    0xffffffffffff      0xa0a1a2a3a4a5
    0xb0b1b2b3b4b5  0x4d3a99c351dd
    0x1a982c7e459a  000000000000
    0xd3f7d3f7d3f7      0xaabbccddeeff
                            

                                           www.nethemba.com       
Linear Feedback Shift Register 
               (LFSR)
   pseudo random generation defined by the 
    polynomial x^16 + x^14 + x^13 + x^11 + 1
   length is 32 bits, but it has only 16 bits entropy!
   L16 = x0 XOR x11 XOR x13 XOR x14 XOR x16
   Ar = suc2(Nt), At = suc3(Nt)
   generated nonces can be predicted in the time
                             

                                              www.nethemba.com       
CRYPTO1 Cipher initialization
   No non­linear feedback




                          

                                  www.nethemba.com       
Authentication process
      Step      Sender      Hex                            Abstract
      01        Reader      26                             req type A
      02        Tag         04 00                          Answer req
      03        Reader      93 20                          select
      04        Tag         c2 a8 2d f4 b3                 uid, bcc
      05        Reader      93 70 c2 a8 2d f4 b3 ba a3     select(uid)
      06        Tag         08 b6 dd                       MIFARE 1k
      07        Reader      60 30 76 4a                    auth(block 30)
      08        Tag         42 97 c0 a4                    Nt
      09        Reader      7d db 9b 83 67 eb 5d 83        Nr XOR ks1,Ar XOR ks2
      10        Tag         8b d4 10 08                    At XOR ks3
Tag                                       Reader
picks Nt and sends to reader              ks1 <- cipher(K, uid, Nt), picks Nr
ks1 ← crypto1(K, uid, Nt)                 ks2, ks3 .... ← cipher(K, uid, Nt, Nr) and sends
                                          to tag Nr XOR ks1, suc2(Nt) XOR ks2
ks2, ks3.. ← cipher(K, uid, Nt, Nr)
 sends   to reader suc3(Nt) XOR ks3       Ar  = suc2(Nt)
                                                                         www.nethemba.com       
Authentication process with 
timeout – how to recover ks2, ks3

Ghost                          Reader
picks Nt and sends to reader   ks1 <- cipher(K, uid, Nt), picks Nr
                               ks2, ks3 .... ← cipher(K, uid, Nt, Nr) and sends
                               to tag Nr XOR ks1, suc2(Nt) XOR ks2
Wait for timeout
                               Reader sends to the tag halt XOR ks3




                                   

                                                            www.nethemba.com       
“timeout” Attack in practice
   computing offline LFSR state table (for 2^36 
    entries) LFSR state from 0 to 0xfffffffff and 
    adequate ks2 ks3, it takes 4­8 hours
   computing online Nt table (for 2^12) entries 
    from 0 to 0xfff0 and adequate ks2 ks3 → there 
    is one Nt producing LFSR for a given ks2 ks3, it 
    takes 2­14 minutes
   rolling back Nr, Nt XOR uid and the result key
                            

                                            www.nethemba.com       
Nested Attack
1. Authenticate to the block with default key and 
  read tag's Nt (determined by LFSR)
2. Authenticate to the same block with default key 
  and read tag's Nt' (determined by LFSR) (this 
  authentication is in an encrypted session)
3. Compute “timing distance” (number of LFSR 
  shifts) 
  4. Guess the Nt value and authenticate to the 
    different block       

                                         www.nethemba.com       
Other Mifare Classic mistakes
   reader­side accepts invalid frame­lengths
   the parity bit is encrypted, but the internal state 
    will not shift → the first bit of the next byte will 
    be encrypted by the same keystream bit
   only 20 bits are used or keystream bit
   statistical bias in the cipher
   influence of bits is not balanced
                              

                                              www.nethemba.com       
Cloning
   when all keys are gained, every card can be 
    easily cloned
   we can make 99.6% clone (except 0.block in 
    0.sector that contains read­only UID)
   all blocks (including UID!) can be 100% 
    emulated by Proxmark3
   protection against cloning – make whitelist of 
    allowed UIDs, or always use it in card content 
    encryption             

                                          www.nethemba.com       
Restoring Credit
    Anti­cloning protection does not work against 
     dumping the whole card ­ when you decide to 
     charge your card and restore the dump with 
     original credit (UID remains the same)
    Countermeasure #1 – use safer cards (Mifare 
     Plus/DESFire or other)
    Countermeasure #2 – use “decrement 
     counter” protection (it's only “workaround”)
    Countermeasure #3 – use online checking
                         

                                             www.nethemba.com       
Crapto1
   open implementation of attacks against the 
    CRYPTO1 cipher
   can be used for cracking Mifare Classic initial 
    authentication handshake
   our “nested offline” card attack  is based on 
    crapto1 libraries


                             

                                            www.nethemba.com       
Proxmark3
   general­purpose RFID tool designed to snoop, 
    listen and emulate everything from LF (125kHz) 
    to HF (13.56Mhz) tags, universal hacking RFID 
    tool :­)




                          

                                         www.nethemba.com       
Tikitag / Touchatag
   very cheap (30 EUR), NFC­based RFID 
    reader/writer 




                         

                                       www.nethemba.com       
Slovak Mifare Classic vulnerabilities
    all tested cards use the same keys (!!!) for the 
     first 1024 bytes (first 16 keys are the SAME!)
    there is always at least one sector encrypted 
     with default key! (possibility of nested attacks)
    the name of passenger/owner is always stored 
     in 0xd block – imagine what can happens with 
     strong antenna :­) 
    no protection against cloning or modification!
    can be easily cloned and modified!!!
                            

                                              www.nethemba.com       
Mifare Classic binary analysis
       we have done binary difference analysis 
        between new bought card, after its activation 
        and charging credit
       0xd block – passenger/user name
       0x24 block ­ “električenka” expiration date
       0x81 block – student's university number
       0x82 block – student's name
                               

                                               www.nethemba.com       
Attacker's costs

   30 € – tikitag / touchatag RFID reader/writer 
    (sufficient for reading / cracking / writing / 
    cloning Mifare Classic cards)
   $ 449 – Proxmark 3 (just for advanced RFID 
    playing :­)
   1 € for blank 4kB Mifare Classic (can be bought 
    on ebay.com from Thaiwan/China :­)
                             

                                             www.nethemba.com       
Solution
●   use safer technology + strong cryptography, 
    bind user identity with card's read­only UID + 
    use UID in card content encryption
●   partial workaround: bind user identity with 
    card's read­only UID, use UID in card content 
    encryption, use UID whitelists, use “decrement 
    counter” solution

                            

                                            www.nethemba.com       
“Decrement­counter” workaround
       replacing all Mifare Classic cards to safer ones 
        is very expensive and time­consuming – is it 
        possible to use insecure Mifare Classic layer 
        with “secure” implementation???
       “decrement counter” (initially set to 0xffffffff), 
        keys A/B have permissions only for 
        decrementing counter and cannot be changed, 
        content of card (with passenger credit) is 
        encrypted/hashed with card UID, decrement 
        counter and private key 

                                                www.nethemba.com       
Our Mifare Classic Offline Cracker
    the first public disclosure of Mifare Offline 
     cracker based on “Nested Attack” already 
     published by Dutch researchers
    we want to demonstrate that massively used 
     Mifare Classic cards can be easily cracked / 
     dumped
    can be found here 
     https://www.nethemba.com/research/
    use it, improve it and let us know the bugs
                               

                                               www.nethemba.com       
Mifare Classic Key Recovery Tool
       “Dark side” paper attack implementation by 
        Andrei C
       recovers at least one key for a card that can be 
        used with our MFOC Nested Attack 
       http://code.google.com/p/tk­libnfc­crapto1/
       wait for MFOC integration!

                               

                                               www.nethemba.com       
What's next?

   wait for our hitag analysis! (most of 
    Czech/Slovak “badge” cards are affected, and 
    yes – it's also used in Renault / Opel / Peugeot/ 
    Citroen / … car keys :­)
   playing with GSM, see & support 
    http://reflextor.com/trac/a51 project, all GSM 
    communication can be cracked!
                             

                                            www.nethemba.com       
References
   http://nickholdren.com/wp­content/uploads/2009/07
   https://har2009.org/program/attachments/123_[HAR
   http://www.cs.ru.nl/~flaviog/publications/Talk.Mifare
   http://www.cs.ru.nl/~petervr/papers/grvw_2009_pick
   http://code.google.com/p/crapto1/
   http://www.touchatag.com/
   http://proxmark3.com/
                             

                                             www.nethemba.com       

Contenu connexe

Tendances

microsoft-cybersecurity-reference-architectures (1).pptx
microsoft-cybersecurity-reference-architectures (1).pptxmicrosoft-cybersecurity-reference-architectures (1).pptx
microsoft-cybersecurity-reference-architectures (1).pptxGenericName6
 
Palo alto NGfw2023.pptx
Palo alto  NGfw2023.pptxPalo alto  NGfw2023.pptx
Palo alto NGfw2023.pptxahmad661583
 
Risk Assessment and Threat Modeling
Risk Assessment and Threat ModelingRisk Assessment and Threat Modeling
Risk Assessment and Threat Modelingsedukull
 
Demystifying Prisma Access
Demystifying Prisma AccessDemystifying Prisma Access
Demystifying Prisma AccessHaris Chughtai
 
Firewall and Types of firewall
Firewall and Types of firewallFirewall and Types of firewall
Firewall and Types of firewallCoder Tech
 
01- intro to firewall concepts
01- intro to firewall concepts01- intro to firewall concepts
01- intro to firewall conceptsMostafa El Lathy
 
Mapping to MITRE ATT&CK: Enhancing Operations Through the Tracking of Interac...
Mapping to MITRE ATT&CK: Enhancing Operations Through the Tracking of Interac...Mapping to MITRE ATT&CK: Enhancing Operations Through the Tracking of Interac...
Mapping to MITRE ATT&CK: Enhancing Operations Through the Tracking of Interac...MITRE ATT&CK
 
Cifrado elgamal
Cifrado elgamalCifrado elgamal
Cifrado elgamalG Hoyos A
 
unified threat management by Nisha Menon K
 unified threat management by Nisha Menon K unified threat management by Nisha Menon K
unified threat management by Nisha Menon KNisha Menon K
 
CyberOps Associate Modul 23 Endpoint Vulnerability Assessment
CyberOps Associate Modul 23 Endpoint Vulnerability AssessmentCyberOps Associate Modul 23 Endpoint Vulnerability Assessment
CyberOps Associate Modul 23 Endpoint Vulnerability AssessmentPanji Ramadhan Hadjarati
 
Paillier-ElGamal cryptosystem presentation
Paillier-ElGamal cryptosystem presentationPaillier-ElGamal cryptosystem presentation
Paillier-ElGamal cryptosystem presentationGauthamSK4
 
Man in-the-middle attack(http)
Man in-the-middle attack(http)Man in-the-middle attack(http)
Man in-the-middle attack(http)Togis UAB Ltd
 
Fundamentals of IoT Security
Fundamentals of IoT SecurityFundamentals of IoT Security
Fundamentals of IoT SecuritySHAAMILIVARSAGV
 
The Diamond Model for Intrusion Analysis - Threat Intelligence
The Diamond Model for Intrusion Analysis - Threat IntelligenceThe Diamond Model for Intrusion Analysis - Threat Intelligence
The Diamond Model for Intrusion Analysis - Threat IntelligenceThreatConnect
 
Email Security Presentation
Email Security PresentationEmail Security Presentation
Email Security PresentationYosef Gamble
 

Tendances (20)

microsoft-cybersecurity-reference-architectures (1).pptx
microsoft-cybersecurity-reference-architectures (1).pptxmicrosoft-cybersecurity-reference-architectures (1).pptx
microsoft-cybersecurity-reference-architectures (1).pptx
 
Palo alto NGfw2023.pptx
Palo alto  NGfw2023.pptxPalo alto  NGfw2023.pptx
Palo alto NGfw2023.pptx
 
Risk Assessment and Threat Modeling
Risk Assessment and Threat ModelingRisk Assessment and Threat Modeling
Risk Assessment and Threat Modeling
 
Firewalls
FirewallsFirewalls
Firewalls
 
Breach and attack simulation tools
Breach and attack simulation toolsBreach and attack simulation tools
Breach and attack simulation tools
 
WiFi Secuiry: Attack & Defence
WiFi Secuiry: Attack & DefenceWiFi Secuiry: Attack & Defence
WiFi Secuiry: Attack & Defence
 
Demystifying Prisma Access
Demystifying Prisma AccessDemystifying Prisma Access
Demystifying Prisma Access
 
Firewall and Types of firewall
Firewall and Types of firewallFirewall and Types of firewall
Firewall and Types of firewall
 
01- intro to firewall concepts
01- intro to firewall concepts01- intro to firewall concepts
01- intro to firewall concepts
 
Mapping to MITRE ATT&CK: Enhancing Operations Through the Tracking of Interac...
Mapping to MITRE ATT&CK: Enhancing Operations Through the Tracking of Interac...Mapping to MITRE ATT&CK: Enhancing Operations Through the Tracking of Interac...
Mapping to MITRE ATT&CK: Enhancing Operations Through the Tracking of Interac...
 
Cifrado elgamal
Cifrado elgamalCifrado elgamal
Cifrado elgamal
 
unified threat management by Nisha Menon K
 unified threat management by Nisha Menon K unified threat management by Nisha Menon K
unified threat management by Nisha Menon K
 
Threat Hunting with Cyber Kill Chain
Threat Hunting with Cyber Kill ChainThreat Hunting with Cyber Kill Chain
Threat Hunting with Cyber Kill Chain
 
CyberOps Associate Modul 23 Endpoint Vulnerability Assessment
CyberOps Associate Modul 23 Endpoint Vulnerability AssessmentCyberOps Associate Modul 23 Endpoint Vulnerability Assessment
CyberOps Associate Modul 23 Endpoint Vulnerability Assessment
 
Paillier-ElGamal cryptosystem presentation
Paillier-ElGamal cryptosystem presentationPaillier-ElGamal cryptosystem presentation
Paillier-ElGamal cryptosystem presentation
 
Man in-the-middle attack(http)
Man in-the-middle attack(http)Man in-the-middle attack(http)
Man in-the-middle attack(http)
 
Software security
Software securitySoftware security
Software security
 
Fundamentals of IoT Security
Fundamentals of IoT SecurityFundamentals of IoT Security
Fundamentals of IoT Security
 
The Diamond Model for Intrusion Analysis - Threat Intelligence
The Diamond Model for Intrusion Analysis - Threat IntelligenceThe Diamond Model for Intrusion Analysis - Threat Intelligence
The Diamond Model for Intrusion Analysis - Threat Intelligence
 
Email Security Presentation
Email Security PresentationEmail Security Presentation
Email Security Presentation
 

Similaire à Mifare classic-slides

A 2018 practical guide to hacking RFID/NFC
A 2018 practical guide to hacking RFID/NFCA 2018 practical guide to hacking RFID/NFC
A 2018 practical guide to hacking RFID/NFCSecuRing
 
A 2018 practical guide to hacking RFID/NFC
A 2018 practical guide to hacking RFID/NFCA 2018 practical guide to hacking RFID/NFC
A 2018 practical guide to hacking RFID/NFCSlawomir Jasek
 
CONFidence 2018: A 2018 practical guide to hacking RFID/NFC (Sławomir Jasek)
CONFidence 2018: A 2018 practical guide to hacking RFID/NFC (Sławomir Jasek)CONFidence 2018: A 2018 practical guide to hacking RFID/NFC (Sławomir Jasek)
CONFidence 2018: A 2018 practical guide to hacking RFID/NFC (Sławomir Jasek)PROIDEA
 
BalCCon2k18 - Towards the perfect cryptocurrency wallet
BalCCon2k18 - Towards the perfect cryptocurrency walletBalCCon2k18 - Towards the perfect cryptocurrency wallet
BalCCon2k18 - Towards the perfect cryptocurrency walletNemanja Nikodijević
 
1300 david oswald id and ip theft with side-channel attacks
1300 david oswald   id and ip theft with side-channel attacks1300 david oswald   id and ip theft with side-channel attacks
1300 david oswald id and ip theft with side-channel attacksPositive Hack Days
 
Crypto Wallets: A Technical Perspective (Nakov at OpenFest 2018)
Crypto Wallets: A Technical Perspective (Nakov at OpenFest 2018)Crypto Wallets: A Technical Perspective (Nakov at OpenFest 2018)
Crypto Wallets: A Technical Perspective (Nakov at OpenFest 2018)Svetlin Nakov
 
Stream ciphers presentation
Stream ciphers presentationStream ciphers presentation
Stream ciphers presentationdegarden
 
Detailed cryptographic analysis of contact tracing protocols
Detailed cryptographic analysis of contact tracing protocolsDetailed cryptographic analysis of contact tracing protocols
Detailed cryptographic analysis of contact tracing protocolsChristian Spolaore
 
201803 Blockchains, Cryptocurrencies & Tokens - NYC Bar Association Presentat...
201803 Blockchains, Cryptocurrencies & Tokens - NYC Bar Association Presentat...201803 Blockchains, Cryptocurrencies & Tokens - NYC Bar Association Presentat...
201803 Blockchains, Cryptocurrencies & Tokens - NYC Bar Association Presentat...Paperchain
 
Meetup -- RFID
Meetup -- RFIDMeetup -- RFID
Meetup -- RFIDKevin2600
 
Don't Tell Joanna the Virtualized Rootkit is Dead (Blackhat 2007)
Don't Tell Joanna the Virtualized Rootkit is Dead (Blackhat 2007)Don't Tell Joanna the Virtualized Rootkit is Dead (Blackhat 2007)
Don't Tell Joanna the Virtualized Rootkit is Dead (Blackhat 2007)Nate Lawson
 
1 Cryptography Introduction_shared.ppt
1 Cryptography Introduction_shared.ppt1 Cryptography Introduction_shared.ppt
1 Cryptography Introduction_shared.pptssuser0cd7c9
 
How Triton can help to reverse virtual machine based software protections
How Triton can help to reverse virtual machine based software protectionsHow Triton can help to reverse virtual machine based software protections
How Triton can help to reverse virtual machine based software protectionsJonathan Salwan
 
symet.crypto.hill.cipher.2023.ppt
symet.crypto.hill.cipher.2023.pptsymet.crypto.hill.cipher.2023.ppt
symet.crypto.hill.cipher.2023.ppthalosidiq1
 
Jaimin chp-8 - network security-new -use this - 2011 batch
Jaimin   chp-8 - network security-new -use this -  2011 batchJaimin   chp-8 - network security-new -use this -  2011 batch
Jaimin chp-8 - network security-new -use this - 2011 batchJaimin Jani
 

Similaire à Mifare classic-slides (20)

amrapali builders@@sub way hacking.pdf
amrapali builders@@sub way hacking.pdfamrapali builders@@sub way hacking.pdf
amrapali builders@@sub way hacking.pdf
 
Nullcon 2011 RFID - NÂO ENVIADO AO EVENTO
Nullcon 2011   RFID - NÂO ENVIADO AO EVENTONullcon 2011   RFID - NÂO ENVIADO AO EVENTO
Nullcon 2011 RFID - NÂO ENVIADO AO EVENTO
 
Nullcon 2011 RFID - NÂO ENVIADO AO EVENTO
Nullcon 2011   RFID - NÂO ENVIADO AO EVENTONullcon 2011   RFID - NÂO ENVIADO AO EVENTO
Nullcon 2011 RFID - NÂO ENVIADO AO EVENTO
 
A 2018 practical guide to hacking RFID/NFC
A 2018 practical guide to hacking RFID/NFCA 2018 practical guide to hacking RFID/NFC
A 2018 practical guide to hacking RFID/NFC
 
A 2018 practical guide to hacking RFID/NFC
A 2018 practical guide to hacking RFID/NFCA 2018 practical guide to hacking RFID/NFC
A 2018 practical guide to hacking RFID/NFC
 
CONFidence 2018: A 2018 practical guide to hacking RFID/NFC (Sławomir Jasek)
CONFidence 2018: A 2018 practical guide to hacking RFID/NFC (Sławomir Jasek)CONFidence 2018: A 2018 practical guide to hacking RFID/NFC (Sławomir Jasek)
CONFidence 2018: A 2018 practical guide to hacking RFID/NFC (Sławomir Jasek)
 
BalCCon2k18 - Towards the perfect cryptocurrency wallet
BalCCon2k18 - Towards the perfect cryptocurrency walletBalCCon2k18 - Towards the perfect cryptocurrency wallet
BalCCon2k18 - Towards the perfect cryptocurrency wallet
 
1300 david oswald id and ip theft with side-channel attacks
1300 david oswald   id and ip theft with side-channel attacks1300 david oswald   id and ip theft with side-channel attacks
1300 david oswald id and ip theft with side-channel attacks
 
Crypto Wallets: A Technical Perspective (Nakov at OpenFest 2018)
Crypto Wallets: A Technical Perspective (Nakov at OpenFest 2018)Crypto Wallets: A Technical Perspective (Nakov at OpenFest 2018)
Crypto Wallets: A Technical Perspective (Nakov at OpenFest 2018)
 
Stream ciphers presentation
Stream ciphers presentationStream ciphers presentation
Stream ciphers presentation
 
Detailed cryptographic analysis of contact tracing protocols
Detailed cryptographic analysis of contact tracing protocolsDetailed cryptographic analysis of contact tracing protocols
Detailed cryptographic analysis of contact tracing protocols
 
201803 Blockchains, Cryptocurrencies & Tokens - NYC Bar Association Presentat...
201803 Blockchains, Cryptocurrencies & Tokens - NYC Bar Association Presentat...201803 Blockchains, Cryptocurrencies & Tokens - NYC Bar Association Presentat...
201803 Blockchains, Cryptocurrencies & Tokens - NYC Bar Association Presentat...
 
Meetup -- RFID
Meetup -- RFIDMeetup -- RFID
Meetup -- RFID
 
Don't Tell Joanna the Virtualized Rootkit is Dead (Blackhat 2007)
Don't Tell Joanna the Virtualized Rootkit is Dead (Blackhat 2007)Don't Tell Joanna the Virtualized Rootkit is Dead (Blackhat 2007)
Don't Tell Joanna the Virtualized Rootkit is Dead (Blackhat 2007)
 
Iss lecture 2
Iss lecture 2Iss lecture 2
Iss lecture 2
 
1 Cryptography Introduction_shared.ppt
1 Cryptography Introduction_shared.ppt1 Cryptography Introduction_shared.ppt
1 Cryptography Introduction_shared.ppt
 
How Triton can help to reverse virtual machine based software protections
How Triton can help to reverse virtual machine based software protectionsHow Triton can help to reverse virtual machine based software protections
How Triton can help to reverse virtual machine based software protections
 
symet.crypto.hill.cipher.2023.ppt
symet.crypto.hill.cipher.2023.pptsymet.crypto.hill.cipher.2023.ppt
symet.crypto.hill.cipher.2023.ppt
 
Mifare cards
Mifare cardsMifare cards
Mifare cards
 
Jaimin chp-8 - network security-new -use this - 2011 batch
Jaimin   chp-8 - network security-new -use this -  2011 batchJaimin   chp-8 - network security-new -use this -  2011 batch
Jaimin chp-8 - network security-new -use this - 2011 batch
 

Plus de OWASP (Open Web Application Security Project)

Plus de OWASP (Open Web Application Security Project) (16)

Paralelni polisweb
Paralelni poliswebParalelni polisweb
Paralelni polisweb
 
Nethemba - Writing exploits
Nethemba - Writing exploitsNethemba - Writing exploits
Nethemba - Writing exploits
 
Preco sa rozhodnut pre spolocnost Nethemba
Preco sa rozhodnut pre spolocnost NethembaPreco sa rozhodnut pre spolocnost Nethemba
Preco sa rozhodnut pre spolocnost Nethemba
 
Planning the OWASP Testing Guide v4
Planning the OWASP Testing Guide v4Planning the OWASP Testing Guide v4
Planning the OWASP Testing Guide v4
 
Bypassing Web Application Firewalls
Bypassing Web Application FirewallsBypassing Web Application Firewalls
Bypassing Web Application Firewalls
 
Nethemba metasploit
Nethemba metasploitNethemba metasploit
Nethemba metasploit
 
Sms ticket-hack4
Sms ticket-hack4Sms ticket-hack4
Sms ticket-hack4
 
Se linux course1
Se linux course1Se linux course1
Se linux course1
 
Real web-attack-scenario
Real web-attack-scenarioReal web-attack-scenario
Real web-attack-scenario
 
Practical web-attacks2
Practical web-attacks2Practical web-attacks2
Practical web-attacks2
 
Php sec
Php secPhp sec
Php sec
 
Nove trendy-zranitelnosti
Nove trendy-zranitelnostiNove trendy-zranitelnosti
Nove trendy-zranitelnosti
 
New web attacks-nethemba
New web attacks-nethembaNew web attacks-nethemba
New web attacks-nethemba
 
Nethemba profil
Nethemba profilNethemba profil
Nethemba profil
 
1.nove trendy-zranitelnosti luptak
1.nove trendy-zranitelnosti luptak1.nove trendy-zranitelnosti luptak
1.nove trendy-zranitelnosti luptak
 
Nethemba profil
Nethemba profilNethemba profil
Nethemba profil
 

Dernier

Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 

Dernier (20)

DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 

Mifare classic-slides

  • 1. Mifare Classic analysis in Czech Republic / Slovakia Ing. Pavol Lupták, CISSP, CEH Lead Security Consultant          www.nethemba.com             www.nethemba.com      
  • 2. Legal disclaimer  Nethemba s.r.o. is not responsible for a public  misuse of Mifare Classic cards in Czech or  Slovak republic  this presentation is supposed to be Mifare  Classic security analysis in Czech / Slovak  environment, not a manual that can be misused  for commiting crimes          www.nethemba.com       
  • 3. Contents  Background  Mifare Classic basics & security  Mifare Classic attacks in theory  Available hardware tools & software  implementations  Vulnerabilities in Slovak Mifare Classic cards  Our Mifare Classic Offline Cracker           www.nethemba.com       
  • 4. Mifare Classic technology  one of the most used RFID card (more than 1  billion smart card chips are used)  is based on ISO/IEC 14443 Type A, 1kB or 4kB  uses 13.56 Mhz contactless smartcard standard  uses a proprietary CRYPTO1 with 48 bits keys  had a lot of security problems in the past but  nobody cares :­)   it's cheap (about 1 €)        www.nethemba.com       
  • 5. Usage in Czech/Slovak republic  all University/ISIC/Euro26 cards  public transport ID (“električenka”) in Bratislava  Slovak Lines, Slovak railways cards  parking cards  for the current list see http://www.emtest.biz/sk/          www.nethemba.com       
  • 6. Mifare Classic structure          www.nethemba.com       
  • 7. Mifare Classic security  read­only Unique Identifier (UID)  mutual authentication between reader and  writer and encrypted communication  CRYPTO1 non­public algorithm implementation  obfuscated parity information  hardware implementation only          www.nethemba.com       
  • 8. Mifare Classic commands  authenticate  read, write, increment, decrement – always  sent in encrypted session  transfer – writes the result of decrement,  increment/restore to non­volatile memory  restore – prepares the current value of a block  for being rewritten to non­volatile memory          www.nethemba.com       
  • 9. Mifare Classic default keys  a lot of publicly used cards (even in Czech  Republic / Slovakia) use at least one block  encrypted with default keys: 0xffffffffffff  0xa0a1a2a3a4a5 0xb0b1b2b3b4b5  0x4d3a99c351dd 0x1a982c7e459a  000000000000 0xd3f7d3f7d3f7  0xaabbccddeeff          www.nethemba.com       
  • 10. Linear Feedback Shift Register  (LFSR)  pseudo random generation defined by the  polynomial x^16 + x^14 + x^13 + x^11 + 1  length is 32 bits, but it has only 16 bits entropy!  L16 = x0 XOR x11 XOR x13 XOR x14 XOR x16  Ar = suc2(Nt), At = suc3(Nt)  generated nonces can be predicted in the time          www.nethemba.com       
  • 11. CRYPTO1 Cipher initialization  No non­linear feedback          www.nethemba.com       
  • 12. Authentication process Step Sender Hex Abstract 01 Reader 26 req type A 02 Tag 04 00 Answer req 03 Reader 93 20 select 04 Tag c2 a8 2d f4 b3 uid, bcc 05 Reader 93 70 c2 a8 2d f4 b3 ba a3 select(uid) 06 Tag 08 b6 dd MIFARE 1k 07 Reader 60 30 76 4a auth(block 30) 08 Tag 42 97 c0 a4 Nt 09 Reader 7d db 9b 83 67 eb 5d 83 Nr XOR ks1,Ar XOR ks2 10 Tag 8b d4 10 08 At XOR ks3 Tag Reader picks Nt and sends to reader ks1 <- cipher(K, uid, Nt), picks Nr ks1 ← crypto1(K, uid, Nt) ks2, ks3 .... ← cipher(K, uid, Nt, Nr) and sends to tag Nr XOR ks1, suc2(Nt) XOR ks2 ks2, ks3.. ← cipher(K, uid, Nt, Nr)  sends to reader suc3(Nt) XOR ks3 Ar  = suc2(Nt)      www.nethemba.com       
  • 13. Authentication process with  timeout – how to recover ks2, ks3 Ghost Reader picks Nt and sends to reader ks1 <- cipher(K, uid, Nt), picks Nr ks2, ks3 .... ← cipher(K, uid, Nt, Nr) and sends to tag Nr XOR ks1, suc2(Nt) XOR ks2 Wait for timeout Reader sends to the tag halt XOR ks3          www.nethemba.com       
  • 14. “timeout” Attack in practice  computing offline LFSR state table (for 2^36  entries) LFSR state from 0 to 0xfffffffff and  adequate ks2 ks3, it takes 4­8 hours  computing online Nt table (for 2^12) entries  from 0 to 0xfff0 and adequate ks2 ks3 → there  is one Nt producing LFSR for a given ks2 ks3, it  takes 2­14 minutes  rolling back Nr, Nt XOR uid and the result key          www.nethemba.com       
  • 15. Nested Attack 1. Authenticate to the block with default key and  read tag's Nt (determined by LFSR) 2. Authenticate to the same block with default key  and read tag's Nt' (determined by LFSR) (this  authentication is in an encrypted session) 3. Compute “timing distance” (number of LFSR  shifts)  4. Guess the Nt value and authenticate to the    different block        www.nethemba.com       
  • 16. Other Mifare Classic mistakes  reader­side accepts invalid frame­lengths  the parity bit is encrypted, but the internal state  will not shift → the first bit of the next byte will  be encrypted by the same keystream bit  only 20 bits are used or keystream bit  statistical bias in the cipher  influence of bits is not balanced          www.nethemba.com       
  • 17. Cloning  when all keys are gained, every card can be  easily cloned  we can make 99.6% clone (except 0.block in  0.sector that contains read­only UID)  all blocks (including UID!) can be 100%  emulated by Proxmark3  protection against cloning – make whitelist of  allowed UIDs, or always use it in card content    encryption        www.nethemba.com       
  • 18. Restoring Credit  Anti­cloning protection does not work against  dumping the whole card ­ when you decide to  charge your card and restore the dump with  original credit (UID remains the same)  Countermeasure #1 – use safer cards (Mifare  Plus/DESFire or other)  Countermeasure #2 – use “decrement  counter” protection (it's only “workaround”)   Countermeasure #3 – use online checking        www.nethemba.com       
  • 19. Crapto1  open implementation of attacks against the  CRYPTO1 cipher  can be used for cracking Mifare Classic initial  authentication handshake  our “nested offline” card attack  is based on  crapto1 libraries          www.nethemba.com       
  • 20. Proxmark3  general­purpose RFID tool designed to snoop,  listen and emulate everything from LF (125kHz)  to HF (13.56Mhz) tags, universal hacking RFID  tool :­)          www.nethemba.com       
  • 21. Tikitag / Touchatag  very cheap (30 EUR), NFC­based RFID  reader/writer           www.nethemba.com       
  • 22. Slovak Mifare Classic vulnerabilities  all tested cards use the same keys (!!!) for the  first 1024 bytes (first 16 keys are the SAME!)  there is always at least one sector encrypted  with default key! (possibility of nested attacks)  the name of passenger/owner is always stored  in 0xd block – imagine what can happens with  strong antenna :­)   no protection against cloning or modification!   can be easily cloned and modified!!!        www.nethemba.com       
  • 23. Mifare Classic binary analysis  we have done binary difference analysis  between new bought card, after its activation  and charging credit  0xd block – passenger/user name  0x24 block ­ “električenka” expiration date  0x81 block – student's university number  0x82 block – student's name          www.nethemba.com       
  • 24. Attacker's costs  30 € – tikitag / touchatag RFID reader/writer  (sufficient for reading / cracking / writing /  cloning Mifare Classic cards)  $ 449 – Proxmark 3 (just for advanced RFID  playing :­)  1 € for blank 4kB Mifare Classic (can be bought  on ebay.com from Thaiwan/China :­)          www.nethemba.com       
  • 25. Solution ● use safer technology + strong cryptography,  bind user identity with card's read­only UID +  use UID in card content encryption ● partial workaround: bind user identity with  card's read­only UID, use UID in card content  encryption, use UID whitelists, use “decrement  counter” solution          www.nethemba.com       
  • 26. “Decrement­counter” workaround  replacing all Mifare Classic cards to safer ones  is very expensive and time­consuming – is it  possible to use insecure Mifare Classic layer  with “secure” implementation???  “decrement counter” (initially set to 0xffffffff),  keys A/B have permissions only for  decrementing counter and cannot be changed,  content of card (with passenger credit) is  encrypted/hashed with card UID, decrement    counter and private key       www.nethemba.com       
  • 27. Our Mifare Classic Offline Cracker  the first public disclosure of Mifare Offline  cracker based on “Nested Attack” already  published by Dutch researchers  we want to demonstrate that massively used  Mifare Classic cards can be easily cracked /  dumped  can be found here  https://www.nethemba.com/research/   use it, improve it and let us know the bugs        www.nethemba.com       
  • 28. Mifare Classic Key Recovery Tool  “Dark side” paper attack implementation by  Andrei C  recovers at least one key for a card that can be  used with our MFOC Nested Attack   http://code.google.com/p/tk­libnfc­crapto1/  wait for MFOC integration!          www.nethemba.com       
  • 29. What's next?  wait for our hitag analysis! (most of  Czech/Slovak “badge” cards are affected, and  yes – it's also used in Renault / Opel / Peugeot/  Citroen / … car keys :­)  playing with GSM, see & support  http://reflextor.com/trac/a51 project, all GSM  communication can be cracked!          www.nethemba.com       
  • 30. References  http://nickholdren.com/wp­content/uploads/2009/07  https://har2009.org/program/attachments/123_[HAR  http://www.cs.ru.nl/~flaviog/publications/Talk.Mifare  http://www.cs.ru.nl/~petervr/papers/grvw_2009_pick  http://code.google.com/p/crapto1/  http://www.touchatag.com/  http://proxmark3.com/          www.nethemba.com