[GH-ISSUE #2869] DNS leak? Process escapes sandbox to use host's DNS call? #1793

Open
opened 2026-05-05 08:27:58 -06:00 by gitea-mirror · 8 comments
Owner

Originally created by @garywill on GitHub (Jul 25, 2019).
Original GitHub issue: https://github.com/netblue30/firejail/issues/2869

I used firejail in this way:

brctl addbr tmp0

Set tmp0 ip 192.168.88.1 and serve DHCP and DNS using dnsmasq on tmp0, and provide Internet to NATed tmp0 via iptables.

If dnsmasq receives DNS query, I'll see in the log.

firejail --noprofile --net=tmp0 --dns=192.168.88.1

In firejail shows the right DNS I specified:

$ cat /etc/resolv.conf
nameserver 192.168.88.1

Problem is, in firejail dig and nslookup use the DNS that my dnsmasq provides, but curl and firefox still use host's DNS , as if the run not in sandbox. (In firejail Internet is provided by iptables NAT, and I banned it's access to host's DNS )

Originally created by @garywill on GitHub (Jul 25, 2019). Original GitHub issue: https://github.com/netblue30/firejail/issues/2869 I used firejail in this way: ``` brctl addbr tmp0 ``` Set `tmp0` ip `192.168.88.1` and serve DHCP and DNS using `dnsmasq` on `tmp0`, and provide Internet to NATed `tmp0` via iptables. If dnsmasq receives DNS query, I'll see in the log. ``` firejail --noprofile --net=tmp0 --dns=192.168.88.1 ``` In firejail shows the right DNS I specified: ``` $ cat /etc/resolv.conf nameserver 192.168.88.1 ``` **Problem is**, in firejail `dig` and `nslookup` use the DNS that my `dnsmasq` provides, but `curl` and firefox still use host's DNS , **as if the run not in sandbox**. (In firejail Internet is provided by iptables NAT, and I **banned** it's access to host's DNS )
gitea-mirror added the
networking
question_old
security
labels 2026-05-05 08:27:58 -06:00
Author
Owner

@garywill commented on GitHub (Jul 26, 2019):

I did strace and found ping,curl don't read /etc/resolve.conf.
host,dig,nslookup does.
I guess that's one of the reasons.
Still, the problem is sandbox escaped.

<!-- gh-comment-id:515379455 --> @garywill commented on GitHub (Jul 26, 2019): I did `strace` and found `ping`,`curl` don't read `/etc/resolve.conf`. `host`,`dig`,`nslookup` does. I guess that's one of the reasons. Still, the problem is sandbox escaped.
Author
Owner

@rusty-snake commented on GitHub (Sep 10, 2019):

@garywill IDK how curl finds out where to look-up, but I tryed with --dns=0.0.0.0 to see if the cutom dns-server is used or not. I found out that if you use --net the --dns is considered.

<!-- gh-comment-id:529949719 --> @rusty-snake commented on GitHub (Sep 10, 2019): @garywill IDK how curl finds out where to look-up, but I tryed with `--dns=0.0.0.0` to see if the cutom dns-server is used or not. I found out that if you use `--net` the `--dns` is considered.
Author
Owner

@garywill commented on GitHub (Oct 26, 2019):

It's because of nscd.
Need --blacklist=/var/run/nscd

<!-- gh-comment-id:546579293 --> @garywill commented on GitHub (Oct 26, 2019): It's because of nscd. Need `--blacklist=/var/run/nscd`
Author
Owner

@ghost commented on GitHub (Jan 20, 2020):

It's because of nscd.
Need --blacklist=/var/run/nscd

@garywill Can you do a PR on the profiles that need this please?

<!-- gh-comment-id:576253463 --> @ghost commented on GitHub (Jan 20, 2020): > It's because of nscd. > Need --blacklist=/var/run/nscd @garywill Can you do a PR on the profiles that need this please?
Author
Owner

@rusty-snake commented on GitHub (Jan 20, 2020):

@garywill what shows grep ^hosts /etc/nsswitch.conf?

<!-- gh-comment-id:576296152 --> @rusty-snake commented on GitHub (Jan 20, 2020): @garywill what shows `grep ^hosts /etc/nsswitch.conf`?
Author
Owner

@garywill commented on GitHub (Jan 21, 2020):

@rusty-snake

$ grep ^hosts /etc/nsswitch.conf
hosts:  	files mdns_minimal [NOTFOUND=return] dns

@glitsj16
I don't know. I know hardly nothing about firejail's profile mechanism. What profile will be accounted when --net is used?

<!-- gh-comment-id:576533011 --> @garywill commented on GitHub (Jan 21, 2020): @rusty-snake ``` $ grep ^hosts /etc/nsswitch.conf hosts: files mdns_minimal [NOTFOUND=return] dns ``` @glitsj16 I don't know. I know hardly nothing about firejail's profile mechanism. What profile will be accounted when `--net` is used?
Author
Owner

@ghost commented on GitHub (Jan 21, 2020):

$ grep ^hosts /etc/nsswitch.conf
hosts: files mdns_minimal [NOTFOUND=return] dns

When you change this to hosts: files mdns_minimal dns, do you observe any changes (for the better hopefully)?

<!-- gh-comment-id:576545900 --> @ghost commented on GitHub (Jan 21, 2020): > $ grep ^hosts /etc/nsswitch.conf > hosts: files mdns_minimal [NOTFOUND=return] dns When you change this to `hosts: files mdns_minimal dns`, do you observe any changes (for the better hopefully)?
Author
Owner

@garywill commented on GitHub (Jan 22, 2020):

@glitsj16 Nope. Nothing different with editted nsswitch.conf

<!-- gh-comment-id:577027453 --> @garywill commented on GitHub (Jan 22, 2020): @glitsj16 Nope. Nothing different with editted `nsswitch.conf`
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/firejail#1793
No description provided.