2

Same as topic.

I'm root. Then switch to user1 using

su - user1

Then execute command as root without sudo or suid/chmod. Is it possible?

One person probably did this but tells me it's a magic trick...

Paulo Tomé
  • 3,782
Rexikon
  • 21

1 Answers1

2

This is not a huge security problem. The true problem is in how people erroneously think that su works.

su adds privileges to a login session. It does not take existing privileges away, or overlay existing processes, or create new login sessions. One can very simply suspend the child shell and go back to the parent one. Without the - one can even do this with the handy suspend command that is built-in to the C, Z, Korn, and Bourne Again shells. With it, suspension is an only slightly more difficult exercise in the use of the kill utility.

The architecture of dropping privileges is quite different. It involves chain-loading through programs such as setuidgid and not abusing su (or indeed sudo). su (and sudo) is for adding privileges, not dropping them.

Further reading

JdeBP
  • 68,745