Cov txheej txheem:

Siv Mifare Ultralight C Nrog RC522 ntawm Arduino: 3 Kauj Ruam
Siv Mifare Ultralight C Nrog RC522 ntawm Arduino: 3 Kauj Ruam

Video: Siv Mifare Ultralight C Nrog RC522 ntawm Arduino: 3 Kauj Ruam

Video: Siv Mifare Ultralight C Nrog RC522 ntawm Arduino: 3 Kauj Ruam
Video: FSE 2018 - Reconsidering the Security Bound of AES-GCM-SIV 2024, Kaum ib hlis
Anonim
Siv Mifare Ultralight C Nrog RC522 ntawm Arduino
Siv Mifare Ultralight C Nrog RC522 ntawm Arduino

Siv RFID thev naus laus zis txhawm rau txheeb xyuas tus neeg tuav daim npav lossis tso cai ua qee yam (qhib lub qhov rooj thiab lwm yam) yog qhov ncaj ncees. Nyob rau hauv rooj plaub ntawm DIY daim ntawv thov RC522 tus qauv tau siv dav vim nws pheej yig heev thiab muaj ntau txoj cai nyob rau qhov qauv no.

Feem ntau, UID ntawm daim npav tau siv los "txheeb xyuas" tus tuav daim npav, thiab Mifare Classic daim npav tau siv vim tias lawv pheej yig thiab feem ntau suav nrog thaum yuav khoom siv RC522.

Tab sis raws li koj yuav paub, Mifare Classic system tau raug hacked rau qee xyoo thiab nws tsis suav tias yog kev nyab xeeb ntxiv lawm. Cov txheej txheem encryption Crypto1 siv los ntawm Daim npav Classic tuaj yeem kov yeej thiab rov sau cov npav uas cov ntaub ntawv UID tuaj yeem rov ua dua tshiab (daim npav khawv koob).

Yog li rau ib qho kev nyab xeeb cuam tshuam txog kev thov siv Mifare Classic daim npav tsis pom zoo! Tib yam siv rau (feem ntau) NTAG thiab Mifare Ultralight systems

Yog li qhov kev xaiv yog ib qho los siv cov txheej txheem kev tshaj lij lossis sim siv cov txheej txheem RFID ruaj ntseg dua. Cov kab ke muaj yog Mifare Ultralight C, Mifare DESFire thiab Mifare Plus. Raws li muaj ntau txoj haujlwm tshaj lij siv cov txheej txheem no muaj kev nyab xeeb dua, rau DIY zej zog tsis muaj kev daws teeb meem zoo (muaj ib qho Teensy raws DESFire daws, uas yog nyob hauv qhov kim dua PN523 pawg tawm tsam). Ntxiv rau daim npav DESFire yog kim heev. Yog li qhov kev sib tw yog txhawm rau nrhiav txoj hauv kev zoo dua thiab pheej yig dua.

Qhov kev daws teeb meem nthuav tawm muab kev nkag tau mus rau qhov pheej yig Mifare Ultralight "C" phaib siv pheej yig Suav RC522 DIY module. Raws li txoj cai no, kev nyab xeeb Mifare Ultralight C tuaj yeem siv rau hauv DIY daim ntawv thov.

Kauj Ruam 1: Cov txheej txheem ua ntej

Cov kev cai
Cov kev cai

Txawm hais tias RC522 tau tsim qauv zoo, nws yog qhov feem ntau ua tsis zoo raws li qee qhov khoom siv tsis zoo. Qhov no ua rau lub koob npe tsis zoo ntawm tus qauv uas nws muaj kev nkag siab qis thiab tsis yog txhua hom npav yuav raug txheeb xyuas. Tshwj xeeb tshaj yog Mifare Ultralight C yuav tsis raug txheeb xyuas lossis tsis tuaj yeem nyeem daim npav.

Qhov teeb meem tseem ceeb yog qhov tshwj xeeb ntawm cov inductors L1 thiab L2. Raws li tau piav qhia ntawm https://ham.marsik.org/2017/07/4/using-cheap-rc522-nfc-reader-to-read.html. Tsuas yog los ntawm kev hloov cov inductors rau qhov tsim nyog xws li FERROCORE CW1008-2200 mam li nco dheev RC522 qhia tias nws lub peev xwm tiag tiag yog dab tsi.

Yog li ua ntej sim sim cov cai, koj YUAV TSUM hloov tus inductors. Nws tsuas yog yuav tsis ua haujlwm nrog cov inductors ua ntej teeb tsa!

