Skip to content

Commit c83a763

Browse files
committed
Fix IPv6 issues in staged and stageless
* Stageless payloads weren't adding brackets around IPv6 hosts. * Staged HTTP handler was using an undefined function to check for IPv6 addresses when host header overriding was disabled.
1 parent b22ff67 commit c83a763

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/msf/core/handler/reverse_http.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def listener_uri
9191
def payload_uri(req)
9292
if req and req.headers and req.headers['Host'] and not datastore['OverrideRequestHost']
9393
callback_host = req.headers['Host']
94-
elsif ipv6?
94+
elsif Rex::Socket.is_ipv6?(datastore['LHOST'])
9595
callback_host = "[#{datastore['LHOST']}]:#{datastore['LPORT']}"
9696
else
9797
callback_host = "#{datastore['LHOST']}:#{datastore['LPORT']}"

lib/msf/core/handler/reverse_http/stageless.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ def generate_stageless(opts={})
3535
raise ArgumentError, "Stageless generation requires an ssl argument"
3636
end
3737

38-
url = "http#{opts[:ssl] ? "s" : ""}://#{datastore['LHOST']}:#{datastore['LPORT']}"
38+
host = datastore['LHOST']
39+
host = "[#{host}]" if Rex::Socket.is_ipv6?(host)
40+
url = "http#{opts[:ssl] ? "s" : ""}://#{host}:#{datastore['LPORT']}"
3941
url << "#{generate_uri_uuid_mode(:connect)}/"
4042

4143
# invoke the given function to generate the architecture specific payload

0 commit comments

Comments
 (0)