System Hacking 💻
We start by gathering information about the target system, such as its operating system, services running, and open ports. Use this to identify potential vulnerabilities that can be exploited.
Identify target
Nmap
nmap -sS -p 21,22,80,443 <IP>
nmap --top-ports 100 -T4 <HOST_IP>
nmap -sS -A -p- -T4 --script=vuln -oN full-scan <IP>
nmap -vv -Pn -p- -sC -sV -T4 -oN complete-scan <HOST_IP>
nmap -sS -T0 --randomize-hosts --data-length 50 <TARGET_IP>
# A stealthy scan, paranoid timing(less likely to be detected), randomize order, and add random data to packet to evade detection
Scan for vulnerabilities using NSE scripts:
nmap -sC -sV -oN initial <HOST_IP>
nmap -p 80,443,21,22,445 --script vuln <HOST_IP>
nmap -p 80,443 --script http-enum <HOST_IP>
nmap -p 443 --script ssl-enum-ciphers <HOST_IP>
Netdiscover
netdiscover -i eth0 -r 10.0.0/24
Hydra
hydra -l <username> -P <full path to pass> <HOST_IP> -t 4 ssh
hydra -l <username> -P rockyou.txt <HOST_IP> http-post-form "<path>:username=^USER^&password=^PASS^:<invalid response>"
Web reconnaissance
If Ports 80 (HTTP) or 443 (HTTPS) are open, it usually suggests the presence of a web service. Let's try to find flags, discover directories and identify version-specific vulnerabilities.
curl http://<HOST_IP>/robots.txt
curl -I <HOST_IP>
Look at the Server:
header to identify the web server.
If Port 80 is Closed but Expected to be Open, this might indicate:
- Intrusion Detection System (IDS) active
- Port knocking mechanism in place
nmap -p 80 <HOST_IP>
PORT STATE SERVICE
80/tcp closed http
sleep 10 & nmap -p 80 <HOST_IP>
nmap -sT -p 80 <HOST_IP>
Each CMS (WordPress, Joomla, Drupal) has know vulnerabilities and common misconfigurations.
Frameworks (developer toolkit to build apps like Django, Rails, Laravel) have distinct attack surfaces, e.g. Django apps often leak /admin/
panel or Laravel apps might expose .env
config files.
Let's use whatweb or wappalyzer to analyze HTTP responses, headers, cookies, and HTML code to guess:
- If the target is running WordPress (CMS) → Try wpscan
- If the target is running Django (framework) → Look for Django debug mode, admin panel
- If the target is running React.js (frontend) → Might indicate a modern SPA with a backend API to target
WhatWeb
whatweb -v -a 2 --log whatweb.txt <HOST_IP>
nmap -sV -p- --script=http-vuln* -oN nmap_http <HOST_IP>
Gobuster
gobuster dir -u <HOST_IP> -w /usr/share/wordlists/dirb/common.txt
WPscan
wpscan --url <HOST_IP> --enumerate p,t,u --disable-tls-checks --format json --output wpscan.json
Nikto
nikto -h <HOST_IP> -p 80,443 -output nikto_scan.txt