Skip to content
Misconfiguration Write-up Advanced

FreeBSD pf bypass when using IPv6

A vulnerability in FreeBSD's pf firewall allows attackers to bypass IPv6 firewall rules by sending non-compliant atomic fragments with multiple fragmentation headers. This enables blocked TCP, UDP, and ICMPv6 traffic to pass through the firewall and reach the victim network.

enricobassetti.it

Published on enricobassetti.it

A few months ago, as part of our investigations on IPv6 security in the NetSecurityLab @ Sapienza University, we discovered a vulnerability that allows attackers to bypass rules in pf-based IPv6 firewalls in particular conditions. Let’s see some details of this vulnerability.

The author, on enricobassetti.it

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely, pf's scrubbing process reassembles non-compliant IPv6 atomic fragments with multiple fragmentation headers but fails to apply layer 4 and higher filtering rules to the reassembled packet.

Impact

An attacker could bypass firewall rules to establish full two-way communication, including TCP, UDP, and ICMPv6 traffic, with hosts behind the firewall that should have been blocked.

What the attacker needed

FreeBSD with pf firewall; IPv6 traffic; scrub enabled for IPv6 fragments; attacker can send packets to the firewall

The fix

The vulnerability was fixed by updating FreeBSD to versions after 13.2-STABLE, 13.2-RELEASE-p3, 12.4-STABLE, and 12.4-RELEASE-p5.

How it was found

  1. Configure pf with scrub enabled and rules that block TCP, UDP, and ICMPv6 from the attacker interface.
  2. Craft a non-compliant IPv6 atomic fragment containing multiple fragmentation headers.
  3. Send the crafted packet from the attacker network towards the victim network.
  4. Observe that the packet bypasses the blocking rules and reaches the victim, allowing communication.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

A firewall is a security system that controls network traffic based on rules. In this case, the FreeBSD firewall's handling of certain malformed IPv6 packets (called atomic fragments) caused it to skip some filtering rules, letting traffic that should be blocked get through. An attacker could then communicate with systems behind the firewall that were supposed to be protected.

What is Misconfiguration?

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.

Similar reports

View all

Same bug class and techniques, clearest first.

Security misconfiguration

The lesson behind this report.

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.