Pentesting2015

From
Revision as of 14:55, 5 October 2015 by Paul Wilhelm (talk | contribs) (→‎XSS)
Jump to navigation Jump to search

Wikiseite für das Thema Pentesting vom IT-Security Workshop 2015.

OWASP BWA auf VM einrichten

Das Open Web Application Security Project - Broken Web Applications (OWASP BWA) Paket liefert eine Sammlung von verschiedenen Web-Anwendungen unter anderen von der Damn Vulnerable Web Application (DVWA) einem angreifbaren Webserver den wir im Detail untersucht haben und für den wir die Einrichtung auf dem Raspberry Pi und in der Virtual Machine (VM) weiter unten genauer beschrieben haben. Die einfachste Variante ist somit die OWASP BWA VM einzurichten und man kann dann auf die einzelne Einrichtungen von DVWA verzichten.

OWASP BWA läuft neben VMWare auch unter VirtualBox, genaureres findet man unter

https://code.google.com/p/owaspbwa/wiki/UserGuide

https://www.owasp.org/index.php/OWASP_Broken_Web_Applications_Project

OWASP BWA enthaltene Projekte

Das OWASP BWA enthält eine große Anzahl an Projekte und eine vollständige Liste findet man unter

https://code.google.com/p/owaspbwa/wiki/UserGuide#Training_Applications

Von diesen haben wir die folgenden Projekte ausgewählt und beschreiben sie weiter unten im Detail:

  • OWASP WebGoat
  • Damn Vulnerable Web Application
  • Joomla version 1.5.15 (PHP, released November 4, 2009)

DVWA auf Rasperry Pi einrichten

#sources
#http://hackthistv.com/blog/how-to-install-dvwa-on-ubuntu-server-14-04/
#https://github.com/RandomStorm/DVWA
#http://www.computersecuritystudent.com/SECURITY_TOOLS/DVWA/DVWAv107/lesson1/


mkdir dvwa
cd dvwa/
wget https://github.com/RandomStorm/DVWA/archive/v1.0.8.zip
sudo apt-get -y install apache2 mysql-server php5 php5-mysql php-pear php5-gd
sudo apt-get update 
sudo apt-get -y install apache2 mysql-server php5 php5-mysql php-pear php

mysql passwort:
root
mysqlpassword

#raspbian got a different default directory
#see step 5 http://hackthistv.com/blog/how-to-install-dvwa-on-ubuntu-server-14-04/
#cd /etc/apache2/sites-available/
#ls
#cat default
cd /var/www/


sudo mv /home/pi/dvwa/v1.0.8.zip .
unzip v1.0.8.zip 

vim DVWA-1.0.8/config/config.inc.php 
#find the following line:
#
#$_DVWA[ 'db_password' ] = 'p@ssw0rd';
#
#and replace “p@ssw0rd” with your MySQL password.
#i.e. mysqlpassword



sudo vim /etc/php5/apache2/php.ini
#change to on:
;allow_url_include = Off
allow_url_include = On

#step 10
sudo chmod -R 777 DVWA-1.0.8/

mysql -u root -p
#password:
#mysqlpassword
create database dvwa;
exit


#let out Step 12 and Step 13 from http://hackthistv.com/blog/how-to-install-dvwa-on-ubuntu-server-14-04/
#vim /etc/apache2/apache2.conf
##Move to the bottom of the file and add the following line:
#ServerName localhost



#(re)start apache:
sudo service apache2 start


#Step 15
#Open a web browser and navigate to:
#http://[server IP address]/[dvwa-directory]/setup.php
#Example: 
#http://192.168.0.20/dvwa/setup.php
#browser:
firefox http://192.168.5.112/DVWA-1.0.8/setup.php
#and click the button that says “Create / Reset Database”

#now go to the dvwa mainpage:
firefox http://192.168.5.112/DVWA-1.0.8/
#login with
#username: admin
#password: password

#follow the instructions


DVWA auf VM einrichten

Einrichtung erfolgt analog zur Einrichtung auf dem Raspberry Pi (siehe oben).

Achtung! Default-Netzwerkeinstellung der gängigen Virtualisierungs-Hypervisors (VBox, VMWare, etc.) ist NAT. Um die VM via SSH administrieren bzw. die DVWA-Website erreichen zu können, müssen folgende Port-Forwarding-Regeln in die VM-Einstellungen im Hypervisor aufgenommen werden:

Host IP Host Port Guest IP Guest Port
127.0.0.1 2222 <Guest IP> 22
127.0.0.1 8080 <Guest IP> 80

Brute-Force Angriff auf DVWA

Zum Angriff auf DVWA wurde das Programm Hydra verwendet. Hydra können zwei Dateien übergeben werden, z.B. users.txt mit den Login-Namen und pwd.txt mit den zu testenden Passwörtern. Hydra wird wie folgt verwendet:

hydra {IP-Adresse} {http-form-post|http-get-form} -L {users.txt} -P {pwd.txt} "{Pfad auf dem Server}/index.php:{zu setzende Variablen}:S={Teil eines Strings, der im Erfolgfall angezeigt wird}"

Wörterbücher

https://wiki.skullsecurity.org/Passwords

https://crackstation.net/buy-crackstation-wordlist-password-cracking-dictionary.htm


Command Execution

Tip für medium security: http://stackoverflow.com/questions/5130847/shell-multiple-commands-in-one-line

Weiteres vorgehen: http://www.computersecuritystudent.com/SECURITY_TOOLS/DVWA/DVWAv107/lesson3/index.html

Links

MySQL SQL Injections

Übersichhtseite über verschiedene Injections:

http://pentestmonkey.net/cheat-sheet/sql-injection/mysql-sql-injection-cheat-sheet

XSS

Allgemeiner Artikel:

https://www.exploit-db.com/papers/13102/

XSS Online Game

https://xss-game.appspot.com

WebGoat