Checklist
- nmap or EyeWitness enumeration
- What backend server it is?
- What version?
- What port?
- - Are there any other services that could be connected to it like FTP?
- View the website the intended way
- - Check for any file upload pages
- - Check for any user inputs like registration, contact forms, login pages and forgot password subpages
- - Check for any GET parameters being sent
- - Use Wappalyzer to get more back-end information
- Check the page’s source code
- - Check for comments in the code
- - Check for useful back-end information like software used or file paths
- - Check for .js, .php or other scripts that could help us with authentication or other insight
- Perform various scans
- - Use gobuster for initial simple directory bruteforce
gobuster dir -u http://10.129.204.231/cgi-bin/ -w /usr/share/wordlists/dirb/small.txt -x php
- - Use ffuf for thorough investigation
- Directory scan -
ffuf -w /opt/useful/SecLists/Discovery/Web-Content/directory-list-2.3-small.txt:FUZZ -u http://SERVER_IP:PORT/FUZZ - Extension scan -
ffuf -w /opt/useful/SecLists/Discovery/Web-Content/web-extensions.txt:FUZZ -u http://SERVER_IP:PORT/blog/indexFUZZ - Website scan -
ffuf -w /opt/useful/SecLists/Discovery/Web-Content/directory-list-2.3-small.txt:FUZZ -u http://SERVER_IP:PORT/blog/FUZZ.php- Recursive website scan -
ffuf -w /opt/useful/SecLists/Discovery/Web-Content/directory-list-2.3-small.txt:FUZZ -u http://SERVER_IP:PORT/FUZZ -recursion -recursion-depth 1 -e .php -v
- Recursive website scan -
- Directory scan -
- - Remember to add IP and domain names to
/etc/hostsif you can’t your designated site - - POST parameter scan -
ffuf -w /opt/useful/SecLists/Discovery/Web-Content/burp-parameter-names.txt:FUZZ -u http://admin.academy.htb:PORT/admin/admin.php -X POST -d 'FUZZ=key' -H 'Content-Type: application/x-www-form-urlencoded' -fs xxx- Tip: In PHP, “POST” data “content-type” can only accept “application/x-www-form-urlencoded”. So, we can set that in “ffuf” with “-H ‘Content-Type: application/x-www-form-urlencoded’”
- We can run POST parameters with burp and curl as well:
curl http://admin.academy.htb:PORT/admin/admin.php -X POST -d 'id=key' -H 'Content-Type: application/x-www-form-urlencoded' - POST looks for both GET and POST parameters so it’s better to POST.
- Parameter value scan -
ffuf -w ids.txt:FUZZ -u http://admin.academy.htb:PORT/admin/admin.php -X POST -d 'id=FUZZ' -H 'Content-Type: application/x-www-form-urlencoded' -fs xxx
- - Use gobuster for initial simple directory bruteforce
- File uploads
- Look for any possible file upload opportunities.
- You can find a lot of technics for avoiding different types of restrictions and different types of file injections here
- Look for GET parameters being passed
- - Local file inclusion
- Try plain absolute path like:
/etc/passwd - Try file path traversal
../etc/passwdand different amounts or types like../../etc/passwd,....//etc/passwdor....\/etc/passwd - You can try and encode
../etc/passwdto%2e%2e%2fetc/passwdand play with other possibilities like a full encode%2e%2e%2f%2e%2e%2f%2e%2e%2f%2e%2e%2f%65%74%63%2f%70%61%73%73%77%64 - Look for approved paths and append our inclusion after them like here
/languages/../../../../etc/passwd - Add null byte to delete any blocking appendments like restrictive file extension. Simply add
%00at the end like/etc/passwd%00 - We can also force a string maximum character limit. Use this command to create such a string:
echo -n "non_existing_directory/../../../etc/passwd/" && for i in {1..2048}; do echo -n "./"; done non_existing_directory/../../../etc/passwd/./././<SNIP>././././ - If we need to know the full server webroot path to complete our exploitation, we can fuzz for the our file through common webroot paths, which we can find in this wordlist for Linux or this wordlist for Windows. Depending on our LFI situation, we may need to add a few back directories (e.g.
../../../../), and then add ourindex.phpafterwards - The following is an example of how we can do all of this with ffuf:
ffuf -w /opt/useful/SecLists/Discovery/Web-Content/default-web-root-directory-linux.txt:FUZZ -u 'http://<SERVER_IP>:<PORT>/index.php?language=../../../../FUZZ/index.php' -fs 2287 - Check for vulnerable functions in source code that can be taken advantage of for local, or remote file inclusion
- Try plain absolute path like:
- - Remote file inclusion
- Test with a local URL inclusion
http://<SERVER_IP>:<PORT>/index.php?language=http://127.0.0.1:80/index.php- If this works look if the opened (in this example) index.php shows only source code or was rendered. If it was rendered it means that the php code executes automatically which is great
- Test with a local URL inclusion
- - PHP filters
- - Look for .php files -
ffuf -w /opt/useful/SecLists/Discovery/Web-Content/directory-list-2.3-small.txt:FUZZ -u http://<SERVER_IP>:<PORT>/FUZZ.php - Scan for all codes, including 301, 302 and 403 pages, as if we have a local file inclusion access we should be able to read their source code no matter of the error code
- Sometimes .php files execute automatically, when we want to read them instead of execute when we try to view them we can use
php://filter/read=convert.base64-encode/resource=config.phpto encode the file’s content and than locally decrypt it withecho 'PD9waHAK...SNIP...KICB9Ciov' | base64 -d
- - Look for .php files -
- - Automated scanning
- - Bruteforce for more GET parameters -
ffuf -w /opt/useful/SecLists/Discovery/Web-Content/burp-parameter-names.txt:FUZZ -u http://admin.academy.htb:PORT/admin/admin.php?FUZZ=key -fs xxx- Also filtering for response size xxx - We can utilize a number of LFI tools to automate much of the process stated above. The most common LFI tools are LFISuite, LFiFreak, and liffy. We can also search GitHub for various other LFI tools and scripts, but in general, most tools perform the same tasks, with varying levels of success and accuracy. Unfortunately, most of these tools are not maintained and rely on the outdated python2, so using them may not be a great long term solution
- There are a number of LFI Wordlists that you can use for scanning. A good wordlist is LFI-Jhaddix.txt, as it contains various bypasses and common files.
ffuf -w /opt/useful/SecLists/Fuzzing/LFI/LFI-Jhaddix.txt:FUZZ -u 'http://<SERVER_IP>:<PORT>/index.php?language=FUZZ' -fs 2287 - If the website is a WordPress one, scan it with
wpscan. First with basic command and later with a full, big one likewpscan --url <IP> -e ap,at,tt,u --api-token huLbjICUbowIePfNBVnroaYCY0qaycp5dilfJGXVwa0 --plugins-detection aggressive --themes-detection aggressive.
- - Bruteforce for more GET parameters -
- - Local file inclusion
- IDOR
- - Look for predictable patterns in url parameters, file names, website names etc.
- - Use Burp to go through the site to see if it finds any additional info that is parsed inside http requests and responses like insecure API calls
- Analyze any interesting web traffic (like sending a form) with Burp Suite
- - Check if you can include data, inject commands or see json or XML being transferred
- Check for common applications
- Depending on the application that runs on the web server you can look around this whole section for guidance
- Injections
- - SQL Injections
- - Command Injections
- We can try command injection when we see an interesting input field
- Simple
;can be used to start the testing. - There are other possible ways to test like this list of operators
- There are also a few unix-only operators, that would work on Linux and macOS, but would not work on Windows, such as wrapping the injected command with double backticks (
``) or with a sub-shell operator ($()) - You can also use automated tools like Linux (Bashfuscator) or Windows (DOSfuscation) to check, further analyse and run in paralel with your manual investigation
- - XXE Injections
- Here’s a XML DTD that puts a static string to a given field.
<!DOCTYPE email [<!ENTITY company "!!!VULNERABLE!!!">]>. If this work, it means we have an XXE vulnerability - This example gives the whole DTD. if there is an existing one just put the entity variable
- A lot of different types of XXE injections can be found here
- Here’s a XML DTD that puts a static string to a given field.
- Check for XSS on the page
- - We can test whether the page is vulnerable to XSS with the following basic XSS payloads:
<script>alert(window.origin)</script>,<script>alert(document.cookie)</script>and<img src="" onerror=alert(window.origin)>Stored (Persistent) XSS- comments, formsReflected (Non-Persistent) XSS- links and parameters, search bars. look for it also in file uploads where you can attach code in the uploaded file names. Maybe php tries to execute file name with OS commandsDOM-based XSS- CSS, client-site links. Malicious staff only on one user, no server included and non persistent
- - We can test whether the page is vulnerable to XSS with the following basic XSS payloads:
- HTTP Verb Tempering
- To identify this vulnerability simply play around with other methods to see if you can then push some exploit or injection when you were not able to do so previously with simple GET/POST parameter. This also helps with HTTP basic authentication pop-up logins
- If not with burp, you can utilize curl to run different http verbs like so:
curl -i -X OPTIONS http://SERVER_IP:PORT/ - Other than GET and POST, HTTP has 9 different verbs that can be accepted as HTTP methods by a web servers
- Cookies
- - Use SharpChromium to get cookie values from the current user. HTB section on it can be found here
- Last chance
- - Search through OSINT information
- - Search through your notes, HTB sections and cheatsheets
- - Rest and repeat the whole process, you must have missed something
Check for those weird type of attacks with different http parameters and with like dir busting http parameters with ffuf
References
Web Vulnerabilities Methodology