开发者

Can gdb debug suid root programs?

开发者 https://www.devze.com 2023-03-16 09:50 出处:网络
I did a program that call setuid(0) and execve(\"/bin/bash\",NULL,NULL). Then I did chown root:root a.out && chmod +s a.out

I did a program that call setuid(0) and execve("/bin/bash",NULL,NULL).

Then I did chown root:root a.out && chmod +s a.out

When I execute ./a.out I get a root shell. However when I do gdb a.out it starts the process as normal user, and launch a user 开发者_高级运维shell.

So... can I debug a suided root program?


Only by running gdb as root. (In other words, no.)

For security reasons, normal users are not allowed to trace processes belonging to other users, especially root.

0

精彩评论

暂无评论...
验证码 换一张
取 消