Get AI summaries of any video or article — Sign up free
you NEED to learn Port Security…….RIGHT NOW!! // FREE CCNA // EP 14 thumbnail

you NEED to learn Port Security…….RIGHT NOW!! // FREE CCNA // EP 14

NetworkChuck·
5 min read

Based on NetworkChuck's video on YouTube. If you like this content, support the original creators by watching, liking and subscribing to their content.

TL;DR

Treat every exposed Ethernet jack as a potential entry point because plug-in devices can often obtain network settings via DHCP and begin scanning.

Briefing

Exposed Ethernet ports are an easy entry point for attackers because a plug-in device can often obtain network settings via DHCP and then scan or probe the LAN. A key example is the Shark Jack from Hack 5: once connected to an active switch port, it requests an IP address through DHCP, learns the subnet mask, default gateway, and DNS details, and then runs an automated reconnaissance step (in this case an nmap scan) to gather information about reachable hosts and open ports. The practical takeaway is blunt: leaving switch ports “available” can turn everyday infrastructure into a remote foothold—especially in places like offices, airports, and even homes.

The defense starts with reducing what an attacker can use. Unused ports should be shut down at the switch level so they can’t come up even if someone plugs in a device. On Cisco switches, the workflow is to identify down interfaces with commands like “show ip interface brief” and then administratively disable specific ports using “configure terminal,” “interface fastethernet …,” and the “shutdown” command. The video also recommends a “black hole” approach for ports that must remain physically available: isolate them into a dedicated VLAN (a “black hole VLAN”) that has no DHCP server and no default gateway, so devices plugged into those ports can’t reach other parts of the network. In the Cisco example, VLAN 6666 is created and specific FastEthernet ports are assigned to it with “switchport access vlan 666,” effectively trapping any unauthorized device.

But even shutting down unused ports doesn’t solve the scenario where an attacker unplugs a legitimate device and plugs in their own for a moment. That’s where port security comes in. Port security uses Layer 2 MAC address learning to enforce an allowlist per switch port: the switch records which MAC address is permitted, and if a different MAC appears, the port can be shut down or traffic can be restricted. On Cisco, the configuration sequence includes setting the port as an access port (“switchport mode access”), enabling port security (“switchport port-security”), setting the maximum number of allowed MACs (“switchport port-security maximum 1”), and defining the allowed MAC behavior—either explicitly via “mac-address …” or implicitly via “sticky,” which learns the first connected device’s MAC and locks it in. The violation action (“switchport port-security violation shutdown” by default in the example) determines what happens when an unauthorized MAC shows up.

A live demonstration shows the consequence: after enabling port security on a specific GigabitEthernet interface, plugging in a different device triggers a security violation, and the switch places the port into an error-disabled state. Recovery requires administrative intervention—shutting the interface and bringing it back up with “shutdown” followed by “no shutdown,” after which the port returns to normal operation.

Finally, the video places port security in a broader enterprise context. It notes that stronger alternatives exist, including 802.1X authentication (login-based access), certificate-based device authentication, and automated profiling systems such as Cisco ICE. The overall message is a layered defense: disable or black-hole unused ports, and for active ports, prevent MAC spoofing and unplug-and-replug attacks with port security (or stronger identity-based controls).

Cornell Notes

Ethernet ports can be abused when attackers plug in devices that obtain network parameters via DHCP and then scan the LAN. The defense begins by shutting down unused switch ports so they can’t come up, and by isolating any “needed but risky” ports into a black hole VLAN with no DHCP or gateway. For active ports, port security limits which MAC addresses are allowed on each switch interface; if a different MAC appears, the switch can shut the port down or restrict traffic. On Cisco, port security is configured with “switchport port-security,” a MAC allow policy (explicit or “sticky”), and a violation action such as “shutdown.” Recovery from violations requires re-enabling the interface after it enters an error-disabled state.

Why does an exposed Ethernet port create a hacking opportunity even without credentials?

