Home
Calendar
Certifications
Columns
Features
Forum
Resources
Vitals
Latest Additions
April 2013 Free Giveaway Sponsor - eLearnSecurity
Human Intelligence to Navigate the Security Data Deluge
February 2013 Free Giveaway Winner of SANS CyberCon Training
Interview: Bugcrowd Founders on Herding Ninjas for Crowdsourced Bug Bounties
Network Forensics: The Tree in the Forest
March 2013 Free Giveaway Sponsor - Mile2
Book Review: Violent Python
February 2013 Free Giveaway Sponsor - SANS
Holiday 2012 Free Giveaway Winner of Metasploit Pro by Rapid7
Course Review: SANS FOR408 Computer Forensic Investigations – Windows In-Depth
The Security Consulting Sugar High
Tutorial: Fun with SMB on the Command Line
Interview: Ilia Kolochenko, CEO of High-Tech Bridge
October 2012 Free Giveaway Winner of LearningGate Training
The Broken: Assessing Corporate Security in 2012 to Make a Better 2013
EH-Net Login
Welcome Guest.
Username:
Password:
Remember me
Lost Password?
No account yet?
Register
Who's Online
We have 34 guests online
You are here:
Home
Ethical Hacking Discussions and Related Certifications
Network Pen Testing
Finding the right exploit
EH-Net
May 25, 2013, 03:18:34 PM
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News
: Go back to The Ethical Hacker Network Online Magazine
Home Page
Home
Help
Calendar
Login
Register
EH-Net
>
Ethical Hacking Discussions and Related Certifications
>
Network Pen Testing
(Moderator:
don
) >
Finding the right exploit
Pages: [
1
]
Go Down
« previous
next »
Print
Author
Topic: Finding the right exploit (Read 3025 times)
0 Members and 1 Guest are viewing this topic.
H1t M0nk3y
Hero Member
Offline
Posts: 865
Finding the right exploit
«
on:
January 10, 2013, 06:55:07 PM »
Hey,
I was working in a lab trying to pwn a given host, so I more or less did the following:
1) Ran nmap: May ports are open
2) Ran Nessus: MS08-067: Microsoft Windows Server Service Crafted RPC Request Handling Remote Code Execution (958644) (uncredentialed check)
3) Metasploit: search MS08-067
4) Metasploit: use exploit/windows/smb/ms08_067_netapi
So this was pretty easy. This host was so full of holes that I could have probably used many other exploits (Nessus found 22 red ones...). But I then tried to figure out how Nessus was able to find this vulnerability and this is where I hit a wall...
I was able to easily find the OS and open ports like these:
Code:
OS: Microsoft Windows 2000 SP3/SP4 or Windows XP SP1/SP2 (95%)
PORT STATE SERVICE VERSION
------------------------------------------------------------------
135/tcp open msrpc Microsoft Windows RPC
139/tcp open netbios-ssn
443/tcp open https?
445/tcp open microsoft-ds Microsoft Windows 2000 microsoft-ds
1031/tcp open msrpc Microsoft Windows RPC
1035/tcp open msrpc Microsoft Windows RPC
1037/tcp open msrpc Microsoft Windows RPC
...
Does this nmap output tells you something like: "That's obviously a ms08_067_netapi vulnerability that we have here!". For me, without Nessus, I would have never tried this exploit...
So what approach do you guys use? Do you have a set of very powerful exploits that you try at targets that simply match the OS and maybe a port? Or is there some voodoo that you can do to go from this nmap output to this exploit?
I found more details about it at
http://www.metasploit.com/modules/exploit/windows/smb/ms08_067_netapi
I feel like a script kiddy now...
Logged
OSCP, GPEN, GWAPT, GSEC, CEH, CISSP
lorddicranius
Sr. Member
Offline
Posts: 447
Re: Finding the right exploit
«
Reply #1 on:
January 10, 2013, 07:03:15 PM »
I think the clues to try this exploit are the OS and that port 445 is open.
That Metasploit link you posted shows the OS in the vulnernable OS list. Plus, the RHOST lines defaults to 445 [SMB service port. (side question: Is this port configurable if you're setting up the network in a production environment?)].
I'm not a pentester by day though, just from what I've gathered in my own lab awhile back when messing with that exploit.
«
Last Edit: January 10, 2013, 07:06:18 PM by lorddicranius
»
Logged
GSEC, eCPPT, Sec+
Grendel
Full Member
Offline
Posts: 242
Re: Finding the right exploit
«
Reply #2 on:
January 10, 2013, 07:44:15 PM »
There are a few factors that a scanner looks for, but it breaks down to the following:
1) OS & version
2) OS language pack (on occasion)
3) Version of the application in question
Even if all three match a particular exploit, it may not work - there are ways to mitigate exploits from a defensive side.
Logged
- Thomas Wilhelm, MSCS MSM
ISSMP CISSP SCSECA SCNA IEM
Web Site:
http://HackingDojo.com
Author:
Professional Penetration Testing
Ninja Hacking
Penetration Tester's Open Source Toolkit
Metasploit Toolkit for Penetration Testing
Netcat Power Tools
cd1zz
Recruiters
Hero Member
Offline
Posts: 561
Re: Finding the right exploit
«
Reply #3 on:
January 10, 2013, 10:59:08 PM »
Whenever I see 445 open and the box is XP ish... I always look for 08-067.
To know how the scanner checks for this particular vulnerability you can look at the details of the vulnerability to learn how its triggered. In this case, I cheated and looked at smb-check-vulns.nse, which is an nmap script.
On line 130 of the script you see "---Check if the server is patched for MS08-067. This is done by calling NetPathCompare with an -- illegal string. If the string is accepted, then the server is vulnerable; if it's rejected, then -- you're safe (for now). "
In the code you see what he does to check for 08-067 and it begins to makes sense...
-- Call netpathcanonicalize
-- status, netpathcanonicalize_result = msrpc.srvsvc_netpathcanonicalize(smbstate, host.ip, "\\a", "\\test\\")
local path1 =
"\\AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\..\\n"
local path2 = "\\n"
status, netpathcompare_result = msrpc.srvsvc_netpathcompare(smbstate, host.ip, path1, path2, 1, 0)
-- Stop the SMB session
msrpc.stop_smb(smbstate)
if(status == false) then
if(string.find(
netpathcompare_result, "UNKNOWN_57") ~= nil) then
return true, INFECTED
elseif(string.find(netpathcompare_result, "INVALID_NAME") ~= nil) then
return true, PATCHED
else
return true, UNKNOWN, netpathcompare_result
end
end
return true, VULNERABLE
end
Logged
OSCE | OSCP | GXPN | OSWP | CISSP
http://www.pwnag3.com
http://www.networkadminsecrets.com
azmatt
Jr. Member
Offline
Posts: 79
Re: Finding the right exploit
«
Reply #4 on:
January 10, 2013, 11:16:14 PM »
Great question and answers.
Logged
GCFA, GCIH, GSEC, GCFE, CHFI
H1t M0nk3y
Hero Member
Offline
Posts: 865
Re: Finding the right exploit
«
Reply #5 on:
January 11, 2013, 06:30:03 AM »
Thank you for your answers, lorddicranius, Grendel and cd1zz!
@cd1zz: I have read the nse script and you are right, it is very obvious when you cheat!
From lorddicranius:
Quote
I think the clues to try this exploit are the OS and that port 445 is open.
From cd1zz:
Quote
Whenever I see 445 open and the box is XP ish... I always look for 08-067.
That's what I was thinking. If you don't have access to a vulnerability scanner, but only nmap without the .nse scripts, it's pretty tough to find an exploit unless you have already used it or seen it before.
In my original post, I mentioned:
Quote
This host was so full of holes that I could have probably used many other exploits (Nessus found 22 red ones...)
So let's say MS08-067 is patched and you can't use Nessus, OpenVAS, or any nmap scripts. The approach has to be that, based on experience, you would do like Grendel mentioned and first look at the OS, the open ports and the services fingerprints.
But still, for example, it's one thing to see that Apache 1.2.3 is running an find an exploit for it (quite easy), but in my example above, you have to know about it...
So here's what I will do from now on: use these vulnerability scanners in the lab and whenever I can to find the vulnerabilities, but instead of just running the corresponding exploit and forget about it, I will take very, very good notes and add it to my toolbox.
Again, other than when the service is very well documented (like in my Apache 1.2.3 example), I am just afraid of the times when I won't be able to use a scanner. Getting something like this:
Code:
OS: Microsoft Windows 2003 SP2
PORT STATE SERVICE VERSION
------------------------------------------------------------------
1035/tcp open msrpc Microsoft Windows RPC
It will be tough to find the exploit I have never used...
Logged
OSCP, GPEN, GWAPT, GSEC, CEH, CISSP
impelse
Hero Member
Offline
Posts: 565
Re: Finding the right exploit
«
Reply #6 on:
January 11, 2013, 08:14:44 AM »
In my case in the lab I make sure the OS and version of the service in that port, and then I begin to look for the vulnerability and begin to test one by one.
Logged
CCNA, Security+, 70-290, 70-291
CCNA Security
Taking Hackingdojo training
Website:
http://blog.thehost1.com/
3xban
Hero Member
Offline
Posts: 608
Re: Finding the right exploit
«
Reply #7 on:
January 13, 2013, 08:52:50 PM »
I like the way you think H1t M0nk3y! It's one thing to scan and assume but a whole other thing to test beyond that of the scanner. Sometimes a scanner like Nessus may just guess at the vulnerability by factoring what it does know. But other times it sends test data, I've personally seen this when I ran it against some public facing Web App servers. I turned on the Web App Testing setting and then reviewed the results. Basically it did the quick tests for XSS and SQLi where appropriate. Not enough to break anything but, like nmap, just a quick sample request to see if the vulnerability exists. Other results you see it makes its decision based on OS, service version etc..
Logged
Certs: GCWN
(@)Dewser
ajohnson
Recruiters
Hero Member
Offline
Posts: 1060
aka dynamik
Re: Finding the right exploit
«
Reply #8 on:
January 15, 2013, 09:48:09 PM »
Then you're going to need to obtain as much information about the system and services as you can and do some research at the National Vulnerability Database, Open Source Vulnerability Database, ExploitDB, within Metasploit, Google, etc. You might not be able to pinpoint an exact match and will have to take a trial-and-error approach with several potential exploits.
Logged
WIP: GCFA |
www.infosiege.net
| @infosiege
The day you stop learning is the day you start becoming obsolete.
H1t M0nk3y
Hero Member
Offline
Posts: 865
Re: Finding the right exploit
«
Reply #9 on:
January 16, 2013, 08:06:37 AM »
Quote from: ajohnson on January 15, 2013, 09:48:09 PM
Then you're going to need to obtain as much information about the system and services as you can and do some research
That's what I have been doing more lately.
Quote from: ajohnson on January 15, 2013, 09:48:09 PM
You might not be able to pinpoint an exact match and will have to take a trial-and-error approach with several potential exploits.
Yes, that's why very short contracts to perform pentests on many hosts requires vulnerability scanners. Otherwise, you need lots of experience (and there is always something new!) or lots of time...
Logged
OSCP, GPEN, GWAPT, GSEC, CEH, CISSP
Pages: [
1
]
Go Up
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
EH-Net
-----------------------------
=> Calendar Of Events
===> ChicagoCon 2007
===> ChicagoCon 2008s
===> ChicagoCon 2008f
===> ChicagoCon 2009s
=> Ethical Hacktivism
=> News Items and General Discussion About EH-Net
===> Greetings
=> Special Events
-----------------------------
Ethical Hacking Discussions and Related Certifications
-----------------------------
=> General Certification
===> Networking
===> OS
===> Security
=> Compliance, Regulations & Standards
=> Control Systems
=> Cyber Warfare
=> Forensics
===> CCE / MCCE - (Master) Certified Computer Examiner
===> CHFI - Computer Hacking Forensic Investigator
===> EnCE - EnCase® Certified Examiner
===> GCFA - GIAC Certified Forensics Analyst
=> Hardware
=> Incident Response
===> CSIH - Computer Security Incident Handler
===> GCIH - GIAC Certified Incident Handler
=> Malware
===> Advisories
=> Mobile
=> Network Pen Testing
===> CEH - Certified Ethical Hacker
===> CPTC - Certified Penetration Testing Consultant
===> CPTE - Certified Penetration Testing Engineer
===> CSTA - Certified Security Testing Associate
===> eCPPT - eLearnSecurity Certified Professional Penetration Tester
===> ECSA - EC-Council Certified Security Analyst
===> GPEN - GIAC Certified Penetration Tester
===> OSCP - Offensive Security Certified Professional
=> Physical Security
=> Programming
=> Social Engineering
=> Web Applications
=> Wireless
===> CWNP Certs
===> GAWN - GIAC Assessing Wireless Networks
===> OSWP - Offensive Security Wireless Professional
=> Other
-----------------------------
Columns
-----------------------------
=> Editor-In-Chief
=> Andress
=> Gates
=> Haddix
=> Hadnagy
=> Heffner
=> Hoffman
=> Linn
=> RichM
=> Murray
=> J. Peltier
=> Weidman
=> Wilson
-----------------------------
Features
-----------------------------
=> /root
=> Book Reviews
=> Opinions
=> Skillz
===> Examples
===> May 06 - Star Hacks, Episode V: The Empire Hacks Back
===> July 06 - Hack Bill!
===> Sept 06 - Netcat in the Hat
===> Nov 06 - Hitch-Hackers Guide to the Galaxy
===> Dec 06 - A Christmas (Hacking) Story
===> Feb 07 - Charlottes Web Site
===> April 07 - Microsoft Office Space
===> June 07 - Serenity Hack
===> Oct 07 - Worst. Ethical. Hacker. Challenge. Ever.
===> Dec 07 - Frosty the Snow Crash
===> March 2008 - It Happened One Friday
===> Oct 2008 - Scooby Doo and the Crypto Caper
===> Dec 08 - Santa Claus Is Hacking to Town
===> Feb 2009 - Brady Bunch Boondoggle
===> July 2009 - Prison Break
===> October 2009 - SSHliders
===> December 2009 - Miracle on Thirty-Hack Street
===> December 2010 - The Nightmare Before Charlie Browns Christmas
-----------------------------
Resources
-----------------------------
=> Career Central
===> Looking For Work
===> Looking To Hire
=> Links to cool sites.
=> Mass Media
=> News from the Outside World
=> Tools
=> Tutorials
===> Tutorial Requests
Loading...
Exclusive Deal
SANSFIRE 2013
June 15 - 22
5% Off
w/ Code
:
EHN_5
SANS Deals 4 EH-Netters
5% OFF
Any
SANS Course
in Any Format!
Coupon Code:
EHN_5
Including
SANS Rocky Mountain 2013
&
SANS Boston 2013
Polls
Compared to this year, 2013 will be:
Great!
Better.
About the same.
Little worse.
FUBAR!
Recent Forum Topics
News Items and General Discussion About EH-Net
: Fashion Advice To Assist You Boost Your Style
(0) by
exeldinooxilk
News Items and General Discussion About EH-Net
: Change is Coming to EH-Net!!
(30) by
don
Tools
: Symbolic Exploit Assistant project is looking for collaborators
(0) by
galapag0
Greetings
: Hi from the UK
(5) by
prats84
GCIH - GIAC Certified Incident Handler
: Passed my GCIH
(9) by
prats84
Network Pen Testing
: Want a challenge? Want a GXPN practice exam?
(0) by
ajohnson
GCIH - GIAC Certified Incident Handler
: GCIH Free Practice test attempt
(1) by
prats84
EH-Net News Feeds
Latest Additions
Privacy Notice
for TDCC & All Properties
Free Business and Tech Magazines and eBooks
© 2013 The Ethical Hacker Network
Joomla!
is Free Software released under the GNU/GPL License.