Penetration Testing notes, resources and scripts
This is a collection of all the commands and tools I use for pentesting. I will try to keep it updated as much as possible.
If you liked the old content, you can find it in the archive folder.
export TARGET="target.com"
mkdir $TARGET
cd $TARGET
mkdir screenshots
export VT_APIKEY=<YourAPIKEY>
subfinder -d $TARGET -o subdomains_1.txt
findomain -t $TARGET -q > subdomains_2.txt
sublist3r -d $TARGET -t 3 -n -o subdomains_3.txt
gobuster vhost --no-color --append-domain -q -t 50 -u http://$TARGET -w /usr/share/wordlists/seclists/Discovery/DNS/subdomains-top1million-110000.txt -o raw_subdomains_4.txt
grep -oE 'Found: [^ ]+' raw_subdomains_4.txt | awk '{print $2}' > subdomains_4.txt
cat subdomains*.txt | sort | uniq > subdomains.txt
cat subdomains.txt| wc -l
# Go to
# https://chaos.projectdiscovery.io/#/
# to get all the subdomains for a program
## Check https://dnsdumpster.com/ it has nice graph
~/go/bin/httpx -l subdomains.txt -o subdomains-live.txt
cat subdomains-live.txt | wc -l
AWS Subdomain Takeover Steps
Automating Subdomain Takeover
subzy run --targets subdomains.txt --timeout 20 --output subdomain_subzy.txt
subjack -w subdomains.txt -t 100 -timeout 30 -o subdomain_subjack.txt -ssl
eyewitness -f subdomains-live.txt --web -d screenshots --timeout 100 --delay 10 --proxy-ip 127.0.0.1 --proxy-port 8080
# or
cat subdomains-live.txt | aquatone --out screenshots -scan-timeout 900 -chrome-path /usr/bin/chromium
naabu -iL subdomains-live.txt -silent -exclude-cdn -top-ports 1000 -o ports.txt
wget -r --no-parent -R "index.html*" https://wordlists-cdn.assetnote.io/data/ -nH -e robots=off
echo bugcrowd.com | gau | wordlistgen | sort -u > wordlist.txt
Spider using Burp Suite or OWASP ZAP or Hakrawler or Gospider
Extact links and parse js and spider and inline javascript
xnLinkFinder -i tesla.com -d 2 -sp https://tesla.com -o tesla.txt
Check for oudated js libraries using RetireJS in Burp Suite
Use GF-Patterns to find parameters
Use sus_params
Run this script content-discovery.sh
feroxbuster -u http://localhost:3000/#/ --extract-links -o links.txt --filter-status 404 500 --rate-limit 100 --scan-limit 1 -t 10 --random-agent
curl $TARGET/favicon.ico | md5sum
Check /robots.txt
Check /sitemap.xml
Check HTTP headers
Use google dorks
Check https://archive.org/web/
Check Github / Gitlab / Bitbucket
Search in target tab in Burp Suite for words like: path, link, …
slurp domain -t booking.com
# TODO: check s3 workflow
# also check this https://github.com/nikhil1232/Bucket-Flaws
cat subdomains-live.txt | xargs -P 10 -I {} curl -k -x http://localhost:8080 {} -o /dev/null
org:"TARGET.com"
ssl:"TARGET.com"
socialhunter -f subdomains-live.txt -w 10 > sociallinks-hunting.txt
# Find XSS vulnerabilities using XSSHunter
xsshunter -u $TARGET
# Test for SQL injection vulnerabilities using SQLMap
sqlmap -u $TARGET
# Test for XXE vulnerabilities using XXEInjector
xxeinjector $TARGET
# Detect SSRF vulnerabilities using SSRFDetector
ssrfdetector $TARGET
# Scan for Git repositories using GitTools
gitdumper $TARGET
# Find secrets in Git repositories using gitallsecrets
gitallsecrets -u $TARGET
# Test for race conditions using RaceTheWeb
racetheweb $TARGET
# Test for CORS vulnerabilities using CORStest
corstest $TARGET
# Test for parameter tampering vulnerabilities using parameth
parameth -u $TARGET
ffuf -w /usr/share/wordlists/SecLists/Fuzzing/LFI/LFI-etc-files-of-all-linux-packages.txt -u http://10.10.41.192/playground.php?file=FUZZ -fr Failed
files we are intersted to see
/etc/issue | contains a message or system identification to be printed before the login prompt. |
---|---|
/etc/profile | controls system-wide default variables, such as Export variables, File creation mask (umask), Terminal types, Mail messages to indicate when new mail has arrived |
/proc/version | specifies the version of the Linux kernel |
/etc/passwd | has all registered user that has access to a system |
/etc/shadow | contains information about the system’s users’ passwords |
/root/.bash_history | contains the history commands for root user |
/var/log/dmessage | contains global system messages, including the messages that are logged during system startup |
/var/mail/root | all emails for root user |
/root/.ssh/id_rsa | Private SSH keys for a root or any known valid user on the server |
/var/log/apache2/access.log | the accessed requests for Apache webserver |
C:\boot.ini | contains the boot options for computers with BIOS firmware |
What is an IDOR?
IDOR stands for Insecure Direct Object Reference and is a type of access control vulnerability.
This type of vulnerability can occur when a web server receives user-supplied input to retrieve objects (files, data, documents), too much trust has been placed on the input data, and it is not validated on the server-side to confirm the requested object belongs to the user requesting it.
/?userId=123
python3 -m http.server 8000
nc -nlvp 9001