防护思路
点击放大


<h1 align="center">PhantomTap</h1>
<p align="center">
<b>A Flipper Zero that stops guessing and starts reasoning.</b><br>
ML-guided RFID/NFC fuzzing & access-control auditing — turning raw card reads
into a prioritized, explainable security assessment.
</p>
<p align="center">
<a href=" alt="CI" src="
<img alt="python" src="
<img alt="license" src="
<img alt="tests" src="
<img alt="defensive" src="
</p>
<p align="center">
<code>rfid</code> · <code>nfc</code> · <code>flipper-zero</code> ·
<code>access-control</code> · <code>security-audit</code> ·
<code>wiegand</code> · <code>mifare</code> · <code>acti</code> ·
<code>bayesian</code> · <code>purple-team</code> ·
<code>threat-detection</code> · <code>counter-sur</code> · <code>skimmer-detection</code> ·
<code>attack-graph</code> · <code>osint</code> · <code>privacy</code> ·
<code>osdp</code> ·
<code>physical-security</code> ·
<code>pentesting</code>
</p>
---
> Defensi tool. The deli is an audit report a physical-security
> assessor or building owner uses to *find and fix* weak badge systems — not a
> device for unauthorized entry. All experiments use synthetic credential
> populations or the author's own cards/readers. See
> docs/threat_model.md.
The Flipper Zero is a brilliant manual multi-tool for RFID/NFC — but it's
fundamentally *dumb*: it replays, dumps, and brute-forces with fixed
dictionaries, leaving all the reasoning to the human. Meanwhile real
access-control ecosystems have structure: credential formats, facility
codes, numbering schemes, weak default keys.
PhantomTap bolts a brain onto the Flipper. A host-side layer:
1. learns the structure of the credentials it sees (format, facility code,
numbering scheme) from just a handful of reads;
2. generates the next-best test credential with an acti policy
instead of blind brute force; and
3. produces a scored, explainable audit report ranking how weak a
deployment is, and why, with concrete remediation.
1. Characterization efficiency. Across the full format × numbering sweep, ML
guidance characterizes 90% of an issued population with a **median ~16,000×
fewer reader queries than brute force (max 180,498×**). The one configuration
where it gives *no* ad — a facility-less H10302 format with
randomized numbering (1×) — is exactly the hardened design defenders should
aim for, and the benchmark reports it plainly rather than hiding it.
<p align="center">
<img src="docs/figures/attempts_to_characterize.png" width="720"
alt="Attempts-to-characterize: ML guidance ">
</p>
2. Bayesian population sizing. An acti boundary search estimates
*how many* credentials a facility has issued — and over what range — in
O(log N) reader queries instead of the O(N) an exhaustive scan needs. A
sequential population of 6,400 cards is sized from ~300 queries to within a
few percent. Randomized numbering defeats it (large error) — again, a *positive*
security signal, surfaced rather than buried.
<p align="center">
<img src="docs/figures/population_estimation.png" width="820"
alt="Bayesian population sizing: O(log N) query cost, and accuracy by numbering scheme">
</p>
PhantomTap doesn't just *model* the attack — it detects it. A blue-team
monitor runs four detectors over a stream of badge-reader events:
| Detector | Signature it catches |
|----------|----------------------|
| impossible travel | one credential at two readers faster than a human could walk → cloned/replayed card |
| enumeration | a burst of distinct/rejected creds or a consecuti sweep → someone scanning the reader |
| off-hours | an accepted access outside declared business hours |
| rogue credential | a format-valid card outside the issued range → forged or guessed number |
The reflexi: PhantomTap's **own ML auditor is caught by its own
detector** after ~16–33 presentations — and because guided search walks
consecuti, it's flagged *at any pace*, while unstructured probing can
only hide by going so slow it's useless.
<p align="center">
<img src="docs/figures/purple_team.png" width="820"
alt="Detection co and detection-latency rate">
</p>
Every audit reports an information-theoretic score: how many bits of guessing
an ad faces to forge a valid credential — *before* and *after* reasoning
about structure. The gap is what the deployment leaks. Sequential numbering
can collapse an informed attacker's work to near zero bits (every number in
the discovered range is valid); randomized numbering preserves it.
<p align="center">
<img src="docs/figures/guessability.png" width="640"
alt="Effecti leakage, in bits, by numbering scheme">
</p>
An audit that only assigns a number leaves the owner asking "so what do I do
*first*?" PhantomTap answers it. For every candidate hardening step it builds a
counterfactual deployment with that one knob changed, re-scores it, and ranks the
fixes by risk reduction per fix — then greedily compounds them into a
sequenced roadmap. Every audit report ends with this table:
| Step | Fix | Risk after | Δ |
|-----:|-----|-----------:|---:|
| 1 | Randomize card numbering | 58 | −24 |
| 2 | Upgrade credential format | 39 | −19 |
| 3 | Rotate off default keys | 27 | −12 |
| 4 | Di keys per card | 20 | −7 |
<p align="center">
<img src="docs/figures/remediation.png" width="52%"
alt="Remediation waterfall: risk reduction per fix">
<img src="docs/figures/risk_factors.png" width="46%"
alt="Weighted risk-factor contributions, weak deployment">
</p>
Real estates run *many* facility codes — one per building or department. An
attacker walks in through the softest door, so PhantomTap rolls per-facility
audits up into a weakest-link fleet score (the worst building weighted 70%).
The bundled case study audits a four-building
campus end-to-end: an old lobby on 26-bit prox drags a datacenter-grade estate
down to HIGH.
<p align="center">
<img src="docs/figures/fleet.png" width="720"
alt="Fleet audit: per-building risk with the weakest-link roll-up">
</p>
Per-door scores miss the real risk: an intruder chains the *weakest sequence* of
doors from the street to a high-value asset. PhantomTap models the estate as a
graph (zones = nodes, doors = edges weighted by each reader's audit risk) and
runs Dijkstra to find the cheapest breach path — then asks the question no
per-door score can: *hardening which single door raises that path cost the most?*
The answer is frequently not the estate's weakest door, and the datacenter's
own strong reader is useless if the intruder walks in through a 26-bit lobby.
<p align="center">
<img src="docs/figures/attack_path.png" width="760"
alt="Attack-path graph: cheapest breach route to the datacenter and the harden-first door">
</p>
Inspired by the Specter
project (a *passi Zero bug-sweep that listens for the RF carrier a
powered-on reader emits), PhantomTap adds the analysis half. A reader's carrier
has a timing fingerprint — polling period, burst width, duty cycle, and the
tell-tale jitter of a cheap clone a real terminal. PhantomTap
classifies each sensed emitter against a profile library and flags covert
devices — a skimmer taped inside an ATM, a rogue logger under a desk — answering
Specter's four questions: *what is it, where is it (proximity), is the room
clean, did one show up while I was away (watch mode)*. All on a synthetic RF
en; nothing transmits.
<p align="center">
<img src="docs/figures/rogue_reader.png" width="820"
alt="Rogue-reader detection: emitters separate by timing fingerprint; a room sweep flags the rogues">
</p>
Every audit can export SARIF 2.1.0 — the OASIS standard GitHub code scanning
and security dashboards ingest — so badge-system risk is tracked and triaged
right beside software .
phantomtap assess runs the *entire* pipeline — inference-dri,
efficiency e, information-theoretic leakage, the org-timeline leak, and
the prioritized remediation roadmap — and renders it as a **self-contained,
styled HTML report** (no external assets, no Ja): the artifact a
physical-security engagement actually hands over — a risk gauge, metric cards, a
colour-coded findings table with inline fixes, and the remediation roadmap.
Download and open the rendered example:examples/sample_assessment.html
(machine-readable twin: sample_assessment.json).
Sequential card numbers leak more than a headcount: because badges are issued in
hire order, the number is a proxy for seniority. Tie just two card
numbers to real dates (a LinkedIn "joined March 2022", a printed issue date) and
a linear fit dates every other badge in the building — reconstructing the
org's growth curve and hiring spikes.
<p align="center">
<img src="docs/figures/timeline_leakage.png" width="820"
alt="Date any badge from two anchors, and the reconstructed hiring timeline">
</p>
Every other check reasons about the credential; this one audits the
reader→controller link — a distinct, often-o attack surface. Legacy
Wiegand sends the credential over two wires (D0/D1) in the clear, with no
encryption, auth, or line super: an inline implant (the real, open-source
ESPKey) logs and replays every badge, defeating even a strong smart card
because the attack is *downstream* of it. OSDP Secure Channel (SIA / IEC
60839-11-5, AES-128, mutually authenticated, supervised) closes it. PhantomTap
scores each protocol and names the migration as the highest-le wire-layer
fix.
<p align="center">
<img src="docs/figures/wire_protocol.png" width="820"
alt="Reader-to-controller wire-protocol risk and security-property matrix">
</p>
Every classifier and detector is scored with standard metrics (precision/recall/
F1, ROC-AUC, PR-AUC, MCC, confusion matrices, and Spearman ranking quality) over
seeded synthetic trials. Full report: docs/e.md.
| Subsystem | Key metrics |
|-----------|-------------|
| Rogue-reader detection | F1 0.998, ROC-AUC 1.00, PR-AUC 1.00, MCC 0.997 |
| Anomaly monitor | mean per-attack recall 1.00, clean-stream false-alarm rate 0.00 |
| Format inference | parity-consistent recall 1.00, top-1 0.73, numbering-class 0.68 |
| Bayesian sizing | sequential MAPE 0.03, randomized-resistance recall 1.00 |
| Risk score | weak- AUC 1.00, Spearman ρ 1.00 |
> The e also *drives* fixes: it caught a 48% false-alarm rate from
> unrealistic "teleporting" traffic in the stream generator, now 0% after
> modelling continuous employee mo.
<p align="center">
<img src="docs/figures/e.png" width="820"
alt="E dashboard: ROC of rogue-reader detection and format-inference confusion matrix">
</p>
Full write-up: docs/architecture.md.
The entire Tier-1 pipeline runs on the Python standard library alone — no
hardware, no hea. Figures and tests add matplotlib, numpy,
and pytest:
See the full rendered example: examples/sample_audit_report.md.
| # | Se | Factor | Finding |
|---|----------|--------|---------|
| 1 | 🟥 CRITICAL | numbering | Card numbers issued strictly sequentially |
| 2 | 🟥 CRITICAL | keys | Sectors still carry publicly documented default keys |
| 3 | 🟧 HIGH | format | H10301-26 (26-bit): tiny 8-bit facility space |
| … | … | … | … |
Median over 8 seeds · 8 obser · 400 issued credentials per deployment.
Full table + JSON: docs/benchmark_results.md.
| Format | Numbering | Brute force | Dictionary | ML (PhantomTap) | Speedup | Fmt acc | Num acc |
|--------|-----------|------------:|-----------:|--------------------:|--------:|:------:|:------:|
| H10301-26 | sequential | 7,977,297 | 9,943,377 | 353 | 22,599× | 1.00 | 1.00 |
| H10301-26 | clustered | 8,011,137 | 9,977,217 | 357 | 22,440× | 1.00 | 0.12 |
| H10301-26 | random | 8,022,236 | 9,988,316 | 59,151 | 136× | 1.00 | 1.00 |
| H10306-34 | sequential | 7,977,297 | 9,943,377 | 353 | 22,599× | 1.00 | 1.00 |
| N10002-34 | sequential | 7,977,297 | 9,943,377 | 353 | 22,599× | 1.00 | 1.00 |
| H10304-37 | sequential | 63,715,665 | 79,444,305 | 353 | 180,498× | 1.00 | 1.00 |
| H10304-37 | random | 64,178,091 | 79,906,731 | 474,255 | 135× | 1.00 | 1.00 |
| H10302-37 | sequential | 19,768 | 19,768 | 353 | 56× | 1.00 | 1.00 |
| H10302-37 | random | 944,700 | 944,700 | 943,833 | 1× | 1.00 | 0.00 |
Median ML speedup across all 20 configs: 16,067× (min 1×, max 180,498×).
(H10306-34 and N10002-34 produce identical rows — they're structural aliases,
a nice consistency check on the Proxmark-aligned encoder.)
How the win works. ML makes two moves the baselines can't: it (1) *locks the
facility code* inferred from the reads (di the space by the whole
facility range), and (2) *region-grows* over card numbers from the observed
cluster, walking a sequential/clustered population directly instead of scanning
empty low-numbered space. Even on random numbering — where region-growing
gives no signal — locking the facility code alone yields a ~135× win.
Where it *doesn't* win — and why that matters. The facility-less H10302
format has no facility code to lock, so brute force is already cheap and ML's
edge shrinks (56× on sequential). Combine it with randomized numbering and
guided search collapses to 1× — no better than brute force. That row is the
whole thesis in miniature: PhantomTap's ad *is* the deployment's
structural weakness, so "PhantomTap can't help an attacker here" reads directly
as "this design is hard to audit — good." The benchmark surfaces it, unedited.
<p align="center">
<img src="docs/figures/inference_vs_n.png" width="49%"
alt="Inference accuracy of obser">
<img src="docs/figures/risk_.png" width="49%"
alt="Risk score configuration">
</p>
<p align="center">
<img src="docs/figures/learning_curve.png" width="60%"
alt="Acti discovery curve">
</p>
Num acc ≈ 0.12 for clustered); both collapse into a "predictable" class.Field offsets and parity ranges are **aligned to the Proxmark3 reference
implementation** (wiegand_formats.c), so PhantomTap's encoder is bit-compatible
with real tooling for every format below.
| Format | Bits | Facility | Card | Known weakness |
|--------|-----:|---------:|-----:|----------------|
| H10301-26 | 26 | 8-bit (0–255) | 16-bit | Tiny facility space; trivial to guess/collide |
| H10306-34 | 34 | 16-bit | 16-bit | 16-bit card space stays enumerable (alias of N10002) |
| N10002-34 | 34 | 16-bit | 16-bit | Structurally identical to H10306-34 |
| H10304-37 | 37 | 16-bit | 19-bit | Resists enumeration, but sequential numbering is fully predictable |
| H10302-37 | 37 | none | 35-bit | No facility field to divide the space by → markedly *more* enumerable |
Card families audited — EM4100/HID Prox (125 kHz, UID-only, *no*
authentication, tri cloned), MIFARE Classic (Crypto-1, academically
broken), and the hardened DESFire EV2/EV3 target — are catalogued with the
primary security literature indata/reference/card_families_and_context.md.
All references are real, public, and cited: HID + Proxmark3 format specs, the
community MIFARE key dictionary, and the Crypto-1/MIFARE cryptanalysis papers.wiegand_formats.md
· default_keys.md
· mifare_default_keys.dic
· card_families_and_context.md
Fi synthetic datasets ship indata/synthetic/ — a classic weak 26-bit deployment, a
hardened 37-bit one, an H10306 departmental-block layout, a clonable UID-only
prox set, and a 240-credential multi-building campus spanning three facility
codes. Regenerate them any time with make samples (all frames produced by the
Proxmark-aligned encoder; no real facility data).
phantomtap/bridge.py.PhantomTap is for authorized, defensive assessment and research. Testing any
system you do not own requires prior written authorization from its owner. The
repo ships no real facility credentials, no site-specific keys, and no
"clone-a-stranger's-badge" workflow. Read docs/threat_model.md
before using the hardware path.
If you use PhantomTap, please cite it — see CITATION.cff.
Krishita Sanjay Choksi — sole author and contributor.
Portions of the scaffolding and documentation were drafted with AI assistance
and re by the author. The design, framing, and all experimental results
are the author's own.
MIT, with a responsible-use notice.
开发语言:Python
Star 数:24
该项目属于防护思路方向的开源资源,代码结构清晰,适合安全研究人员学习参考。项目围绕A Flipper Zero that stops guessing and starts reasoning: ML-guided RFID/NFC fuzzing & access-control auditing that turns raw card reads into a prioritized, explainable security assessment. Defensive-use only.展开,提供了可运行的实现,对理解相关安全机制、工具原理与攻防技术具有较高的研究价值。
从技术实现角度看,此类项目的核心在于对底层原理的深入理解与工程化落地。开发者在研究过程中可以结合官方文档与社区讨论,梳理项目的初始化流程、核心模块职责与数据流转,逐步掌握其中的技术细节与设计思路。
1. 下载源码压缩包,解压到本地环境。
2. 根据项目类型准备对应的运行环境与依赖。
3. 按照 README 中的步骤完成配置与部署。
4. 在隔离的测试环境中运行验证,避免影响生产系统。
本资源来源于开源社区,仅供安全研究、技术学习与合法授权范围内的攻防演练使用,请勿用于任何非法或侵害他人权益的用途。使用本项目产生的一切后果由使用者自行承担。
| 资源标题 | PhantomTap - A Flipper Zero that stops guessing and starts reas |
| 所属分类 | 防护思路 |
| 发布作者 | admin |
| 发布时间 | 2026-10-06 00:10:13 |
| 下载权限 | 免费下载 |
| 附件数量 | 2 个下载链接 |
| 浏览次数 | 106 |
| 讨论数量 | 0 |
| 主题状态 | 正常讨论中 |