Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Skill Level 1: (Can identify vulnerable hosts - KNOWN VULNERABILITIES)
- ----------------------------------------------------------------------
- - Ping Sweep
- - Port Scan
- - Bannergrab
- - Vulnerability Research
- ########################
- # Scanning Methodology #
- ########################
- - Ping Sweep
- What's alive?
- ------------
- ---------------------------Type This-----------------------------------
- sudo nmap -sP 157.166.226.*
- -----------------------------------------------------------------------
- -if -SP yields no results try:
- ---------------------------Type This-----------------------------------
- sudo nmap -sL 157.166.226.*
- -----------------------------------------------------------------------
- -Look for hostnames:
- ---------------------------Type This-----------------------------------
- sudo nmap -sL 157.166.226.* | grep com
- -----------------------------------------------------------------------
- - Port Scan
- What's where?
- ------------
- ---------------------------Type This-----------------------------------
- sudo nmap -sS 162.243.126.247
- -----------------------------------------------------------------------
- - Bannergrab/Version Query
- What versions of software are running
- -------------------------------------
- ---------------------------Type This-----------------------------------
- sudo nmap -sV 162.243.126.247
- -----------------------------------------------------------------------
- - Vulnerability Research
- Lookup the banner versions for public exploits
- ----------------------------------------------
- http://exploit-db.com
- http://securityfocus.com/bid
- https://packetstormsecurity.com/files/tags/exploit/
- Skill Level 2: Can identify UNKNOWN VULNERABILITIES)
- ----------------------------------------------------
- 1. App Type
- - Stand Alone
- - Client-Server (app name: vulnserver.exe)
- - Web App
- 2. Data Input Type
- - File/Keyboard/Mouse (Stand Alone)
- - Logical Network Port (Client-Server) (tcp port: 9999)
- - Browser (Web App)
- 3a. Map and fuzz all app entry points
- - Methods
- - Functions
- - Subroutines
- - Controllers
- - Commands
- HELP
- STATS [stat_value]
- RTIME [rtime_value]
- LTIME [ltime_value]
- SRUN [srun_value]
- TRUN [trun_value]
- GMON [gmon_value]
- GDOG [gdog_value]
- KSTET [kstet_value]
- GTER [gter_value]
- HTER [hter_value]
- LTER [lter_value]
- KSTAN [lstan_value]
- EXIT
- 3b. Fuzz each app entry point
- 4. Isolate the crash
- - TRUN 2100 is where the app crashes once placed in OllyDBG
- 5. Calculate distance to EIP
- - Distance to EIP is 2006 bytes
- 6. Redirect program execution
- - JMP REG (example: JMP ESP)
- - PUSH REG; RET (PUSH EST; RET)
- - CALL REG; (CALL ESP)
- "\x91\xC8\x41\x7E" # CALL EDI - user32.dll
- - Land in dummy shellcode
- 7. Replace dummy shellcode with real shellcode
- - Bad characters
- \x00\x0a\x2f\x5c
- - Not enough space
- 243 bytes for shellcode
- --------------------------------------------------------------------------------------------------------------------------------
- #################################
- ----------- ############### # Intro to Exploit Development ################ -----------
- #################################
- - You can download everything you need for this exercise (except netcat) from the link below
- https://s3.amazonaws.com/infosecaddictsfiles/ExploitLab.zip
- - Extract this zip file to your Desktop
- - Go to folder C:\Users\Workshop\Desktop\ExploitLab\2-VulnServer, and run vulnserv.exe
- - Open a new command prompt and type:
- nc localhost 9999
- - In the new command prompt window where you ran nc type:
- HELP
- - Go to folder C:\Users\Workshop\Desktop\ExploitLab\4-AttackScripts
- - Right-click on 1-simplefuzzer.py and choose the option edit with notepad++
- - Now double-click on 1-simplefuzzer.py
- - You'll notice that vulnserv.exe crashes. Be sure to note what command and the number of As it crashed on.
- - Restart vulnserv, and run 1-simplefuzzer.py again. Be sure to note what command and the number of As it crashed on.
- - Now go to folder C:\Users\Workshop\Desktop\ExploitLab\3-OllyDBG and start OllyDBG. Choose 'File' -> 'Attach' and attach to process vulnserv.exe
- - Go back to folder C:\Users\Workshop\Desktop\ExploitLab\4-AttackScripts and double-click on 1-simplefuzzer.py.
- - 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
- - Calculate the distance to EIP by running script 3-3000chars.py
- - This script sends 3000 nonrepeating chars to vulserv.exe and populates EIP with the value: 396F4338
- 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 ~/toolz/metasploit/modules/exploits/windows/misc
- vi vulnserv.rb (paste the code into this file)
- cd ~/toolz/metasploit
- ./msfconsole
- use exploit/windows/misc/vulnserv
- set PAYLOAD windows/meterpreter/bind_tcp
- set RHOST 192.168.88.129
- set RPORT 9999
- exploit
- -------------------------------------------------------------------------------------------------------------------------
- The first exploit
- https://s3.amazonaws.com/infosecaddictsfiles/SLmail5-5-Exploit.zip
- SLMail Scripts Questions
- SLmail1.py
- How do you start SLMail?
- What do you have to be careful of when attaching your debugger to the application?
- How many As are you sending to the application?
- SLmail2.py
- What tool(s) can be used to generate a cyclic pattern?
- What port are we attacking?
- What verb are we attacking?
- SLmail3.py
- What is the value contained in EIP?
- What is the portion of the cyclic pattern that we must search for?
- What is the distance to EIP?
- SLmail4.py
- What do you overwrite EIP with in this script?
- What is the length of your shellcode in this script?
- What is the difference between SOCK_STREAM and SOCK_DGRAM?
- SLmail5.py
- What is struct.pack and why are we using it?
- What where is our JMP ESP coming from?
- What is the length of our shellcode in this script?
- SLmail6.py
- Why do you subtract the top of ESP from the bottom of ESP in this script?
- What is the length of our shellcode in this script?
- What is the distance to EIP in this script?
- SLmail7.py
- How do you test for bad characters?
- What are the bad characters in this script?
- What is the address of the JMP ESP in this script and what DLL does it come from?
- SLmail8.py
- What is DEP and how do you disable it?
- What is the purpose of the stack adjustment?
- What is the purpose of the NOP sled?
- If you got through SLMail comfortably - then try the script below.
- https://s3.amazonaws.com/infosecaddictsfiles/ff.zip
- -------------------------------------------------------------------------------------------------------------------------
- Analysis of the exploit code:
- https://www.exploit-db.com/exploits/15689/
- What is the target platform that this exploit works against?
- What is the variable name for the distance to EIP?
- What is the actual distance to EIP in bytes?
- Describe what is happening in the variable ‘junk2’?
- Analysis of the training walk-through based on EID: 15689:
- https://s3.amazonaws.com/infosecaddictsfiles/ff.zip
- ff1.py
- What does the sys module do?
- What is sys.argv[1] and sys.argv[2]?
- What application entry point is being attacked in this script?
- ff2.py
- Explain what is happening in lines 18 - 20
- What is pattern_create.rb doing and where can I find it?
- Why can’t I just double click the file to run this script?
- ff3.py
- Explain what is happening in lines 17 - to 25?
- Explain what is happening in lines 30 - to 32?
- Why is everything below line 35 commented out?
- ff4.py
- Explain what is happening in lines 13 - to 15.
- Explain what is happening in line 19.
- Why is everything below line 35 commented out?
- Ff5.py
- Explain what is happening in line 15.
- What is struct.pack?.
- How big is the shellcode in this script?
- ff6.py
- What is the distance to EIP?
- How big is the shellcode in this script?
- What is the total byte length of the data being sent to this app?
- ff7.py
- What is a tuple in python? Unchangeable list
- How big is the shellcode in this script? 1000 Bytes
- Did your app crash in from this script? No
- ff8.py
- How big is the shellcode in this script?
- What is try/except in python?
- What is socket.SOCK_STREAM in Python?
- ff9.py
- What is going on in lines 19 and 20?
- What is the length of the NOPs?
- What is socket.SOCK_STREAM in Python?
- ff010.py
- What is going on in lines 18 - 20?
- How would a stack adjustment help this script?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement