{"id":880,"date":"2011-09-07T21:50:00","date_gmt":"2011-09-07T13:50:00","guid":{"rendered":"http:\/\/note.systw.net\/note\/?p=880"},"modified":"2023-11-07T21:53:11","modified_gmt":"2023-11-07T13:53:11","slug":"vlan-hopping-attack","status":"publish","type":"post","link":"https:\/\/systw.net\/note\/archives\/880","title":{"rendered":"Vlan Hopping Attack"},"content":{"rendered":"\n<p>secure vlan trunking<br>1. VLAN Hopping with Switch Spoofing<br>2. VLAN Hopping with double-tagged<\/p>\n\n\n\n<p>&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;..<\/p>\n\n\n\n<p><strong>vlan hopping with Switch Spoofing<\/strong><br>to Gain Access to a Trunk<br>DTP can make switch administration easier,but it also can expose switch ports to be compromised.<\/p>\n\n\n\n<p>\u8aaa\u660e<br>a switch port is left to its default configuration(trunking mode is auto) . Normally, the switch port would wait to be asked by another switch in the auto or on mode to become a trunk.<br>Possible as follows:<br><strong>A well-behaved end user:<\/strong><br>\u30001. would not use DTP at all,<br>\u30002. so the port would come up in access mode with a single-access VLAN.<br><strong>A malicious user:<\/strong><br>\u30001. might exploit the use of DTP<br>\u30002. and attempt to negotiate a trunk with the switch port.<br>\u5f8c\u679c<br>This makes the PC appear to be another switch; in effect, the PC is spoofing a switch<br>\u5371\u5bb3<br>After the trunk is negotiated, the<strong>&nbsp;attacker has access to any VLAN<\/strong>&nbsp;that is permitted to pass over the trunk<\/p>\n\n\n\n<p><strong>solution1<\/strong><br>to configure every switch port to have an expected and controlled behavior<br>configure it to static access mode<br><strong>(config-if)# switchport mode access<\/strong><\/p>\n\n\n\n<p><strong>solution2<\/strong><br>turn off DTP on all ports<br><strong>(config-if)#switchport nonegotiate<\/strong><\/p>\n\n\n\n<p>the way ,an end user never will be able to send any type of spoofed traffic that will make the switch port begin trunking.<\/p>\n\n\n\n<p>&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;.<\/p>\n\n\n\n<p><strong>VLAN Hopping with double-tagged<\/strong><br>an attacker positioned on one access VLAN can craft and send frames with spoofed 802.1Q tags so that the packet payloads ultimately appear on a totally different VLAN, all without the use of a router<\/p>\n\n\n\n<p><strong>the attack success conditions must exist<\/strong><br>1. The attacker is connected to an&nbsp;<strong>access switch port<\/strong>.<br>2. The same switch must have an&nbsp;<strong>802.1Q trunk<\/strong>.<br>3. The trunk must have the&nbsp;<strong>attacker&#8217;s access VLAN as its native VLAN<\/strong><\/p>\n\n\n\n<p><strong>VLAN Hopping Attack Process<\/strong><br>\u74b0\u5883\u8aaa\u660e:attacker\u9023\u63a5\u4e4baccess port\u70bavlan1 , \u8a72switch\u4f7f\u7528trunk\u4e14native vlan\u70ba1<br>1.<br>Attacker Sends a Double-Tagged Packet onto His Local Access VLAN<br>attack on vlan1 &#8212;[vlan1][vlan20][payload]&#8212;&gt; (access)switch A<br>2.<br>When switch A Is Ready to Forward the Packet onto the Trunk,<br>the First Tag Is Stripped Because it Is the Same as the Trunk&#8217;s Native VLAN<br>switch A(trunk) ===[vlan20][payload]===&gt; (trunk)switch B<br>3.<br>The Packet Is Received by switch B; as the Second Tag Is Stripped,<br>it Appears to Identify the Source VLAN as VLAN 20<br>switch B(access) &#8212;[payload]&#8212;&gt; USER on vlan20<br>4.<br>The Packet Originally from VLAN 1 Is Now Sent into VLAN 20<\/p>\n\n\n\n<p><br><strong>solution0<\/strong><br>\u907f\u514dnative vlan\u548cuser\u7684access vlan\u8a2d\u70ba\u540c\u4e00\u500b<\/p>\n\n\n\n<p><strong>solution1<\/strong><br>configure trunk links with the following steps:<br>Step 1. Set the native VLAN of a trunk to a bogus or unused VLAN ID.<br>Step 2. Prune the native VLAN off both ends of the trunk<br>ps:<br>Although maintenance protocols such as CDP, PAgP, and DTP normally are carried over the native VLAN of a trunk, they will not be affected if the native VLAN is pruned from the trunk.<br>They still will be sent and received on the native VLAN as a special case even if the native VLAN ID is not in the list of allowed VLANs<br>ex:<br>suppose that an 802.1Q trunk should carry only VLANs 10 and 20. You<br>should set the native VLAN to an unused value, such as 800. Then you should remove<br>VLAN 800 from the trunk so that it is confined to the trunk link itself.<br>Switch(config)# vlan 800<br>Switch(config-vlan)# name bogus_native<br>Switch(config-vlan)# exit<br>Switch(config)# interface gigabitethernet 1\/1<br>Switch(config-if)# switchport trunk encapsulation dot1q<br>Switch(config-if)# switchport trunk native vlan 800<br>Switch(config-if)# switchport trunk allowed vlan remove 800<br>Switch(config-if)# switchport mode trunk<\/p>\n\n\n\n<p><br><strong>soluction2<\/strong><br>to force all 802.1Q trunks to add tags to frames for the native VLAN, too<br>\u8aaa\u660e:<br>The double-tagged VLAN hopping attack won&#8217;t work because the switch won&#8217;t remove the<br>first tag with the native VLAN ID<br>\u6b65\u9a5f<br>1. that tag will remain on the spoofed frame as it enters the trunk<br>2. At the far end of the trunk, the same tag will be examined, and the frame will stay on the original access VLAN<\/p>\n\n\n\n<p>To force a switch to tag the native VLAN on all its 802.1Q trunks<br><strong>(config)# vlan dot1q tag native<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>secure vlan trunking1. VLAN Ho &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"","fifu_image_alt":"","_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","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[31],"tags":[],"class_list":["post-880","post","type-post","status-publish","format-standard","hentry","category-cisco-security"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts\/880","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/comments?post=880"}],"version-history":[{"count":0,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts\/880\/revisions"}],"wp:attachment":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/media?parent=880"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/categories?post=880"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/tags?post=880"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}