A plug-in device can often join the LAN automatically. The Shark Jack example requests an IP address via DHCP; once it receives an address, it learns key network details like the subnet mask, default gateway (router IP), and DNS server. With that information, it can run automated scanning (the demo uses nmap) to discover reachable hosts and open ports—turning a physical port into a network foothold.

What are the two baseline ways to reduce risk from unused switch ports?

First, administratively shut down ports that aren’t in use so they can’t come up when something is plugged in (Cisco uses the “shutdown” command under the interface). Second, if ports must remain available, place them into a black hole VLAN that has no DHCP server and no default gateway, trapping any connected device so it can’t reach other network segments.

How does port security stop the unplug-and-replug attack?

Port security ties a switch port to an allowed set of Layer 2 MAC addresses. When a legitimate device’s MAC is learned/allowed, the switch can reject any other MAC that appears on that same interface. In the demo, unplugging the Raspberry Pi and plugging in the Shark Jack causes a port security violation because the MAC doesn’t match the allowed entry.

What does “sticky” MAC learning do in Cisco port security?

Instead of manually entering the allowed MAC address, “sticky” learns the MAC address of the first device that successfully connects to the port and then records it as the permitted address. After that, only that learned MAC is allowed; other MACs trigger the configured violation behavior.

What happens to a Cisco port when a port security violation occurs, and how is it restored?

With “switchport port-security violation shutdown,” the switch shuts the port down and places it into an error-disabled state (not the same as an admin shutdown). To restore service, the interface must be administratively cycled—using “shutdown” and then “no shutdown”—after which the port returns to a normal connected state.

What stronger alternatives to port security are mentioned for enterprise environments?

The transcript points to 802.1X, which requires authentication credentials before a device can use a port, and certificate-based access where the device must present a valid certificate. It also mentions Cisco ICE as an automation layer that can profile devices and determine whether they are legitimate or suspicious.

Review Questions

  1. If a switch port is left unused but still physically connected to the network, what two switch-side controls can prevent an attacker from using it?
  2. Describe the role of DHCP in the Shark Jack attack workflow and why that matters for port defenses.
  3. On Cisco, which port security settings determine (1) how many MAC addresses are allowed and (2) what the switch does when a different MAC appears?

Key Points

  1. 1

    Treat every exposed Ethernet jack as a potential entry point because plug-in devices can often obtain network settings via DHCP and begin scanning.

  2. 2

    Administratively shut down unused switch ports so they cannot transition to an operational state when something is plugged in.

  3. 3

    For ports that must remain enabled, isolate them using a black hole VLAN with no DHCP server and no default gateway to prevent lateral access.

  4. 4

    Use port security on active ports to enforce a per-interface MAC allowlist and block unplug-and-replug attacks.

  5. 5

    Choose a port security violation action (such as shutdown) that matches the desired risk response and operational workflow.

  6. 6

    When a port security violation shuts a port down, expect an error-disabled state and plan for interface recovery (shutdown/no shutdown).

  7. 7

    Consider stronger access controls like 802.1X or certificate-based authentication for environments that need identity-based port access.

Highlights

The Shark Jack attack path hinges on DHCP: once it gets an IP address, it can infer network parameters and run automated reconnaissance like nmap.
Shutting down unused ports prevents physical plug-in devices from ever becoming operational on the switch.
A black hole VLAN traps devices by removing DHCP and routing paths, limiting what a plugged-in attacker can reach.
Port security can stop unplug-and-replug attacks by allowing only specific MAC addresses per switch port and shutting the port on violations.
After a violation, Cisco ports may enter an error-disabled state and require an administrative cycle to recover.

Topics

  • Port Security
  • DHCP Attacks
  • Black Hole VLAN
  • MAC Address Filtering
  • 802.1X Authentication

Mentioned

  • DHCP
  • CCNA
  • MAC
  • SSH
  • nmap
  • VLAN
  • SNMP
  • 802.1X
  • ICE
  • IP