You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For obvious reasons, the stage2*.bin file will be created as root when launching the script with sudo. In this case, the shellcode (that will run as non privileged user) won't be able to delete the stage2*.bin file (EPERM).
I guess that the file should be chowned so the owner becomes the non-root user.
A quick fix is adding this snippet as soon as the file is created.
The target process may be owned by a different user altogether, so your proposed fix would not work in that case. I think we should read the uid of the target process via /proc/<PID>/loginuid, and leave the gid unchanged. I'll implement this at some point soon™
The target process may be owned by a different user altogether, so your proposed fix would not work in that case. I think we should read the uid of the target process via /proc/<PID>/loginuid, and leave the gid unchanged. I'll implement this at some point soon™
You are correct, I didn't realize that.
However, would you consider parsing /proc/<PID>/status instead of loginuid? It seems to be a more portable solution (loginuid does not work for daemons and it's not present on Android - not much relevant I guess).
For obvious reasons, the
stage2*.bin
file will be created as root when launching the script withsudo
. In this case, the shellcode (that will run as non privileged user) won't be able to delete thestage2*.bin
file (EPERM
).I guess that the file should be
chown
ed so the owner becomes the non-root user.A quick fix is adding this snippet as soon as the file is created.
The text was updated successfully, but these errors were encountered: