Skip to content

Port payload/windows/download_exec to x64 #20386

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

xHector1337
Copy link
Contributor

I have tried my best to port it from x86 to x64. It has some little problems that I can not see clearly.

@xHector1337 xHector1337 marked this pull request as draft July 15, 2025 13:53
@xHector1337
Copy link
Contributor Author

for some reason when running it with c, it crashes during URLDownloadToFileA function call.

@xHector1337
Copy link
Contributor Author

Problem likely lies in URLDownloadToFileA, as it is visible in the photo it calls URLDownloadToFileW in URLDownloadToFileA function and it somehow makes the executable crash.

image

add CachedSize & fix the fifth arg problem & run rubocop
@xHector1337 xHector1337 marked this pull request as ready for review July 17, 2025 08:40
@dledda-r7 dledda-r7 self-assigned this Jul 17, 2025
@adfoster-r7
Copy link
Contributor

#20386 (comment)

@xHector1337 Were you able to resolve this issue? 👀

@xHector1337
Copy link
Contributor Author

#20386 (comment)

@xHector1337 Were you able to resolve this issue? 👀

Thanks, I was.

Copy link
Contributor

@dledda-r7 dledda-r7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks clean and correct, i'll give it a shot this week and if everything works i think we are good to go.

@xHector1337, can you please fix the linting issue?
rubocop -a modules/payloads/singles/windows/x64/download_exec.rb
Thanks!

@xHector1337
Copy link
Contributor Author

Code looks clean and correct, i'll give it a shot this week and if everything works i think we are good to go.

@xHector1337, can you please fix the linting issue? rubocop -a modules/payloads/singles/windows/x64/download_exec.rb Thanks!

Thank you, I'll be fixing it immediately.

main:
pop rbp
call LoadLibrary
db "urlmon.dllK"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for not just null-terminating inline?

db "urlmon.dll", 0

Then you don't have to do any XOR later?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hate null-bytes. That's the reason.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My intent was avoiding null-bytes as much as possible.

end

def generate(_opts = {})
url = datastore['URL'] || 'http://localhost/hi.exe'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to have a default? Surely a hard failure when not specified or not a valid URL would be better?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants