F5 BIG-IP漏洞調試環境搭建
0x00 前言
本文記錄從零開始搭建F5 BIG-IP漏洞調試環境的細節。
0x01 簡介
本文將要介紹以下內容:
F5 BIG-IP安裝
F5 BIG-IP漏洞調試環境配置
常用知識
0x02 F5 BIG-IP安裝
1.下載OVA文件
下載頁面:https://downloads.f5.com/esd/productlines.jsp
下載前需要先注冊用戶并申請激活碼,申請地址:http://www.f5.com/trial
2.安裝
(1)在VMware Workstation中導入OVA文件
(2)設置用戶名口令
導入虛擬機后,需要輸入默認用戶名(root)和默認口令(deault),接著需要重設root用戶和admin用戶的口令
(3)配置
輸入ifconfig獲得IP,訪問https://< ip >,使用admin用戶的憑據進行登錄
在配置頁面填入激活碼
在配置頁面可以配置開啟ssh允許通過ssh登錄
0x03 F5 BIG-IP漏洞調試環境配置
配置文件的定位參考《CVE-2022-1388 F5 BIG-IP iControl REST 處理進程分析與認證繞過漏洞復現》
1.定位java進程
查看進程:
ps aux |grep java
如下圖

定位進程pid 6324,jar包路徑/usr/share/java/rest
查看pid 6324的進程信息:

如下圖

定位文件/etc/bigstart/scripts/restjavad
修改JVM_OPTIONS,添加調試參數-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000
2.定位服務
查看所有服務的狀態:
systemctl status
找到pid 6324對應的服務名稱runit.service
添加調試參數后需要重啟服務:
service runit.service restart
查看參數是否修改:
ps aux |grep 8000
如下圖

3.開啟防火墻
在Web管理面板,依次選擇System -> Platform -> Security
添加規則,如下圖

遠程調試成功,如下圖

使用tmsh查看防火墻規則,參考
https://clouddocs.f5.com/cli/tmsh-reference/v15/modules/security/security_firewall_management-ip-rules.html
命令如下:
tmsh -c 'list /security firewall management-ip-rules'
結果如下圖

4.常用jar包位置
/usr/local/www/tmui/WEB-INF/lib/
/usr/share/java/rest
0x04 常用知識
1.tmsh用法
參考資料:
https://clouddocs.f5.com/api/tmsh/
https://clouddocs.f5.com/cli/tmsh-reference/latest/
(1)查看版本
tmsh show /sys version
(2)查看所有配置
分步操作:
tmshlist all-propertiesy
一鍵操作:
echo y | tmsh -c 'list all-properties'
(3)查看用戶信息
分步操作:
tmshlist auth
一鍵操作:
tmsh -c 'list auth'
(4)創建管理員用戶(web和ssh登錄)
參考:https://clouddocs.f5.com/cli/tmsh-reference/v15/modules/auth/auth_user.html
分步操作:
tmshcreate auth user user123 password aaaaaaa1234 description "Admin User" shell bash partition-access add { all-partitions { role admin } }
需要注意口令不能存在特殊字符
一鍵操作:
tmsh -c 'create auth user user123 password aaaaaaa1234 description "Admin User" shell bash partition-access add { all-partitions { role admin } }'
(5)刪除用戶
分步操作:
tmshdelete auth user test1
一鍵操作:
tmsh -c 'delete auth user test1'
2.使用REST API執行命令
需要管理員用戶名口令
訪問https://< url >/mgmt/tm/util/bash
能夠執行bash命令,獲得返回結果
代碼已上傳至github,地址如下:
https://github.com/3gstudent/Homework-of-Python/blob/master/BIG-IP_RunBash.py
3.日志相關
(1)搜索帶有指定關鍵詞的日志
grep -iR aaaaaaaa /var/log/
(2)web管理后臺同日志文件的對應關系
審計日志,位置System ->Logs -> audit,對應文件/var/log/audit
用戶登錄歷史記錄,位置Logins -> History,對應文件/var/log/secure
(3)其他日志位置
/var/log/restjavad-audit.0.log
/var/log/auditd/audit.log
/var/log/btmp
/var/log/wtmp
/var/log/lastlog
(4)查看web訪問日志
journalctl /usr/bin/logger
清除所有:
rm -rf /var/log/journal/*systemctl restart systemd-journald
0x05 小結
在我們搭建好F5 BIG-IP漏洞調試環境后,接下來就可以著手對漏洞進行學習。