Pentesting2015

From
Revision as of 07:51, 30 September 2015 by Dominik (talk | contribs)
Jump to navigation Jump to search

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

allgemeine Planung

Einarbeitung ins Pentesting für Web-Applikationen mit Hilfe von dvwa.

1. Tag:

  • Einrichten von DVWA aus Raspberry Pi und VMs
  • Brute-Force Angriff auf DVWA

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}"

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

Wörterbücher

https://wiki.skullsecurity.org/Passwords

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