Image
 
linkedin_logo.png rss_logo.jpg
twitter_logo.png youtube_logo.jpg
Latest Additions
 
EH-Net Login
Welcome Guest.






Lost Password?
No account yet? Register
Who's Online
We have 92 guests and 3 members online
EH-Net News Feeds
Latest Additions
 
Advertisement

You are here: Home arrow Forum arrow Ethical Hacking Discussions and Related Certificationsarrow Network Pen Testingarrow Scanning question
EH-Net
May 26, 2012, 08:00:00 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Advertise on EH-Net!! - Reasonable Rates, Highly Targeted Audience.
 
   Home   Help Calendar Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Scanning question  (Read 1616 times)
0 Members and 1 Guest are viewing this topic.
SephStorm
Sr. Member
****
Offline Offline

Posts: 416


View Profile WWW
« on: October 27, 2011, 07:44:04 PM »

Hi all,

Just a little backround, I knew that at some point, I wanted to pentest my network from the outside, as well as the inside. So I figured, why not start today? Now I dont have another network to jump onto, but I decided to scan my network to see if I could do it, ect.

Now correct me if im wrong, but if I were scanning a corperate network, I would find the external network via recon, and find the netblocks, ect. You would query DNS servers to try to enumerate internal hosts/ranges. I have never really understood though, how do you scan those hosts? They are likely NAT'ed and you cant scan the internal IPs from the internet. So I figured, you scan the public IP.

Which is exactly what I did. I got the WAN IP from the router and began throwing NMAP scans at it. Unfortunately, nothing seems to be getting through. scans come back filtered each time. So just for kicks, I disabled the firewall on the router, same result. Any ideas whats going on? Is my understanding of the process wrong? I intend to use Firewalk to test the rules, but I havent done it yet.
Logged

SephStorm
Sr. Member
****
Offline Offline

Posts: 416


View Profile WWW
« Reply #1 on: October 29, 2011, 03:23:40 PM »

 Shocked I didnt realize this would be so difficult to answer. Any advice at all?
Logged

pseud0
Recruiters
Full Member
*
Offline Offline

Posts: 204



View Profile
« Reply #2 on: October 29, 2011, 04:47:23 PM »

Can you clarify some points?  I think your question is causing some confusion.

-Are you trying to scan your external IP from within your network? Example: your internal network is something like 192.168.x.x and the IP your ISP assigned to your cable modem is something like 60.70.80.90, your testing machine is sitting on your internal network and you're trying to scan that 60.70.80.90 address?

-On the router, did you have any listening services setup (eg. an ssh management interface on port 22, a web interface on port 80, etc) or any type of port forwarding to a system in your internal network?
Logged

CISSP, CISM, CISA, GCIH, CEH, HMFIC, KTHXBIROFLCOPTER
SephStorm
Sr. Member
****
Offline Offline

Posts: 416


View Profile WWW
« Reply #3 on: October 29, 2011, 07:59:53 PM »

Yes, that is what im trying to do. Smiley

And no, I have no services listening at the network border yet.
Logged

pseud0
Recruiters
Full Member
*
Offline Offline

Posts: 204



View Profile
« Reply #4 on: October 30, 2011, 02:47:53 PM »

To put it mildly, you're going to have some problems mainly because of routing.  Networking devices will all act a bit differently, but in many cases a home router will have issues when you try to pull this off.  When your packets are moving across your network from your testing machine to find your external IP address, it will hit that router and ask for the next hop in finding that external IP. Since your router is performing NAT duties, it is aware that it has one IP range on one interface, and another IP range on the other interface.  Now think about it from the router's point of view.  It has a packet showing up asking for IP 60.70.80.90, and the router goes "hey, I'm 60.70.80.90."  It generally isn't going to send your packet out into the intergoogle just to have another system send it back to the external interface.  The rules on how it handles traffic like this will vary depending on the device.  I've seen some that will act the way you want and allow you to scan the external interface by doing something like a loopback. I've seen others that will act like they are letting the scan happen but don't actually let any of the packets through.  I've seen several (including one of mine that is running dd_wrt) that will perform the scan on the internal interface.  You can do a sanity check by running a traceroute from your testing computer to your external IP.  How many hops do you see?  That should give you a hint as to how the router is handling it.

On a side note, if you're seeing every port coming up as closed or filtered then I wouldn't be surprised since you're not running any services or port forwarding.  Think about it.  There aren't any services listening for your scan to find.  Many home routers are more secure than you think because they are so dumb/minimal that there isn't a lot of surface area for an attacker to go after. 
Logged

CISSP, CISM, CISA, GCIH, CEH, HMFIC, KTHXBIROFLCOPTER
MaXe
Hero Member
*****
Online Online

Posts: 507


I've just upgraded myself to a cyborg muahahaa!!1


View Profile WWW
« Reply #5 on: October 30, 2011, 03:29:08 PM »

God damn my browser and touchpad.. I had just written a very long and detailed reply...  Roll Eyes Oh well, I will write some of it again and exclude other parts that pseud0 covered.


There are multiple ways to scan an internal network from the outside, but it isn't always easy. This is what I'd call breaking the perimeter defense.

Imagine a router with a webserver in a DMZ, which is the only host allowed to reach the internal network where a SQL database is hosted. The webserver has an Internet IP-address, where the SQL database has an internal LAN IP-address.

The router has SSH, HTTP and SNMP services open and these are not firewalled in this case, even though they are in most cases by default nowadays.

The router itself, has NAT enabled and is handling this, and it also forwards any FTP connections to port 21 externally, to another host internally.

A firewall could be enabled in this case, but let's say it is misconfigured.


From this case study, I'd say we have a good chance of breaking into the internal network. I will quote sections of what I've just wrote, to make each possible way of attack more easy to distinguish.

Before I begin, I should mention that in this case, the external IP-address of the router is 60.70.80.90, and that the internal IP-address space is 192.168.0.0/24 (CIDR), and the router is handling NAT.

Case 1:
Quote
The router itself, has NAT enabled and is handling this, and it also forwards any FTP connections to port 21 externally, to another host internally.

So, if you make a connection to port 21 on 60.70.80.90, it will be forwarded by the router to 192.168.0.2 (port 21). From here, you can try to hack the FTP service, with e.g., a buffer overflow, and gain high enough privileges to install perhaps NMAP on this host, and scan the rest of the internal network.

Somewhat irrelevant to this case study, is also the FTP Bounce Scan that may interest you: http://nmap.org/nmap_doc.html


Case 2:
Quote
The router has SSH, HTTP and SNMP services open and these are not firewalled in this case, even though they are in most cases by default nowadays.

So, we've identified these three services on the target router. What good could come out from hacking them? Well, on some routers we could use port forwarding to scan the individuals hosts, or try to put them in DMZ's, where the last option is not really a good idea if it's a real pentest. If the router supports VPN, you could potentially setup a VPN connection to the internal network if you've compromised the network, or for that sake do Man-in-the-Middle attacks in some cases too.

The easiest service in most cases to compromises, is the HTTP service. Many routers implementing HTTP servers, are often vulnerable to known attacks, or they're misconfigured so they use default credentials easily guessable. (Most manuals include the default passwords too.) You could therefore try buffer overflow attacks, password attacks, and other attacks related to web application security. If you compromise the HTTP service, you could reconfigure the router to as previously set, create VPN tunnel which would allow you to connect to the internal network.

About the SSH service, you could try default credentials too, password (bruteforce) attacks, and even overflow attacks too.

If the SNMP service is available, you could try a very interesting attack, which I think everyone should read about if they don't know about it already: http://www.symantec.com/connect/articles/cisco-snmp-configuration-attack-gre-tunnel

It's probably one of the coolest attacks I've seen and played with, and it does actually work  Grin This type of attack, can reconfigure the router and I think, will even allow you to upload new firmware too, which you should be extremely careful with, but it could potentially allow you to use other features not allowed by default in the router.


Case 3:
Quote
Imagine a router with a webserver in a DMZ, which is the only host allowed to reach the internal network where a SQL database is hosted. The webserver has an Internet IP-address, where the SQL database has an internal LAN IP-address.

In this case, which is actually quite common, you would compromise the webserver, perhaps with SQL injection, and then you would compromise the SQL server, let's say it's a MSSQL server, that allows xp_cmdshell, which in return allows you to run commands such as downloading and executing a meterpreter executable, perhaps via the tftp client in windows. ( xp_cmdshell reference: http://msdn.microsoft.com/en-us/library/ms175046.aspx )


Case 4:
Let's say the router has a wireless interface, and that it's on a different network (192.168.1.0/24), but that it is able to reach 192.168.0.0/24. The encryption method used is WEP, so you use one of the common attacks, break into the wireless network, associate yourself with the Access Point, and start scanning the other network.


Case 5:
Okay, everything is secure on the router and hosts in DMZ in this case, you've tried everything, nothing works. What do you do? Social Engineering of course!

The easiest example being sending an e-mail to a user, who downloads and executes a trojan, which gives you access to the internal network. You could also try to exploit the e-mail server in case it is behind the router, the actual e-mail client of the server, or make the user run a java applet, that functions like a trojan.

You could also try to port scan the internal network with some smart javascript and HTML, which then relays the results to you. References:
http://blog.andlabs.org/2010/12/port-scanning-with-html5-and-js-recon.html and http://www.andlabs.org/tools/jsrecon.html

Of course, the last type of attack would have to be customized to work most likely, but since javascript runs locally, it should be possible theoretically if the browser allows this.



That's pretty much all of the best advise I can give you, I've written pretty much all of the ways I can think of right now, that will make you able to scan the internal network  Cool (I think the "cool smiley" is deserved to be used in this case after using more than half an hour or more writing this reply hehe  Grin )
Logged

I'm an InterN0T'er
SephStorm
Sr. Member
****
Offline Offline

Posts: 416


View Profile WWW
« Reply #6 on: October 30, 2011, 04:26:12 PM »

Lol, wow guys. I figured id have to do something like number 5. I just didnt realize that most hosts just arent open and ready for the taking! I guess the world would be a lot safer without social engineering and people going to exploited web pages...
Logged

Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines
Joomla Bridge by JoomlaHacks.com
Valid XHTML 1.0! Valid CSS!
Page created in 0.087 seconds with 22 queries.
 

gk_static-ad_feb2012.jpg
Global Knowledge: Build Security Skills to Protect & Defend

els_130x200fixed2.gif
eLearnSecurity Student Course Now Live!
5% Off with Code
ELS-EH-5

SANS Deals 4 EH-Netters
$150 OFF Any SANS Course in Any Format!
Coupon Code: EHN_Connect Including SANS Security West 2012 & SANSFIRE 2012
Recent Forum Topics

cbtnuggets_logo_125.jpg
Try CBT Nuggets Free!

Vote For EH-Net

Add to Technorati Favorites
technorati fave

 
         
Advertisement

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