githubEdit

PATH

Example:

echo $PATH

Questions before using this privesc vector:

1: What folders are located under $PATH?

2: Does your current user have write privileges for any of these folders?

3: Can you modify $PATH?

4: Is there a script/app you can start that will be affected by this vulnerability?

Example script is at root shells directory in this repository:

Compilation:

gcc path_exp.c -o path -w

Give SUID bit

Find writeable directories

Add /tmp to PATH

Go to /tmp directory

Insert bash binary execution command in our example file

Give execute permissions

Run file

Last updated