cswl / tsu

Gain root shell on Termux.
ISC License
646 stars 155 forks source link

sudo: SUDO_USER is wrong and SUDO_UID is missing #99

Open cebtenzzre opened 1 year ago

cebtenzzre commented 1 year ago

Expected Result

On Linux:

$ sudo sh -c 'printf "%s\n" user=$SUDO_USER uid=$SUDO_UID gid=$SUDO_GID'
user=cebtenzzre
uid=1000
gid=1000

Actual Result

On Termux with tsu version 8.6.0:

$ sudo sh -c 'printf "%s\n" user=$SUDO_USER uid=$SUDO_UID gid=$SUDO_GID'
user=10394
uid=
gid=10394

SUDO_USER is actually the user ID, and SUDO_UID is not set.

Analysis

At a glance, it looks like there's a copy-paste error here: https://github.com/cswl/tsu/blob/5543412247ec8209e4ce776db2c7871f4fe3841b/shell/tsu.sh#L172-L174