uRPF / BCP 38
BCP 38 is a best practice for filtering traffic entering a network that blocks packets with a spoofed source address. uRPF (Unicast Reverse Path Forwarding) is the router mechanism that implements it by checking the return path to the sender.
Definition
BCP 38 (Best Current Practice 38) is a best practice described in RFC 2827 “Network Ingress Filtering: Defeating Denial of Service Attacks which employ IP Source Address Spoofing”. It recommends that a network accept from its customers and attached segments only packets whose source addresses actually belong to those customers. A packet with a spoofed source address is dropped as soon as it enters the operator’s network.
uRPF (Unicast Reverse Path Forwarding) is the router mechanism that applies this principle automatically. For each packet, the router checks in its routing table whether the source address is reachable via the interface on which the packet arrived. If not, the packet is dropped, because its sender is most likely spoofing someone else’s address.
Source address filtering matters because many DDoS attacks rely on IP address spoofing. In point 5, the Polish Government Plenipotentiary for Cybersecurity’s recommendation on protecting internet service providers against DDoS advises deploying uRPF on all layer 3 interfaces and, where hardware is limited, static, unconditional ACLs that allow traffic only from addresses assigned to the subscriber’s port or VLAN.
How uRPF works
uRPF comes in several modes, described in RFC 3704 “Ingress Filtering for Multihomed Networks” (BCP 84):
Strict mode
A packet is accepted only if the best route to its source address points to the same interface on which the packet arrived. This is the most effective protection against spoofing and works well on access ports of single-homed customers.
Loose mode
A packet is accepted if any route to the source address exists in the routing table, regardless of interface. Loose mode does not stop spoofing of existing addresses, but it drops packets from addresses that are not in the routing table, such as unallocated ones. RFC 5635 uses it in its sample S/RTBH configuration.
Feasible path mode
A packet is accepted if the source address is reachable via the given interface according to any of the received routes, not just the best one. This mode reduces false drops in multihomed networks. An extension of this approach, Enhanced Feasible-Path uRPF, is described in RFC 8704.
Limitations of uRPF
- Asymmetric routing. In multihomed networks, traffic to an address and traffic from it may take different paths. Strict mode would then drop legitimate packets. RFC 3704 discusses these cases, which is why it describes the more relaxed modes.
- Hardware limitations. Not every device supports uRPF in hardware at full performance. Point 5 of the recommendation provides for static ACLs on access ports in such cases.
- Protection works at the source. BCP 38 filtering does not protect the network that deployed it against attacks from outside — it protects the rest of the internet against attacks originating from that network. Its effectiveness depends on how many operators apply it.
uRPF and BCP 38 in DDoS protection
Source address filtering connects with several other mechanisms:
- Reflection and amplification attacks. A DRDoS attack requires sending queries on behalf of the victim, that is with a spoofed source address. A network applying BCP 38 does not let its customers take part in such an attack as a source of queries.
- S/RTBH. Dropping traffic from selected source addresses through RTBH only works with uRPF enabled on the interfaces where filtering takes place — as point 9 of the recommendation stresses.
- Bogon filtering. Point 6 of the recommendation additionally advises dropping, on access ports, packets with bogon addresses, including the private space described in RFC 1918.
uRPF and BCP 38 from a company’s perspective
BCP 38 is primarily an operator best practice, but a company has its part to play too:
- Egress filtering at your own edge. The company’s edge router or firewall should pass to the internet only packets with source addresses belonging to the company. This way an infected device inside the network cannot send packets with a spoofed address.
- A question for your internet service provider. Does the operator apply BCP 38 filtering and uRPF on customer ports? An operator that does not makes reflection attacks easier — and its own customer may become their victim.
- Multiple links. A company with links from two operators should agree the uRPF mode with them, so that asymmetric routing does not cause legitimate traffic to be dropped.
In practice, egress filtering at a company’s edge comes down to a few firewall rules: pass packets from the company’s public addresses, drop all others and log which device tried to send a packet with a foreign address. Such a log entry is often the first sign that an infected device is active in the network. IPv6 should not be forgotten either — point 2e of the recommendation notes that IPv6 requires the same care as IPv4, including source filtering, otherwise it becomes an additional attack vector. Filtering rules for both protocols should be maintained together and checked with every change in addressing, e.g. after adding a new link or address pool.
Summary
BCP 38, that is RFC 2827, recommends filtering incoming traffic so that a network accepts only packets with genuine source addresses. uRPF does this automatically in strict, loose and feasible path modes, described in RFC 3704 and RFC 8704. The mechanism limits attacks based on address spoofing, is a prerequisite for S/RTBH, and its effectiveness grows with every operator that deploys it.