Murat BekgiPenetration tester
Subscribe
Write-ups

Week 39: A Flock camera's key was stored next to its data. Check where your devices keep theirs

Hackers pulled a Flock camera off a pole and found the key that unlocked 1.6M images in an unencrypted partition. How to check your own devices and apps.

Published
Reading time
3 min
Topic
Weekly

September 16 to 22. Flock Safety’s license-plate cameras are everywhere now, and the company has described them as protected by on-device encryption. This week we got to see what that meant in practice.

What happened

A hacker group pulled a Flock camera down from above a roadway, copied almost all of its storage, and shared the files with 404 Media and the nonprofit Distributed Denial of Secrets, which passed them to WIRED. The two outlets published a joint analysis on September 16 (404 Media, WIRED, The Next Web).

The camera runs Android. Several partitions were unencrypted, including ones named vendor and media. Inside the unencrypted media partition sat an encryption key that opened the data that was encrypted (Jalopnik). Behind it: about 1.6 million images of roughly 50,000 vehicles from 21 days, plus 27,000 clips. The software on the device detects people and bicycles as well as cars and plates (TechRepublic, Slashdot summary of the joint report). The outlets found no face recognition running on the camera itself.

Flock’s central servers weren’t breached. This was one device, taken off a pole. That’s exactly the point, though. Encryption with the key sitting next to the data protects against nobody who holds the hardware. Edge devices get stolen, resold and pulled apart. Laptops, kiosks, point-of-sale terminals, routers and your own app on someone’s phone all count.

This is not a guide to opening up Flock cameras. Pulling one off a pole is a crime. It’s a guide to checking the devices and apps you’re responsible for, so a stolen one is worth nothing.

Walkthrough: find out where your keys live

1. Linux boxes: what’s encrypted at all? On any edge device or server you own:

lsblk -o NAME,SIZE,FSTYPE,MOUNTPOINT

crypto_LUKS means encrypted. Any partition that holds real data (logs, media, a database, a cache) and isn’t under LUKS is readable by whoever pulls the disk.

2. If it’s encrypted, how does it unlock at boot? Unattended devices can’t wait for someone to type a passphrase, so they often unlock with a key file:

cat /etc/crypttab

The third column is the key. none means a passphrase prompt. A file path means a key file. Then check where that file lives:

df "$(awk '!/^#/ && NF {print $3}' /etc/crypttab | head -1)"

If the key file is on an unencrypted partition, you’ve rebuilt the Flock setup: the lock and the key in the same drawer.

3. Bind the key to the hardware instead. On devices with a TPM, systemd can unlock LUKS using the TPM chip, so the key never sits on disk. Pulling the drive out of the device then gets an attacker nothing:

sudo systemd-cryptenroll --tpm2-device=list
sudo systemd-cryptenroll --tpm2-device=auto --tpm2-pcrs=7 /dev/sdX2

Swap in your LUKS partition. Then set the crypttab options to tpm2-device=auto, keep a recovery key somewhere safe, and remove the key file. PCR 7 ties it to the Secure Boot state, so booting something else won’t unlock it either.

4. Your own Android app: is a key compiled into it? Decompile your own APK and search it. jadx does the decompiling:

jadx -d out app-release.apk
grep -rnE "SecretKeySpec|IvParameterSpec|BEGIN (RSA |EC )?PRIVATE KEY|\"[A-Za-z0-9+/]{32,}={0,2}\"" out/sources | head -50

A SecretKeySpec built from a string literal means anyone with the APK has your key. Generate keys inside the Android Keystore instead, where they can’t be pulled out of the app.

5. Containers and firmware images: keys baked into layers. Point a secret scanner at the image’s files, not just your repo. With gitleaks:

mkdir rootfs && docker export "$(docker create your-image:tag)" | tar -x -C rootfs
gitleaks dir rootfs -v

Private keys and .env files in image layers are common, and every copy of that image ships them.

6. Ask the question for every device you deploy: if someone walks away with this, what can they read without any password? If the honest answer is “everything,” the encryption is decoration.


New write-ups and both weekly posts land in the inbox — subscribe, or grab the RSS feed.