Skip to content

Commit dfbc50f

Browse files
committed
Make Host header override optional
1 parent 401d553 commit dfbc50f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/msf/core/handler/reverse_http.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def initialize(info = {})
5353
OptString.new('MeterpreterServerName', [ false, 'The server header that the handler will send in response to requests', 'Apache' ]),
5454
OptAddress.new('ReverseListenerBindAddress', [ false, 'The specific IP address to bind to on the local system']),
5555
OptInt.new('ReverseListenerBindPort', [ false, 'The port to bind to on the local system if different from LPORT' ]),
56+
OptBool.new('OverrideRequestHost', [ false, 'Forces clients to connect to LHOST:LPORT instead of keeping original payload host', false ]),
5657
OptString.new('HttpUnknownRequestResponse', [ false, 'The returned HTML response body when the handler receives a request that is not from a payload', '<html><body><h1>It works!</h1></body></html>' ])
5758
], Msf::Handler::ReverseHttp)
5859
end
@@ -93,7 +94,7 @@ def listener_uri
9394
#
9495
# @return [String] A URI of the form +scheme://host:port/+
9596
def payload_uri(req)
96-
if req and req.headers and req.headers['Host']
97+
if req and req.headers and req.headers['Host'] and not datastore['OverrideRequestHost']
9798
callback_host = req.headers['Host']
9899
elsif ipv6?
99100
callback_host = "[#{datastore['LHOST']}]:#{datastore['LPORT']}"

0 commit comments

Comments
 (0)