-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
Fix bug in the way we are executing fetch payload when FETCH_DELETE is true #19719
Conversation
The issue itself seems to be fixed. The payload from bash syntax perspective is okay and it's running. However, from functional perspective, the payload seems to be causing some sort of race condition. Example:
When the payload spawns a new process, the deletion of the payload is sometimes faster than new process. Which results in failure. I suspect race condition as the payload sometimes runs successfully. |
I have not seen this, but I can believe it. I was concerned about that when we executed as background. I wonder if there's a very short sleep or time-consuming command we could run. |
Already tested that, we can do following:
It should fix the problem, I tried it with meterpreter and it worked. |
In my mind I was thinking about something sneakier and shorter, but I'm not coming up with anything. Probably |
This also an option, I'm not sure if it's sneaky, but at least it's not a
Basically, just get |
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.
Code is fine, used sleep
with random number from range 3 and 7 rather than wait
Release NotesThe bug in fetch payload resulted in malformed bash command when setting FETCH_DELETE to true, causing syntax error. While we fixed the original error, when we were testing the fix, we noticed a race condition - causing deleting the payload file before executing it. In the final fix, we added random |
This change fixes a bug in the way we execute the payload elf inside fetch command payloads when the FETCH_DELETE value is set to true. @h00die-gr3y did a great job explaining everything in the issue, and then solving it.
Fixes #19391
Old and Busted
New and Improved
Verification:
(...)
Thanks, @h00die-gr3y!