hardcoded-creds
它能做什么
这份指南涵盖在设备固件中查找内置密码、密钥和默认账户。适合希望在出货前移除这些内容或确认它们已被移除的产品安全团队。
适用场景
- ✓当产品团队解包自家固件,并想查找内置密码时。
- ✓当设备带有可能未被更改的默认管理员账户时。
- ✓当证书或云密钥可能以明文形式存储在设备镜像中时。
技能链接
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/iot/hardcoded-creds/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请在我们提取的固件中搜索内置密码、默认账户或客户不应拥有的嵌入式密钥?”
每周 5 个新技能,1 分钟读完。
工作原理
智能体检查提取的文件系统中的账户文件、配置文件和字符串,报告发现的凭据,并建议将其移除。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Hardcoded Credentials
Extracted rootfs often contains plaintext or weakly hashed credentials, embedded TLS private keys, cloud API tokens, and hardcoded admin accounts. This playbook covers the full triage path from raw rootfs to validated cred.
Prerequisites
- Extracted rootfs from
binwalk-extractskill (path:/tmp/squashfs_rootor similar). - Tools:
john,hashcat,openssl,trufflehog,strings, standard GNU utilities.
ROOT=/tmp/squashfs_root # set once; referenced throughout
Phase 1 — Account Databases
/etc/passwd + /etc/shadow
# Check for non-standard shells (telnetd, /bin/sh) and disabled-but-present accounts
grep -v "nologin\|false" "$ROOT/etc/passwd"
# Extract hashed passwords
cat "$ROOT/etc/shadow" 2>/dev/null || echo "shadow not present"
# Identify hash types
# $1$ = MD5, $5$ = SHA-256, $6$ = SHA-512, $y$ = yescrypt, no-$ = DES
awk -F: '{print $1, $2}' "$ROOT/etc/shadow" | grep -v '^\*\|^!\|^:$'
# Crack with hashcat (shadow format)
hashcat -m 1800 "$ROOT/etc/shadow" /usr/share/wordlists/rockyou.txt # $6$ SHA-512
hashcat -m 500 "$ROOT/etc/shadow" /usr/share/wordlists/rockyou.txt # $1$ MD5
hashcat -m 1500 "$ROOT/etc/shadow" /usr/share/wordlists/rockyou.txt # DES
# john fallback (handles multi-type auto)
unshadow "$ROOT/etc/passwd" "$ROOT/etc/shadow" > /tmp/unshadowed.txt
john /tmp/unshadowed.txt --wordlist=/usr/share/wordlists/rockyou.txt
john /tmp/unshadowed.txt --show
BusyBox-specific user configs
# BusyBox httpd uses /etc/httpd.conf for auth
find "$ROOT/etc" -name "httpd.conf" -o -name ".htpasswd" | xargs cat 2>/dev/null
# BusyBox udhcpd / telnetd startup stanzas
grep -r "telnetd\|login\|password" "$ROOT/etc/inittab" "$ROOT/etc/init.d/" \
"$ROOT/etc/rc.d/" 2>/dev/null | grep -v "^Binary"
# BusyBox shadow format check (some use MD5 without $1$ prefix)
grep -E '^[^:]+:[^:!*]{3,}' "$ROOT/etc/shadow" 2>/dev/null
Phase 2 — SSH / Dropbear Keys
# Host keys (baked into firmware = same key across all units of same model)
find "$ROOT" -name "dropbear_*_host_key" -o -name "ssh_host_*_key" 2>/dev/null
# Convert Dropbear key to OpenSSH PEM for use
dropbearconvert dropbear openssh "$ROOT/etc/dropbear/dropbear_rsa_host_key" \
/tmp/host_rsa.pem
openssl rsa -in /tmp/host_rsa.pem -text -noout | head -20
# Authorized keys embedded for backdoor accounts
find "$ROOT" -path "*/.ssh/authorized_keys" | xargs cat 2>/dev/null
# Check if root has a passwordless authorized_key → instant SSH root on any unit
grep -r "authorized_keys\|ssh-rsa\|ecdsa-sha2" "$ROOT" 2>/dev/null | head -10
Phase 3 — Web Interface Credentials
# CGI / Lua / PHP / lighttpd configs
find "$ROOT" -name "*.lua" -o -name "*.cgi" -o -name "*.php" | \
xargs grep -l "password\|passwd\|credential\|secret\|admin" 2>/dev/null | head -20
# Plaintext credentials in web config files
grep -rn "admin\|password\|passwd\|secret\|token" \
"$ROOT/etc/lighttpd/" "$ROOT/etc/nginx/" "$ROOT/etc/httpd/" 2>/dev/null
# Hardcoded credentials in Lua/CGI scripts
grep -rn '"admin"\|"root"\|"1234"\|"password"' "$ROOT/usr/lib/lua/" \
"$ROOT/www/" "$ROOT/usr/share/www/" 2>/dev/null | head -30
Phase 4 — Strings-Based Secret Sweep
# Broad strings dump: capture all printable sequences ≥ 8 chars
find "$ROOT" -type f -executable | while read f; do
strings "$f" 2>/dev/null
done > /tmp/all_strings.txt
# Filter credential-like patterns
grep -iE 'password|passwd|secret|api.?key|token|credential|auth' /tmp/all_strings.txt \
| grep -vE '^(#|//|<!|<html|<head)' | sort -u | head -100
# AWS / GCP / Azure key patterns
grep -E 'AKIA[0-9A-Z]{16}|AIza[0-9A-Za-z_-]{35}|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}' \
/tmp/all_strings.txt
# JWT tokens
grep -oP 'eyJ[A-Za-z0-9+/=]+\.[A-Za-z0-9+/=]+\.[A-Za-z0-9+/=_-]+' \
/tmp/all_strings.txt | head -10
trufflehog filesystem scan
# trufflehog works on directories — point at rootfs
trufflehog filesystem "$ROOT" --only-verified 2>/dev/null
# Without --only-verified for broader sweep:
trufflehog filesystem "$ROOT" --json 2>/dev/null | \
python3 -c "import sys,json; [print(json.dumps(r, indent=2)) for r in map(json.loads, sys.stdin)]"
Phase 5 — MQTT / Cloud / IoT-Platform Tokens
# MQTT broker credentials
grep -rn "mqtt\|MQTT\|mosquitto" "$ROOT" --include="*.conf" --include="*.cfg" \
--include="*.json" --incl
常见问题
凭据通常在哪里找到?
该指南指出,应查看固件中的账户文件、Web 服务器配置和远程登录设置。
默认密码有风险吗?
有。该指南指出,从未更改的默认账户是一种常见弱点。
团队发现问题后应怎么做?
从固件中移除该凭据,并更换所有已暴露的机密。
详情
作者的原始描述
Systematic hunt for hardcoded credentials, API keys, certificates, and default passwords in extracted IoT firmware. Covers /etc/shadow and passwd parsing, busybox httpd configs, telnet/dropbear stanzas, MQTT/cloud API key extraction, and cross-referencing against known default-credential databases.
热度
- GitHub 星标
- 6.5k
- 排名
- #14099
- 许可证
- Apache-2.0
- 更新时间
- 2026/11/1
评论
- …