XFRM with bridged packets problem

From: Noel Kuntze <hidden>
Date: 2020-01-29 09:48:45

Hello List, Steffen, Dave,

I have found a bug in XFRM/The IPv4 network stack.
Reproduced on 4.19.99 lts and 5.4.15.

Following my notes to the problem:

XFRM docker issue
================

Topology:
docker container with veth pair attached to docker0.
docker0 address 172.17.0.1, container address 172.17.0.2
IPsec policy based tunnel from 172.16.20.2/32 to 0.0.0.0/0
Passthrough policies for multicast, 172.17.0.0/16 to 172.17.0.0/16,
no matching policy for 172.17.0.2 == 0.0.0.0/0
Packets are sent through tunnel regardless
Packets with wrong source IP can be observed on other IPsec peer, traffic counters of incoming SA increases; One endpoint is on the internet, no shared link.

Naturally, the packets are dropped when they're received by the other peer because the policy doesn't match the negotiated policies don't match the packets.

After adding an SNAT rule on the docker host to change the packets' source address to 172.16.20.2, they match the policies on the server and make it onwards. Before then "XfrmInNoPols" in /proc/self/net/xfrm_stat is increased for every packet.

Please let me know what you think.

Kind regards

Noel

-- 
Noel Kuntze
IT security consultant

GPG Key ID: 0x0739AD6C
Fingerprint: 3524 93BE B5F7 8E63 1372 AF2D F54E E40B 0739 AD6C

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help