{"id":97,"date":"2010-08-27T23:30:30","date_gmt":"2010-08-27T22:30:30","guid":{"rendered":"http:\/\/blogs.silicontechnix.com\/?p=97"},"modified":"2010-08-28T01:47:04","modified_gmt":"2010-08-28T00:47:04","slug":"8-steps-to-protect-your-cisco-router","status":"publish","type":"post","link":"https:\/\/blogs.silicontechnix.com\/?p=97","title":{"rendered":"8 steps to protect your Cisco router"},"content":{"rendered":"<p>Network security is a completely changing area; new devices like IDS (Intrusion<br \/>\nDetection systems), IPS (Intrusion Prevention systems), and Honeypots are modifying the<br \/>\nway people think about security. Companies are spending thousand of dollars on new<br \/>\nsecurity devices, but forgetting the basic, the first line of defense: the border router.<\/p>\n<p>Although a lot of people may think that routers don\u2019t need to be protect, they are<br \/>\ncompletely wrong. A lot of secure problems appear all time against this kind of device<br \/>\nand most of them are vulnerable.<!--more--><\/p>\n<p>In this article I will give you 8 steps, easy to follow, to minimize your Cisco router<br \/>\nexposure by turning off some unused services, applying some access control and<br \/>\napplying some security options available on that.<\/p>\n<p><strong>1- Control Access to your router;<br \/>\n2- Restrict telnet access to it;<br \/>\n3- Block Spoof\/Malicious packets;<br \/>\n4- Restrict SNMP;<br \/>\n5- Encrypt all passwords;<br \/>\n6- Disable all unused services;<br \/>\n7- Add some security options;<br \/>\n8- Log everything;<\/strong><\/p>\n<p><strong>1- Control Access to your router<\/strong><\/p>\n<p>The first thing to do is apply some rules to restrict all external access to some ports of the<br \/>\nrouter. You can block all ports, but it is not always necessary. These commands bellow<br \/>\nwill protect your router against some reconnaissance attacks and, obviously, will restrict<br \/>\naccess to these ports:<\/p>\n<p>access-list 110 deny tcp any host $yourRouterIP eq 7<br \/>\naccess-list 110 deny tcp any host $yourRouterIP eq 9<br \/>\naccess-list 110 deny tcp any host $yourRouterIP eq 13 access-list 110 deny tcp any host $yourRouterIP eq 19<br \/>\naccess-list 110 deny tcp any host $yourRouterIP eq 23<br \/>\naccess-list 110 deny tcp any host $yourRouterIP eq 79<br \/>\nint x0\/0<br \/>\naccess-group in 110<\/p>\n<p>Where $yourRouterIP is your router IP and x0\/0 is your external interface. We<br \/>\nWill always use this convention in this article.<\/p>\n<p>2- <strong>Restrict telnet access to it<\/strong><\/p>\n<p>Telnet is not a very safe protocol to use, but if you really need to use it (you should<br \/>\nalways use ssh) you might want to restrict all access to it (remember that all your traffic<br \/>\nwill be unencrypted). The best way to accomplish that is using a standard access-list and<br \/>\nthe access-class command.<\/p>\n<p>access-list 50 permit 192.168.1.1<br \/>\naccess-list 50 deny any log<br \/>\nline vty 0 4<br \/>\naccess-class 50 in<br \/>\nexec-timeout 5 0<\/p>\n<p>Where 192.168.1.1 is the IP address allowed to telnet the router<\/p>\n<p>3- <strong>Block Spoof\/Malicious packets<\/strong><\/p>\n<p>You must never allow loopback\/reserved IP address from the Internet reach your external<br \/>\ninterface and you can reject broadcast and multicast addresses too.<\/p>\n<p>access-list 111 deny ip 127.0.0.0 0.255.255.255 any<br \/>\naccess-list 111 deny ip 192.168.0.0 0.0.0.255 any<br \/>\naccess-list 111 deny ip 172.16.0.0 0.0.255.255 any<br \/>\naccess-list 111 deny ip 10.0.0.0 0.255.255.255 any<br \/>\naccess-list 111 deny ip host 0.0.0.0 any<br \/>\naccess-list 111 deny ip 224.0.0.0 31.255.255.255 any<br \/>\naccess-list 111 deny icmp any any redirect<br \/>\nint x0\/0<br \/>\naccess-group in 111<\/p>\n<p>4- <strong>Restrict SNMP<\/strong><br \/>\nSNMP must always be restrict, unless you want some malicious person getting a lot of<br \/>\ninformation from your network ?<\/p>\n<p>access-list 112 deny udp any any eq snmp<br \/>\naccess-list 112 permit ip any any<br \/>\ninterface x0\/0<br \/>\naccess-group 112 in<\/p>\n<p>And if you are not going to use SNMP at all, disable it:<\/p>\n<p>no snmp-server<\/p>\n<p>5- <strong>Encrypt all passwords<\/strong><\/p>\n<p>A very important thing to do is protect all your passwords using the powerful algorithm<br \/>\nas possible.<br \/>\nThe password from exec mode, that grants privileged access to the IOS system,<br \/>\nCan be set using a MD5 hash, which is the strongest option available on the<br \/>\nCisco IOS.<\/p>\n<p>enable secret $yourpassword<\/p>\n<p>All other passwords, you can encrypt using the Vigenere cipher that is not<br \/>\nVery strong, but can help. To do that, you can use the service password-encryption<br \/>\nCommand that encrypts all passwords present in you system.<\/p>\n<p>service password-encryption<\/p>\n<p>6- <strong>Disable all unused services<\/strong><\/p>\n<p>6.1 &#8211; <strong>Disable Echo, Chargen and discard<\/strong><\/p>\n<p>no service tcp-small-servers<br \/>\nno service udp-small-servers<\/p>\n<p>6.2 &#8211; <strong>Disable finger<\/strong><\/p>\n<p>no service finger<\/p>\n<p>6.3 &#8211; <strong>Disable the httpd interface<\/strong><br \/>\nno ip http server<\/p>\n<p>6.4 &#8211; <strong>Disable ntp (if you are not using it)<\/strong><\/p>\n<p>ntp disable<\/p>\n<p><strong>7- Add some security options<\/strong><\/p>\n<p><strong>7.1 &#8211; Disable source routing<\/strong><\/p>\n<p>no ip source-route<\/p>\n<p><strong>7.2 &#8211; Disable Proxy Arp<\/strong><\/p>\n<p>no ip proxy-arp<\/p>\n<p><strong>7.3 &#8211; Disable ICMP redirects<\/strong><\/p>\n<p>interface s0\/0 (your external interface)<br \/>\nno ip redirects<\/p>\n<p><strong>7.4 &#8211; Disable Multicast route Caching<\/strong><\/p>\n<p>interface s0\/0 (your external interface)<br \/>\nno ip mroute-cache<\/p>\n<p><strong>6.5 &#8211; Disable CDP<\/strong><\/p>\n<p>no cdp run<\/p>\n<p><strong>6.6 &#8211; Disable direct broadcast (protect against Smurf attacks)<\/strong><\/p>\n<p>no ip directed-broadcast<\/p>\n<p><strong>8- Log everything<\/strong><\/p>\n<p>To finish, you must log everything on an outside Log Server. You must everything from<br \/>\nall your systems and always analyze the logs.<\/p>\n<p>logging trap debugging<br \/>\nlogging 192.168.1.10<br \/>\nwhere 192.168.1.10 is the ip of your log server (configured as a Syslog server)<\/p>\n<p><strong>Conclusion<\/strong><\/p>\n<p>With these simple steps you can add a lot of security to your router, protecting it against a<br \/>\nlot of possible attacks, increasing your network security.<\/p>\n<p>Only as an example, you can see the nmap result before and after applying these options:<\/p>\n<p>Before:<\/p>\n<p>bash-2.05b# nmap -O 192.168.1.1<\/p>\n<p>Starting nmap V. 3.00 ( <a href=\"http:\/\/www.insecure.org\/nmap\/\">www.insecure.org\/nmap\/<\/a> )<br \/>\nInteresting ports on (192.168.1.1):<br \/>\nPort State Service<br \/>\n7\/tcp open echo<br \/>\n9\/tcp open discard<br \/>\n13\/tcp open daytime<br \/>\n19\/tcp open chargen<br \/>\n23\/tcp open telnet<br \/>\n79\/tcp open finger<br \/>\n80\/tcp open http<br \/>\nRemote OS guesses: AS5200, Cisco 2501\/5260\/5300 terminal server IOS 11.3.6(T1),<br \/>\nCisco IOS 11.3 &#8211; 12.0(11)<\/p>\n<p>After:<\/p>\n<p>bash-2.05b# nmap -P0 -O 192.168.1.1<\/p>\n<p>Starting nmap V. 3.00 ( <a href=\"http:\/\/www.insecure.org\/nmap\/\">www.insecure.org\/nmap\/<\/a> )<br \/>\nWarning: OS detection will be MUCH less reliable because we did not find at least 1<br \/>\nopen and 1 closed TCP port<br \/>\nAll 1601 scanned ports on (192.168.1.1) are: filtered<br \/>\nToo many fingerprints match this host for me to give an accurate OS guess<\/p>\n<p>Nmap run completed &#8212; 1 IP address (1 host up) scanned in 403 seconds<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Network security is a completely changing area; new devices like IDS (Intrusion Detection systems), IPS (Intrusion Prevention systems), and Honeypots are modifying the way people think about security. Companies are spending thousand of dollars on new security devices, but forgetting the basic, the first line of defense: the border router. Although a lot of people [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_s2mail":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[16],"tags":[32,479,33,34,480],"class_list":["post-97","post","type-post","status-publish","format-standard","hentry","category-networking","tag-cisco","tag-networking","tag-nmap","tag-os-finger-printing","tag-security"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p12j6H-1z","_links":{"self":[{"href":"https:\/\/blogs.silicontechnix.com\/index.php?rest_route=\/wp\/v2\/posts\/97","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.silicontechnix.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.silicontechnix.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.silicontechnix.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.silicontechnix.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=97"}],"version-history":[{"count":5,"href":"https:\/\/blogs.silicontechnix.com\/index.php?rest_route=\/wp\/v2\/posts\/97\/revisions"}],"predecessor-version":[{"id":104,"href":"https:\/\/blogs.silicontechnix.com\/index.php?rest_route=\/wp\/v2\/posts\/97\/revisions\/104"}],"wp:attachment":[{"href":"https:\/\/blogs.silicontechnix.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=97"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.silicontechnix.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=97"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.silicontechnix.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=97"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}