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

stageless shellcode exit #7

Closed
timwhitez opened this issue Sep 13, 2022 · 5 comments
Closed

stageless shellcode exit #7

timwhitez opened this issue Sep 13, 2022 · 5 comments

Comments

@timwhitez
Copy link

execute the stageless shellcode and just exit

@kyleavery
Copy link
Owner

Can you tell me more about the test environment? OS, architecture, loaded CNA scripts, loader implementation (how is memory allocated, written, executed).

@timwhitez
Copy link
Author

win10, cs4.7, x64, example.profile, only load aceldr.cna,
use runshc64.exe from https://github.com/hasherezade/pe_to_shellcode/releases/tag/v1.1 to execute the stageless bin

@kyleavery
Copy link
Owner

kyleavery commented Sep 13, 2022

The problem is here: https://github.com/hasherezade/pe_to_shellcode/blob/4badc3b769ce7c1ceb6f2d098516bfca82ecd94d/loader_v2/peloader.cpp#L174

This loader appears to cast the shellcode as a function pointer, executes it, and then returns. As stated in the readme, AceLdr is not compatible with loaders that rely on the shellcode thread staying alive. Try adding a WaitForSingleObject((HANDLE)-1,INFINITE); below that line to keep the loader from exiting.

@timwhitez
Copy link
Author

i will try later, thank you so much!

@timwhitez
Copy link
Author

it works well.
btw, i can't build the raw petoshellcode project, but i build a new shellcode loader by golang to test this

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

No branches or pull requests

2 participants