Image
 
Latest Additions
 
EH-Net Login
Welcome Guest.






Lost Password?
No account yet? Register
Who's Online
We have 12 guests and 1 member online
EH-Net Donations

Enter Amount:
$

Google Ads
EH-Net News Feeds
Latest Additions
Book Recommendations





 
Advertisement

You are here: Home arrow Forum arrow Ethical Hacking Discussions and Related Certificationsarrow Network Pen Testingarrow Bypassing Firewalls with simple scans
Ethical Hacker Community Forums
November 22, 2008, 04:22:25 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: ChicagoCon 2-Day Ethical Hacking Conference with MS Blue Hats Oct 31 - Nov 1. Tickets Only $100! www.chicagocon.com/content/view/103/51/
 
   Home   Help Calendar Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Bypassing Firewalls with simple scans  (Read 3518 times)
0 Members and 1 Guest are viewing this topic.
Kev
Guest
« on: June 27, 2007, 03:08:25 PM »

What is one of the first things to do in a ethical hack?  Ec-council suggests information gathering. While that is very true, that is becoming less requested. Usually you are given your target information from the get go. Seems like more and more organizations want you to get right to it and dont want to spend money on what they perceive  as "extras".  A good place to start is to inspect the firewall rules of your target. There are some simple tests to do right at the start. These tests are old school and work mostly if its an improperly configured iptables firewall.

Depending on the test enviroment, we are not going to be too worried about being stealth, so we will begin with the traditional traceroute or tracert command to the target. Simply "traceroute victims ip."  This in return should give you a return of astericks. This usually is a sign that the firewall is preventing packets from leaving the target. This is normal because most firewalls filter diagnostic ICMP packets.

 We attempt to "fool" the firewall by using TCP packets and Hping2 is great for that. We enter "hping2 -T -t 1 -S -p 80 victims IP"  With a little luck we get a response. 

 The next scans we perform are with nmap.  For a fast scan we use nmap -sS -F -n -O victimsIP. We might try just a simple test of the firewall rules with "nmap -v -sA -ff -r -n victimsIP" If we have the time and this can sometimes take an hour or so but is very complete, we use nmap -v -g53 -sS -sR -P0 -O -p1-65000 -o nmap.out victimsIP.  I like the -g switch, which lets you set the source port.  You can test for misconfigured rules that allow packets based on source ports, such as ftp data (port 20), dns lookups (port 53) or return http traffic (port 80). This is an important scan because one mistake many administrators make when creating rules for allowing traffic through their firewall is to trust traffic based simply on its source port number, such as DNS replies from port 53 or FTP from port 20.   Other switches I like are -sA and -PO for firewall scanning. If you are trying to avoid IDS logging, use the default -rH, which is a randomized port order. This, combined with slow timing options, will make network monitoring hard to detect the scan. As an example we might try, nmap -sS --scan-delay 500 -f -rH victimsIP.

 We might even be able to slip through if the organization  has devices connecting to the internet. This scan will test for devices like routers, printers,switches,etc.. map -vv -sS -O -n victimsIP/24 -oA inventory. With a little luck you might get an inventory of devices.

Ok now that we have managed to discover active ports we might be able to breach the server with a simple tool like Fpipe with fpipe -l 53 -s 53 -r 80 victimsIP. Its rare to work but when it does its sweet because it can be shocking to an organization when they have just implemented their new shiny firewall that was never configured to be breached by a couple of free tools.
 
The idea of these scans is to test for misconfigured firewalls. If the rules are in place correctly we wont get results. Auditing the firewall is a very crucial and good first place to start your ethical hacking session.
« Last Edit: June 27, 2007, 03:15:17 PM by Kev » Logged
BiotiC
Newbie
*
Offline Offline

Posts: 15


View Profile
« Reply #1 on: June 27, 2007, 04:06:45 PM »

Great post Kev - succinct and to the point. Food for thought.

One for my little black book.

Thanks
Logged
blackazarro
Full Member
***
Offline Offline

Posts: 221



View Profile
« Reply #2 on: June 27, 2007, 05:47:16 PM »


Awesome tutorial, thanks Kev. This scans will work for misconfigured packet filter firewalls. To mitigate this problem use a well configured stateful or proxy firewall. Because stateful firewalls keep track of the state of network connections, using these simple scans will usually not work.
Logged

Security+, OSCP, CEH
jimbob
Sr. Member
****
Offline Offline

Posts: 307



View Profile WWW
« Reply #3 on: June 28, 2007, 03:09:20 AM »

Good stuff Kev. Even some well configured firewalls will often send TTL expired messages in response to a good TCP traceroute. hping is one of the tools that seems to get the least hype and does a whole host of tricks. Perhaps the prerequisite knowledge needed to use it well is a barrier to its use.... I feel a cheat sheet idea coming on :-)

Jim
Logged
Negrita
Sr. Member
****
Offline Offline

Posts: 289



View Profile
« Reply #4 on: June 28, 2007, 05:02:42 AM »

Nice tutorial. Kudos to Kev (and also to Fyodor and Antirez).
Logged

CEH, CCSA NG/AI, NNCSS, MCP, MCSA 2003

There are 10 kinds of people, those that understand binary, and those that don't.
ChrisG
EH-Net Columnist
Hero Member
*****
Offline Offline

Posts: 1038


View Profile WWW
« Reply #5 on: June 28, 2007, 09:18:25 AM »

great post.  working  hard for that ticket to blackhat :-)


good part on the source port scanning, might be a good idea to script that to shove in commonly allowed ports besides the 3 your mentioned to let that run and come back later and check the results

Logged

...tests i took go here...

http://carnal0wnage.blogspot.com/
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC
Joomla Bridge by JoomlaHacks.com
Valid XHTML 1.0! Valid CSS!
Page created in 0.046 seconds with 23 queries.
 
Sponsors

cwnp_moto__120x90.gif

Polls
During the most recent election, I:
 
Support EH-Net


Support EH-Net by
Buying all of your
Amazon items using
the search bar above.

cbtnuggets_logo_125.jpg
Try CBT Nuggets Free!
Recent Forum Topics
Vote For EH-Net

progenic.com
Click here to Vote!

Sadikhov.com
Top IT Cert Sites

binarica.com
Binarica Logo

Add to Technorati Favorites
technorati fave

 
         
Advertisement

© 2008 The Ethical Hacker Network
Joomla! is Free Software released under the GNU/GPL License.