← sources

Claude Code found a root backdoor on my cheap Android TV stick, then ported mainline Linux to it over USB, with Sonnet building and Opus auditing every step before anything touched the hardware

source: reddit (reddit:ClaudeCode)published 2026-10-30 22:49ingested 2026-10-31 02:39

retained text

I bought a no-name "DQ10" Android TV stick (Allwinner H618) and asked Claude Code to "reflash it with clean firmware and make it safe". About two days later:

* the stick runs mainline U-Boot + Armbian (kernel 6.18.53) from its own eMMC;
* the factory Android is completely wiped, and it turned out to have malware;
* Wi-Fi works and SSH is key-only.

I didn't solder anything and had no serial console. I was the hands: plugging cables, holding a button, reading the TV. Claude did the rest.

Repo (scripts, device tree, flasher, the full runbook, the audits, malware IOCs): [https://github.com/itsmeorestis/dq10-h616-linux](https://github.com/itsmeorestis/dq10-h616-linux)

# The setup

* Claude Code CLI on Windows, with Git Bash, a Kali WSL2 distro and usbipd-win to pass the stick's USB into WSL.
* One rule I gave it at the start: "write code with Sonnet and do an audit with Opus."
   * The main session (Opus) planned and talked to me, and ran every command against the hardware itself.
   * It spawned a Sonnet subagent as the builder: U-Boot/TF-A configs, the device tree, the image, scripts and tests.
   * Then a separate Opus subagent as the auditor, which only reads and writes a report.
   * Nothing was written to the stick until an audit passed and I said "go".
* My [CLAUDE.md](http://CLAUDE.md) has it log everything into my Obsidian vault, so there's a full trail of decisions, evidence and dead ends.

# What it found first

* The stick claimed Android 13 but was really a userdebug Android 12 with unauthenticated root ADB.
* Claude got in by opening the hidden Developer options through Activity Launcher, which put root adbd on TCP 5555.
* Then it put the stick behind an egress-blocking iptables chain on my laptop hotspot and took a full eMMC backup.
* In the backup it found:
   * a vendor remote-command system;
   * root drop scripts written on the stick's first day online;
   * an 11 MB UPX-packed Go binary with NPS reverse-tunnel code, started as root.

That settled it: don't clean Android, replace everything. The IOCs are in the repo, with hosts defanged and no samples.

# What the audit loop caught

This is the part I'd point other Claude Code users to. Four Opus audits, each on a fresh context, each with a verdict:

* Round 1 (GO-WITH-FIXES):
   * The runbook said "if ADB drops during the commit, power-cycle", which would have bricked it mid-write.
   * The U-Boot device tree borrowed from a similar board disabled the SD slot.
   * Post-flash hash checks expected values that a filesystem resize would change.
* Round 2 (NO-GO for the write):
   * The hardware tests showed U-Boot only worked 1 time in 6 when started over USB (FEL).
   * The auditor refused to sign off on flashing a bootloader that might hang with no way back.
   * It proposed zero-write diagnostics instead.
* Round 3:
   * usbipd bind without --force lets Windows' storage driver keep the disk. That had already let Windows rewrite the partition-table header once.
   * A "U-Boot reached its boot command" test could pass falsely after a crash.
* Pre-publication audit:
   * A build script would have happily baked a private key into a shareable image.
   * The README let a first-time user wipe without a verified backup.

# Debugging with no serial console

Without a UART, Claude used the LED and the reset timing as its debugger:

* it wrote tiny U-Boot environment overrides that blink the LED in patterns, then reset;
* with the button held, the reset lands back in FEL;
* so "back in FEL 16 seconds later" meant U-Boot reached its boot command, and a triple blink meant ums failed to start.

It also:

* found the LED was wired active-low by poking GPIO registers directly over FEL;
* worked out from register reads that the button goes straight to the Boot ROM, so there's always a way back.

When U-Boot's USB mass storage refused to start from a cold boot, it dropped that approach. It booted a small Linux into RAM over FEL instead, and that worked first try: HDMI console, Wi-Fi scan, then a configfs USB gadget exposing the eMMC to the PC. That became the flasher.

# Usage limits, honestly

* I hit the 5-hour limit and once the weekly limit mid-project. Subagents died mid-task.
* What worked:
   * resuming the same agent with a message instead of starting a new one, since its context was kept;
   * for the actual 50-minute eMMC write, Claude ran the flash script detached inside WSL (setsid nohup), with a keep-alive and a keep-awake. The write didn't depend on the session surviving. It also gave me two commands to check the result myself.
* The write finished ALL VERIFIED. Afterwards the Boot ROM, read over USB, was byte-identical to the published Allwinner normal ROM: genuine silicon, secure boot off.

# What went wrong or needed me

* A few guesses were wrong and got corrected by data. For example, it first blamed the usbipd binding for the U-Boot failure; unbinding changed nothing, and the real cause was elsewhere. An auditor also guessed Windows had written to a vendor partition, and the hash compare proved it hadn't.
* Shell quoting across Git Bash → wsl.exe → sh broke several commands. It switched to writing small script files, which fixed it.
* I had to be precise about physical steps ("hold the button after the second blink"), and one test "failed" only because I didn't press it.
* Before publishing, it scrubbed the repo of every unique ID (SoC ID, eMMC serial, MAC, my SSH key, my network names). Then a separate audit checked the tree and the full git history. These photos have my IP addresses blacked out and no metadata.

# Takeaways

* Builder/auditor split with fresh contexts caught real brick-level mistakes that the builder was confident about.
* Gates and explicit "go" before irreversible steps, and read-only sessions first.
* Make long, irreversible jobs independent of the session.
* Log everything to files. When context gets compacted, the notes and reports carry the state.

Happy to answer questions about the workflow or the hardware.

document fetched 2026-10-31 00:42 · canonical https://reddit.com/r/ClaudeCode/comments/1xjtuwx/claude_code_found_a_root_backdoor_on_my_cheap