Enigma Group's Hacking Forum



User Info
Welcome, Guest. Please login or register.
May 18, 2012, 07:52:45 AM

Login with username, password and session length
Search:     Advanced search
News
Mission Problems? Read up on things that can go wrong.
Forum Stats
33912 Posts in 4171 Topics by 38418 Members
Latest Member: cbbyfhxcax
Enigma Group's Hacking Forum  |  Hacking  |  Network Security  |  CAM Table Overflow - Part I - Exploitation
« previous next »
Pages: [1] Print
Author Topic: CAM Table Overflow - Part I - Exploitation  (Read 2624 times)
haZed
Administrator
Elite
*****
Offline Offline

Posts: 1709
  • Respect: +1


  • ::1/128

    Hakipedia
    « on: December 11, 2008, 10:45:13 AM »
    0

    The CAM table of a switch stores layer 2 network information including MAC addresses and VLAN parameters. When a sudden inundation of MAC address are sent to the switch, a CAM Table Overflow may occur if the table reaches it's address threshold. If the CAM Table is overflowed, the switch becomes jammed and acts like a hub, spewing out packets all over the local area network. The spewing of packets over the network is limited to the source VLAN. Therefore, if there is a VLAN for each department of an organisation, the flood is segregated to the originating VLAN.

    It is trivial to overflow CAM table with invalid MAC addresses, thus all switches should implement security preventing this. Port Security is enough to prevent this type of attack on a Cisco switch. Port Security can be set to only allow a specified amount of MAC addresses to connect to the switch port over a certain amount of time.

    To overflow a CAM table using a Debian based distribution of GNU/Linux, it's very simple. The standard Debian repositories store the tools needed for a successful attack, and can be easily apt-get'd. To apt-get the required tools, su to root (or sudo) and type the following:

    Quote
    root@nullity:~/# apt-get install ettercap dsniff

    The above will install ettercap to sniff the flooded packets, and will install the dsniff packages--macof is part of the dsniff toolbox, and is the tool used as part of this tutorial.

    As root, launch macof to start the attack:



    Macof will immediately start flooding the network with an infinite number of MAC addresses. To stop the attack, type CTRL+Z.

    Once the CAM Table threshold has been reached, the switch will start flooding packets out of all ports (similar to the behaviour of a hub). To take advantage of this, launch ettercap with ncurses using the following command:

    Quote
    root@nullity:~/# ettercap -C

    Once in ettercap, do the following:
    • Options   => Promiscuous
    • Sniff      => Unified -> eth2 (or whatever your active interface is)
    • Start      => Start Sniffing
    • View      => Statistics

    Ettercap will immediately start sniffing for traffic. If desired, logs can be set and stored as specified. This is ideal for later inspection, and for inspection of traffic that ettercap doesn't flag as interesting.

    If a user logs in to a website from another PC on the network, the data is spewed out all switch ports, making any non-SSL traffic susceptible to reconnaissance attacks:



    If any interesting or flagged traffic is identified by ettercap, it will display it in the "User Messages" display at the bottom of the screen:



    Pwned.

    Any feedback? Questions? Let me know.
    Logged
    Hakipedia: An open collaborative for all your information security
    Follow me on Twitter
    aVoid
    The owner of
    your base~
    -=EGU Elitist=-
    Administrator
    Veteran
    *****
    Online Online

    Posts: 1063
  • Respect: +16


  • whoami

    « Reply #1 on: December 11, 2008, 03:32:20 PM »
    0

    Very interesting read haZed. I have some questions though.

    1.)  What is the MAC address threshold before it overflows? Is this totally switch dependent?
    2.)  What happens if the port security is enabled? Can you set the port security up on that switch and run your tests again and give us a screen shot with it enabled? Do the other PCs have to wait in queue or do they just get denied at every request until there is an opening?
    3.)  What would you say should be the number of MAC addresses allowed to connect to a switch at any given time? Let's say this is a Cisco Catalyst 3560 series.
    4.)  What are the proper steps to take to secure this. I believe this was in another thread if I remember correctly?
    5.)  Is flooding the entire network that beneficial with macof instead of picking the switch itself with -d switch? I would believe flooding the network could cause possible latency issues and lead to detection. Although, there should be other intrusion/detection programs running to detect this kind of attack on networks! =)

    Overall, very nice haZed. I enjoyed it a lot. Keep them coming man!
    Logged
    [11:06] <hackerankit> hi can u teach me facebook hacking
    [11:07] <aVoid> no
    [11:07] <hackerankit> oh then r u on facebook
    [11:07] <aVoid> no
    [11:07] <hackerankit> u r in any socialnetworking site
    [11:07] <aVoid> no
    [11:08] <hackerankit> thats cool........

    [15:03] <psychomarine> I just went out in the yard and beat all the kids asses with my light sabre

    The only difference between a bug and a vulnerability is the intelligence of the attacker.
    torch
    Newbie
    *
    Offline Offline

    Posts: 21
  • Respect: 0

  • « Reply #2 on: December 11, 2008, 04:17:11 PM »
    0

    1. Hardware dependent.
    2. I wonder if he has a Cisco at home.
    3. You might mean a CAM entry; IMHO the more the better. My 5-port ASUS switch has space for 1000 entries, more advanced routers might have 16000 and more.
    4. Buy a switch which can be managed, and refer to the given user manual.
    5. Switches work on layer 2, which means they have no ip adress.
    « Last Edit: December 11, 2008, 04:54:36 PM by torch » Logged
    data
    Sr. Member
    ****
    Offline Offline

    Posts: 386
  • Respect: 0

  • ori

    « Reply #3 on: December 11, 2008, 05:28:58 PM »
    0

    Is this just as effective as something like a MITM attack or even more effective? Why?
    Logged
    torch
    Newbie
    *
    Offline Offline

    Posts: 21
  • Respect: 0

  • « Reply #4 on: December 11, 2008, 06:05:30 PM »
    0

    Both have advantages and disadvantages. A disadvantage of mitm is that it can get really cpu-extensive since your machine will act as a gateway - it has to route all the traffic, which may overload your cpu, and this will cause a network failure. In the switch jamming you only have to sniff for the packets, but I think in order to be succesfull, you shall not stop the mac flood, because after some time CAM entries time out, and therefore the switch returns to its normal function - switching traffic.
    Logged
    haZed
    Administrator
    Elite
    *****
    Offline Offline

    Posts: 1709
  • Respect: +1


  • ::1/128

    Hakipedia
    « Reply #5 on: December 11, 2008, 08:10:57 PM »
    0

    Torch already answered most of the questions, but I'll go through and answer them as well.

    1.)  What is the MAC address threshold before it overflows? Is this totally switch dependent?

    It is totally switch dependent. CAM Table entries are stored in RAM, so if you have a switch with a gigabyte of RAM, it's going to have a much higher threshold than one with 32 megabytes of RAM.



    2.)  What happens if the port security is enabled? Can you set the port security up on that switch and run your tests again and give us a screen shot with it enabled? Do the other PCs have to wait in queue or do they just get denied at every request until there is an opening?

    If port security is enabled and configured properly it can do a number of things, it comes down to how it has been configured. For example, the following will enable port-security on all 24 switchports, and shutdown (and subsequently log) if more than 4 MAC addresses have connected to the port:

    Quote
    (config)# interface range fa0/1 - 24
    (config-if)# switchport port-security
    (config-if)# switchport port-security maximum 4
    (config-if)# switchport port-security violation shutdown

    If a violation does occur and shutdown is used, a log entry is made, and administrative intervention is needed to re-enable the port. This can be done with:

    Quote
    (config)# errdisable recovery cause security-violation

    The other violation options are restrict, and protect. Protect drops packets with unknown source addresses until you remove a sufficient number of secure MAC addresses to drop below the maximum value. Restrict drops packets with unknown source addresses until you remove a sufficient number of secure MAC addresses to drop below the maximum value and causes the SecurityViolation counter to increment.

    I plan to write up a full tutorial on port-security tonight/tomorrow, so I'll get more into there (sticky MAC addresses and fun stuff like that).



    3.)  What would you say should be the number of MAC addresses allowed to connect to a switch at any given time? Let's say this is a Cisco Catalyst 3560 series.

    Depends on the switch port. If a port is connected to a file server, it should have a sticky MAC address set, whereas if it's connected to a wireless access-point, up to a couple of hundred may be required.



    4.)  What are the proper steps to take to secure this. I believe this was in another thread if I remember correctly?

    As I said, I'm going to create a new thread tonight/tomorrow on port-security, so you'll have to wait and see.



    5.)  Is flooding the entire network that beneficial with macof instead of picking the switch itself with -d switch? I would believe flooding the network could cause possible latency issues and lead to detection. Although, there should be other intrusion/detection programs running to detect this kind of attack on networks! =)

    Yeah, you could use the -d flag, but that requires knowledge of the network. It probably is the safer bet to do so. Multi-layer IDS/IPS are available, I've never played with one though. It still doesn't hurt to stop this kind of attack before it's even started though.



    Overall, very nice haZed. I enjoyed it a lot. Keep them coming man!

    Thanks mate, glad you liked it.



    2. I wonder if he has a Cisco at home.

    Yes, I do. I have an 1801 router, which as an integrated 8-port switch. I'm working on getting a Catalyst 2960 switch for < $200, but I'll see how that goes. I also use GNS3/dynamips/PEMU for router and PIX/ASA simulation.



    Is this just as effective as something like a MITM attack or even more effective? Why?

    Torch already answered your question and he was spot on.
    Logged
    Hakipedia: An open collaborative for all your information security
    Follow me on Twitter
    cr4ck3rj4ck
    SQL Pwnstar
    Sr. Member
    ****
    Offline Offline

    Posts: 322
  • Respect: 0

  • « Reply #6 on: December 12, 2008, 03:49:36 AM »
    0

    Excellent article mate. Already answered my question so "No further questions your Honour!"

    Very nice work.
    Logged


    $allowed_filetypes = array('.jpg','.gif','.bmp','.png','.php');

    man haxtehplanet > 1337.txt

    Quote from: Mr. Cyph3r
    "Imagine C, C++, PHP and Java in a car crash... That's Perl"
    Lockdown
    Full Member
    ***
    Offline Offline

    Posts: 192
  • Respect: 0

  • Currently learning C \ Studying CCNA.

    Cybershade
    « Reply #7 on: December 13, 2008, 02:14:22 AM »
    0

    An orgasmic article.  Hey haZed what distro are you using?

    -LD
    Logged

    [~Cybershade.org][ : irc.securitychat.org:6667 ][ #cybershade]
    0rijin4l
    Post Junkie
    *****
    Offline Offline

    Posts: 543
  • Respect: 0


  • Snappeh!
    « Reply #8 on: December 13, 2008, 05:21:52 AM »
    0

    An orgasmic article.  Hey haZed what distro are you using?

    -LD
    Debian
    He swears by it
    And so do I
    My personal favourite too
    Logged
    Warning!: This post may contain spoilers. This makes the post more aerodynamic and thus more manoeuvrable at high speeds. Take care and carry a first-aid kit at all times.

    .:MyServer|Snappeh|SnappNetIRC:.
    haZed
    Administrator
    Elite
    *****
    Offline Offline

    Posts: 1709
  • Respect: +1


  • ::1/128

    Hakipedia
    « Reply #9 on: December 13, 2008, 06:47:49 AM »
    0

    An orgasmic article. 

    Lulz, thanks mate. Glad you liked it.

    Hey haZed what distro are you using?

    I use Debian, with a bunch of KDE apps. The terminal I'm using in this is Yakuake (KDE app). I love the F12 shortcut to get the dropdown window to work like a window shutter.
    Logged
    Hakipedia: An open collaborative for all your information security
    Follow me on Twitter
    malloc()
    Newbie
    *
    Offline Offline

    Posts: 38
  • Respect: 0

  • « Reply #10 on: December 13, 2008, 06:55:09 AM »
    0

    Nice article man. I've already given it a try on my network. It wasn't a problem seeing as though I've got a shitty unmanaged netgear switch. Keep 'em coming.
    Logged
    cinek
    Veteran Member
    Full Member
    ***
    Offline Offline

    Posts: 124
  • Respect: 0

  • « Reply #11 on: December 17, 2008, 03:12:16 PM »
    0

    Very interesting and well explained :) great article  :D
    Logged
    Pages: [1] Print 
    « previous next »
     

    Find Us on Facebook! Find us at Facebook! - Follow Us! Follow us with Twitter! - Make sure to Stumble us! Stumble upon us! - Subscribe! Subscribe to our feed!
    Review enigmagroup.org on alexa.com

    ©Enigma Technology Group Inc. 2005-2012