Privilege escalation

Checking SUID & GUID

www-data@dora:/$ find / -perm -u=s -type f 2>/dev/null
find / -perm -u=s -type f 2>/dev/null
/snap/core20/1852/usr/bin/chfn
/snap/core20/1852/usr/bin/chsh
/snap/core20/1852/usr/bin/gpasswd
/snap/core20/1852/usr/bin/mount
/snap/core20/1852/usr/bin/newgrp
/snap/core20/1852/usr/bin/passwd
/snap/core20/1852/usr/bin/su
/snap/core20/1852/usr/bin/sudo
/snap/core20/1852/usr/bin/umount
/snap/core20/1852/usr/lib/dbus-1.0/dbus-daemon-launch-helper
/snap/core20/1852/usr/lib/openssh/ssh-keysign
/snap/core20/1611/usr/bin/chfn
/snap/core20/1611/usr/bin/chsh
/snap/core20/1611/usr/bin/gpasswd
/snap/core20/1611/usr/bin/mount
/snap/core20/1611/usr/bin/newgrp
/snap/core20/1611/usr/bin/passwd
/snap/core20/1611/usr/bin/su
/snap/core20/1611/usr/bin/sudo
/snap/core20/1611/usr/bin/umount
/snap/core20/1611/usr/lib/dbus-1.0/dbus-daemon-launch-helper
/snap/core20/1611/usr/lib/openssh/ssh-keysign
/snap/snapd/18596/usr/lib/snapd/snap-confine
/usr/lib/dbus-1.0/dbus-daemon-launch-helper
/usr/lib/eject/dmcrypt-get-device
/usr/lib/snapd/snap-confine
/usr/lib/openssh/ssh-keysign
/usr/lib/policykit-1/polkit-agent-helper-1
/usr/bin/chsh
/usr/bin/at
/usr/bin/su
/usr/bin/fusermount
/usr/bin/chfn
/usr/bin/pkexec
/usr/bin/umount
/usr/bin/sudo
/usr/bin/passwd
/usr/bin/newgrp
/usr/bin/mount
/usr/bin/gpasswd

www-data@dora:/$ /usr/sbin/getcap -r / 2>/dev/null

/usr/sbin/getcap -r / 2>/dev/null
/snap/core20/1852/usr/bin/ping = cap_net_raw+ep
/snap/core20/1611/usr/bin/ping = cap_net_raw+ep

/usr/lib/x86_64-linux-gnu/gstreamer1.0/gstreamer-1.0/gst-ptp-helper = cap_net_bind_service,cap_net_admin+ep
/usr/bin/ping = cap_net_raw+ep
/usr/bin/mtr-packet = cap_net_raw+ep
/usr/bin/traceroute6.iputils = cap_net_raw+ep
triangle-exclamation

Running linpeas:

Interesting Results:

Exploitation

In the file in the file mananger, I found that there is one config file with user related data.

We can see the password of dora user.

Got Hash cracked.

Let's login to this user.

Got the shell as dora user.

Stabalize it.

Now we can see that dora is a member of the disk group.

Exploiting Disk Group

We will first list the disk.

After the partition is selected, now to examine and modify the partition the debugfs utility can be used in Linux, this utility can also be used to create a directory or read the contents of a directory.

We will debug the file system using debugfs the command utility. After listing I saw that /dev/mapper/ubuntu--vg-ubuntu--lv is a file system that was root files / so, I will be connecting to this.

Got connected to File stytem. When tried to create a folder. It says that we have only read permission. So, I tried to read ssh key as SSH port is open in this system But that also failed to read.

Working exploit

This is the best way to connect.

now, I will list /etc/shadow the file.

I found that there is a credential in a hashed format.

Now I will try to crack the root credential.

Now using this password (explorer ) We will switch to the root user.

Got the root privilege.

Last updated

Was this helpful?