Cov keeb kwm yav dhau los ntawm txhua qhov no yog, tias daim npav Ultralight C yog lub zog tshaib plab heev. Lub zog no yog muab los ntawm RC522 RF-teb. Vim tias qhov qis qis qis ntawm cov inductors, lub zog hluav taws xob tsuas yog tsis muaj zog txaus los ua lub zog Ultralight C. Lwm daim npav zoo li Mifare Classic tsuas xav tau lub zog tsawg dua thiab yog li ntawd ua haujlwm ruaj khov.

Kauj Ruam 2: Nws Ua Haujlwm Li Cas?

Nws Ua Haujlwm Li Cas?
Nws Ua Haujlwm Li Cas?
Nws Ua Haujlwm Li Cas?
Nws Ua Haujlwm Li Cas?
Nws Ua Haujlwm Li Cas?
Nws Ua Haujlwm Li Cas?
Nws Ua Haujlwm Li Cas?
Nws Ua Haujlwm Li Cas?

Yog li tom qab hloov kho RC522 tus qauv, koj tuaj yeem siv Mifare Ulralight C rau koj daim ntawv thov li cas?

Qhov ua kom yuam kev yog, tias Mifare Ultralight C txhawb nqa tus lej cim tseeb raws li 3DES cipher. Los ntawm kev siv tus password no, cov ntsiab lus ntawm daim npav tuaj yeem ua "nyeem nkaus xwb" lossis tsis pom kiag li rau tus neeg siv tsis tau tso cai.

Txhawm rau siv qhov kev tiv thaiv tus password no tus password yuav tsum tau sau rau hauv daim npav thiab nplooj ntawv yuav tsum tau tiv thaiv. Thaum ua tiav, koj tuaj yeem txheeb xyuas daim npav hauv koj daim ntawv thov los ntawm kev thov tus lej zais raws li kev lees paub lossis ntxiv cov ntaub ntawv npaj los ntawm thaj chaw tiv thaiv. Tsuas yog qhov no ua tiav koj paub tias koj tuaj yeem ntseeg qhov muab UID ntawm daim npav.

Ceev faj: yam tsis muaj tus lej cim raws li kev lees paub koj tseem tsis tuaj yeem ntseeg Mifare Ultralight C daim npav, vim tias muaj "daim npav khawv koob" ib yam uas sim ua Ultralight C.

Txhua daim npav ywj pheej los ntawm thev naus laus zis (yog tias raug qhov tseeb) yuav teb nrog lawv cov UID thaum siv los ntawm RF-teb thiab thov kom qhia lawv tus kheej. Tsis tas li ntawd lawv muab tus nqi SAK muab cov ntaub ntawv tsawg kawg nkaus txog ntawm daim npav tam sim no. Hmoov tsis zoo txhua Mifare Ultralight thiab NTAG txheeb xyuas raws li syme type (SAK = 0x00), suav nrog Mifare Ultralight C..

Kom paub tseeb tias nws yog Ultralight C thov rau encrypted authentication tuaj yeem xa mus rau daim npav. Yog tias Qhov no Tsis Yog Ultralight C card, qhov kev thov no yuav tsis nkag siab, thiab cov lus teb yuav yog NAK (tsis-acknolege).

Yog tias qhov no yog daim npav Ulralight C, koj yuav tau txais 8 lo lus teb. Cov 8 Bytes no yog tus lej "B" (RndB) encrypted los ntawm tus yuam sij khaws cia ntawm daim npav siv 3DES cipher.

