leommxj/prebuilt-multiarch-bin

[bug report] bind_shell/reverse_shell will drop privilege in some cases

Closed this issue · 2 comments

Both bind_shell and reverse_shell will execute /bin/sh for an interactive shell, however, sh in some cases will drop privilege.

Add the following snippet will fix this

if geteuid() == 0:
    setresuid(0, 0, 0);
    setresgid(0, 0, 0);

spawn /bin/sh and others

BTW, there is a typo. the word spwan should be spawn

@bash-c Done. Please ddw.