mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #6133] ARP probe failing due to gratuitous arp reply #3193
Labels
No labels
LTS merge
LTS merge
bug
bug
converted-to-discussion
doc-todo
documentation
duplicate
enhancement
file-transfer
firecfg
firejail-in-firejail
firetools
graphics
help wanted
information_old
installation
invalid
modif
moved
needinfo
networking
notabug
notourbug
old-version
overlayfs
packaging
profile-request
pull-request
question
question_old
removal
runtime-permissions
sandbox-ipc
security
stale
wiki
wiki
wontfix
wordpress
workaround
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/firejail#3193
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @brianvanderburg2 on GitHub (Dec 17, 2023).
Original GitHub issue: https://github.com/netblue30/firejail/issues/6133
Description
Setup: A bridge is configured with a VLAN subinterface from the main interface bound to it. T When using firejail, the bridge is used as the interface with an IP range to choose from.
enp9s0 (main interface)
bm-home (vlan subinterface for home/internet traffic)
bhome (bridge, bm-home is placed into this bridge.)
no IPs are assigned to the bridges or VLAN/main interfaces
Firejail is launched to create a veth pair to put into bhome, then processes launched under the firejail proccess have an IP/are able to access the internet. The bridge is used to allow other processes/virtual machines/macvlans/etc to also be able to access the internet when desired. This has worked perfectly fine until recently.
Profile:
Recently, I get an error indicating all the IPs are in use. I checked the wireshark capture and i notice:
Send arp probe
I get a gratuitous arp from a different address on the network
Send arp probe for next ip
same
Send arp probe for next ip
same
When I don't get the gratuitous arp response, then it assignes that IP address Only one device in our network has that response so I asked them to turn it off, and when they do, it works with no problems.
Steps to Reproduce
Unsure. It seems specific to this situation
Expected behavior
After getting no ARP responses matching the IPs of the ARP probe, it should use the IP for the jail
Actual behavior
It performs an ARP probe of two random IPs, then the entire specified range, and fails with the error "Error: cannot assign an IP address; it looks like all of them are in use."
Behavior without a profile
This works, however doesn't use a new network namespace with veth interface connected to the bridge and assigned an iP, so doesn't affect/reflect on this issue
Additional context
Environment
Debian Bullesye
Firejail 0.9.72
Checklist
/usr/bin/vlc) "fixes" it).https://github.com/netblue30/firejail/issues/1139)browser-allow-drm yes/browser-disable-u2f noinfirejail.configto allow DRM/U2F in browsers.--profile=PROFILENAMEto set the right profile. (Only relevant for AppImages)I think the issue is here:
Send ARP probe:

Received gratuitous ARP

Code:

If I'm reading this correctly:
if packet length is to small, continue
if proto type is not arp continue
copy arp header
if arp code is not 2 (reply) continue
compare target mac received to probe sender mac, if not the same continue
(the probe sender mac is 02:ba:15:00:00:10, the grat arp target mac is 02:ba:15:00:00:10, so it moves to next step)
compare target ip received to probe sent IP, if not continue
(the probe sent IP source 0.0.0.0, the grat arp had a target ip 0.0.0.0 soe it moves to the next step)
return -1 (ARP probe failed)
(for probe responses, shouldbe be checking target or source, ie wouldn't the arp reply of an 'already-used' IP address have it's IP/MAC in the ARP sender field instead of target field
Suspect maybe it should be:
if (memcmp(ifr.ifr_hwaddr.sa_data, hdr.sender_mac, 6) != 0)
and
memcpy(&ip, hdr.sender_ip, 4)
instead
@osevan commented on GitHub (Dec 17, 2023):
Is this related with
https://github.com/netblue30/firejail/discussions/6102
?
@brianvanderburg2 commented on GitHub (Dec 18, 2023):
I don't think so. In your log file the network is already established and enters the jail. In mine, it fails at assigning an IP address and does not even enter the sandbox.
Looking through the code and packet dump it makes sense.
My system sends:
sender mac: 02:ba:15:00:00:10
sender ip: 0.0.0.0
target mac: 00:00:00:00:00:00
target ip: 192.168.1.30
This other system on the network send a reply:
sender mac: f0:d4:15:45:5d:5d
sender ip: 192.168.1.122
target mac: 02:ba:15:00:00:10
target ip: 0.0.0.0
The code is checking if the target values of the reply are the same as the sender of the probe, which they are, so returns -1, and arp_random/arp_sequential then test the result, which is not 0, so returns 0 for the "ip" which then causes arp_assign to fail.
This seems to confirm it should compare the received frame's sender IP with the probe frame's target IP, and if the same, treat as duplicate. In the code, it compares the received frame's target IP (hdr.target_ip) with the probe frame's sender IP (srcaddr) Here I don't think the MAC even matters, another ARP being received with the same sender IP that we are trying to use would mean a duplicate
It also recommends if receiving an ARP request during probing with a target ip matching the IP we are trying to use and a source mac not equal to ours, to treat as duplicate as another station may be probing to use the IP at the same time as we are
I don't have build tools on my system right now, but I'm thinking this is what the function should look like