Qhov encrypted RndB no yuav tsum tau txiav txim siab siv tus lej tseem ceeb hauv qhov haujlwm. Tus lej no raug hloov pauv me ntsis (tig los ntawm ib byte -byte 1 yuav raug hloov mus rau byte 8 thiab txhua lwm bytes raug thawb ib byte qis dua, tom qab ntawd hu ua RndB '). Txoj haujlwm ntawd tsim tawm 8 Byte tus lej random "A" nws tus kheej (RndA) thiab txuas RndA no rau RndB hloov kho. Qhov no tau rov nkag dua siv tus yuam sij thiab xa mus rau daim npav.

Daim npav decrypts cov lus thiab tshawb xyuas yog tias RndB 'haum rau RndB uas tau tsim yav dhau los ntawm daim npav. Yog tias lawv sib phim, daim npav tam sim no paub, tias txoj haujlwm paub qhov tseem ceeb.

Txog tam sim no, txoj haujlwm tseem tsis tau paub tias daim npav paub tus yuam sij thiab yog li ntawd tuaj yeem ntseeg tau lossis tsis ntseeg. Txhawm rau ua tiav qhov no, daim npav tam sim no tig lub decrypted RndA los ntawm ib byte, tom qab ntawd encrypts cov bytes siv tus yuam sij thiab xa rov qab.

Qhov kev zov me nyuam yuav rov txiav txim qhov kev teb ntawm daim npav thiab txheeb xyuas yog tias qhov qub RndA thiab cov lus teb RndA phim. Tsuas yog tom qab ob lub koom haum (program thiab daim npav) paub tias lawv qhia kev paub txog tus yuam sij tib yam.

Cov txheej txheem no tsuas yog siv los txheeb xyuas qhov tseeb. Txhua qhov kev sib txuas lus txuas ntxiv yog ib txwm nyob hauv "cov ntawv tseeb".

Txawm hais tias muaj daim npav "khawv koob Ultralight C" qhov twg UID tuaj yeem hloov kho, tus yuam sij nws tus kheej tsis tuaj yeem tau txais los ntawm daim npav thiab 3DES cipher muaj kev nyab xeeb. Tus yuam sij yog tus lej 16 Byte, yog li kev siv lub zog kom tau txais tus yuam sij yuav siv sijhawm me ntsis.

Raws li tau hais, kev sib txuas lus ua ntej kev txheeb xyuas qhov tseeb thiab tom qab kev txheeb xyuas qhov tseeb ib txwm nyob hauv cov ntawv meej (aka tsis encrypted). Thaum sau tus yuam sij tshiab rau daim npav, cov ntsiab lus ntawm tus yuam sij tuaj yeem nqus tau los ntawm kev siv cov cuab yeej raug. Yog li thov sau tus yuam sij tsuas yog nyob hauv ib puag ncig muaj kev nyab xeeb thiab khaws tus yuam sij zais cia.

Thaum siv daim npav Ultralight C

Daim npav Ultralight C muaj ntau yam kev nyab xeeb tsim hauv:

  1. Ib Lub Sijhawm Ua Haujlwm (OTP) nco. Hauv cheeb tsam no cov khoom tuaj yeem sau, tsheb npav tsis raug tshem tawm.
  2. 16 ntsis ib txoj hauv kev suav. Lub txee no tsuas tuaj yeem nce ntxiv, thaum tau txais.
  3. Ib qho "sau" lossis "nyeem/sau" tiv thaiv cov nplooj ntawv hauv lub cim xeeb. Tsuas yog tias tau lees paub nrog tus yuam sij, cov nplooj ntawv no tuaj yeem nyeem lossis hloov kho.
  4. Kev khov / thaiv cov nplooj ntawv ib leeg kom tiv thaiv kev hloov pauv.

Tsis yog siv OTP, 16 ntsis txee lossis tsis siv qhov thaiv me ntsis tau ua tiav hauv cov cai muab, tab sis tuaj yeem siv tau yooj yim raws li cov ntaub ntawv muab hauv https://www.nxp.com/docs/en/data- ntawv/MF0ICU2.pd…

Raws li kev tiv thaiv los ntawm qhov tseem ceeb yog qhov tseem ceeb rau kev siv Mifare Ultralight C, txhua txoj haujlwm muaj feem cuam tshuam tam sim no.

Txhua cov lus txib tau siv hauv Serial monitor nrog "kab tshiab nkaus xwb" thiab nrog 115200 Baud

  • "Auth 49454D4B41455242214E4143554F5946" yuav thov kom lees paub qhov tseeb nrog tus yuam sij muab (hauv qhov no tus qauv Mifare Ultralight C qhov tseem ceeb)
  • "Dump" yuav pov cov ntsiab lus ntawm daim npav kom deb li deb tau pom. Hauv cov nplooj ntawv raug tiv thaiv los ntawm tus yuam sij, cov nplooj ntawv no yuav tsis pom txog thaum qhov kev lees paub yav dhau los nrog tus yuam sij. Hauv thawj ob kab ntawv nws tau qhia yog tias nplooj ntawv raug kaw lossis nkag mus tau txwv.
  • "TshiabKey 49454D4B41455242214E4143554F5946" yuav sau tus yuam sij tshiab rau daim npav. Tus yuam sij tau sau rau nplooj ntawv 44 txog 47. Qhov no tsuas yog ua haujlwm, yog tias cov nplooj ntawv no tsis raug kaw lossis tsis muaj kev tiv thaiv yam tsis muaj kev lees paub yav dhau los.
  • "wchar 10 nyob zoo ntiaj teb" yuav sau "nyob zoo ntiaj teb" pib los ntawm nplooj 10. Ib zaug ntxiv, qhov no tsuas yog ua haujlwm ntawm nplooj ntawv tsis raug kaw lossis tiv thaiv yam tsis muaj kev lees paub yav dhau los. yuam kev lossis cov ntaub ntawv raug tsis quav ntsej vim nplooj ntawv no tsis yog neeg siv nco.
  • "Whex 045ACBF44688" yuav sau Hex qhov tseem ceeb ncaj qha rau lub cim xeeb, cov xwm txheej dhau los siv.
  • "Tiv thaiv 30" tiv thaiv txhua nplooj ntawv los ntawm nplooj 30 nce mus. Nyob ntawm qhov kev tso cai, cov nplooj ntawv no tsuas tuaj yeem hloov kho lossis nyeem tom qab kev lees paub ua ntej nrog tus yuam sij. Kev siv "tiv thaiv" nrog cov txiaj ntsig siab dua 47 yuav teeb tsa txhua nplooj ntawv rau "tsis muaj kev tiv thaiv" suav nrog KEY ntawm nplooj ntawv 44-47 (uas tsuas yog tuaj yeem hloov kho tab sis tsis nyeem). Txhawm rau tiv thaiv kev hloov tus yuam sij, kev tiv thaiv yuav tsum tsawg kawg pib ntawm nplooj 44.
  • "Setpbit 0" teeb tsa kev tiv thaiv me ntsis thiab txiav txim siab yog tias nplooj ntawv tiv thaiv tau nyeem nkaus xwb ("setpbit 1") lossis tsis tuaj yeem nyeem tsis tau sau ("setpbit 0") yam tsis muaj kev lees paub yav dhau los nrog tus yuam sij.

Tsis yog txhua cov lus txib tuaj yeem siv tam sim tom qab kuaj pom daim npav. Ib qho "pov tseg" yav dhau los rau lwm cov lus txib ib txwm pab.

Kauj ruam 3: Tseem ceeb

  1. Qhov kev zov me nyuam sib txawv ntawm hom Ultralight los ntawm kev nyeem nplooj 43 thiab 44. Yog tias nplooj ntawv 43 nyeem tau thiab nplooj 44 tsis yog, feem ntau yuav yog Ultralight C. TAB SIS, yog tias koj nyeem/sau tiv thaiv nplooj 43 daim npav tsis tau lees paub dua li Ultralight C (tsis muaj kev cuam tshuam dab tsi) Kev txheeb xyuas qhov tseeb ntawm Ultralight yuav tsum ua tiav los ntawm kev txheeb xyuas qhov tseeb nrog tus yuam sij (Kuv tsis tau siv qhov ntawd vim yog qhov laj thawj ruaj khov).
  2. Ua ntej siv cov lus txib "setpbit" thiab "tiv thaiv" cov lus txib "pov tseg" yuav tsum siv, txwv tsis pub tiv thaiv xwm txheej ntawm nplooj ntawv yuav tsis paub.
  3. Yog tias koj "nyeem/sau" tiv thaiv thawj nplooj ntawv ntawm koj daim npav, nws yuav tsis ua haujlwm ntxiv nrog txoj haujlwm no vim thawj nplooj ntawv tau nyeem tas li kom pom tias tseem muaj daim npav nyob tam sim no. Raws li thawj ob nplooj ntawv tsuas yog nyeem nkaus xwb (UID tau khaws cia rau ntawd), tsis muaj kev nkag siab los tiv thaiv lawv.

Teeb meem kev ruaj ntseg

Txoj cai no siv "tus qauv" RC522 lub tsev qiv ntawv rau Arduino thiab lub tsev qiv ntawv 3DES los ntawm https://github.com/Octoate/ArduinoDES. Whereas RC522 lub tsev qiv ntawv tau siv ntau heev, 3DES lub tsev qiv ntawv zoo li tsis nthuav dav thiab yuav tsum tau teeb tsa tus kheej.

Txoj cai tau raug sim ntawm Arduino Uno. Tab sis thaum sau nws, Kuv tau ntsib ntau yam teeb meem txawv txawv hais txog kev ruaj ntseg. Txawm li cas los xij kuv cov txuj ci txuj ci tsis zoo, ib qho ntawm cov tsev qiv ntawv siv tsis ruaj khov lossis sib xyaw cov tsev qiv ntawv tsis yog lub tswv yim zoo.

Thov nco ntsoov qhov no thaum siv cov cai !!!

Hloov nws lossis siv tsuas yog ib feem ntawm nws tuaj yeem ua rau coj tus cwj pwm coj txawv txawv xws li tsoo, luam tawm yam khoom txawv lossis tau sijhawm tas sijhawm lossis NAK thaum nyeem los ntawm daim npav. Qhov no tuaj yeem tshwm sim ntawm txhua qhov chaw hauv txoj cai (nws raug nqi kuv ntau teev ntawm kev debugging). Yog tias koj pom qhov laj thawj rau qhov no, thov muab lus qhia rau kuv.

Pom zoo: