Home Shell Escape Sequences
Post
Cancel

Shell Escape Sequences

Shell Escape Sequences

The sudo command, by default, allows you to run a program with root privileges. Under some conditions, system administrators may need to give regular users some flexibility on their privileges. For example, a junior SOC analyst may need to use Nmap regularly but would not be cleared for full root access. In this situation, the system administrator can allow this user to only run Nmap with root privileges while keeping its regular privilege level throughout the rest of the system.

Enumeration

We are going to exploit this misconfiguration to escalate our privileges to root. Let’s check the list of a programs that can be run with root privilege by executing sudo -l

linpriv

We will be using GTFobins https://gtfobins.github.io/ to exploit these applications that are set to run with sudo privileges.

Exploitation

iftop

Let’s check gtfobins to see whether there is a way to exploit iftop .

linpriv

Well..we got it. We will follow the given procedure to exploit it and escalate to root.

linpriv

linpriv

linpriv

find

Let’s check gtfobins to see whether there is a way to exploit find .

linpriv

Well..we got it. We will follow the given procedure to exploit it and escalate to root.

linpriv

nano

Let’s check gtfobins to see whether there is a way to exploit nano .

linpriv

Well..we got it. We will follow the given procedure to exploit it and escalate to root.

linpriv

linpriv

linpriv

vim

Let’s check gtfobins to see whether there is a way to exploit vim .

linpriv

Well..we got it. We will follow the given procedure to exploit it and escalate to root.

linpriv

man

Let’s check gtfobins to see whether there is a way to exploit man .

linpriv

Well..we got it. We will follow the given procedure to exploit it and escalate to root.

linpriv

linpriv

linpriv

awk

Let’s check gtfobins to see whether there is a way to exploit awk .

linpriv

Well..we got it. We will follow the given procedure to exploit it and escalate to root.

linpriv

less

Let’s check gtfobins to see whether there is a way to exploit less .

linpriv

Well..we got it. We will follow the given procedure to exploit it and escalate to root.

linpriv

linpriv

linpriv

ftp

Let’s check gtfobins to see whether there is a way to exploit ftp .

linpriv

Well..we got it. We will follow the given procedure to exploit it and escalate to root.

linpriv

nmap

Let’s check gtfobins to see whether there is a way to exploit nmap .

linpriv

Well..we got it. We will follow the given procedure to exploit it and escalate to root.

linpriv

more

Let’s check gtfobins to see whether there is a way to exploit more .

linpriv

Well..we got it. We will follow the given procedure to exploit it and escalate to root.

linpriv

linpriv

This post is licensed under CC BY 4.0 by the author.