python3 binary with SUID cannot execute command as `root`

271 Views Asked by At

As the title suggests, my /usr/bin/python3.10 binary cannot be executed under root privilege even though I set the right to -rwsr-xr-x.

I tested using command /usr/bin/python3.10 -c "import os; os.system('whoami')". The result is not root as expected, rather it is the username of the user executed such command.

However when I do a ps auxf command, I could see that the username of the above python process (the value at the first column) is still root.

I am testing on Ubuntu 20.04 and Ubuntu 22.04.

Can somebody help me, please?

0

There are 0 best solutions below