unbound cannot start with large zone files > 24.000 lines : memory exhausted
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| unbound (Ubuntu) |
Fix Released
|
Undecided
|
Andreas Hasenack | ||
| Focal |
Fix Released
|
Undecided
|
John Chittum | ||
| Jammy |
Fix Released
|
Undecided
|
John Chittum | ||
| Noble |
Fix Released
|
Undecided
|
John Chittum | ||
| Oracular |
Fix Released
|
Undecided
|
John Chittum | ||
| Plucky |
Fix Released
|
Undecided
|
Andreas Hasenack | ||
Bug Description
[ SRU ]
[ Impact ]
* regression introduced by CVE-2024-43167, anyone with a configuration file that ends up parsed by contents_view, who has an large file (> 9994 zones), will lead to memory exhaustion.
* due to the bug being introduced by a security patch, it has been patched all the way to 20.04 in the security pocket.
* due to the file size requirement, this is likely only hitting the largest deployments.
[ Test Plan ]
[[ Reproduction ]]
* download conf from comment 2 : https:/
* download example zone from comment 5 : https:/
* lxc launch ubuntu-daily:$SUITE $SUITE-test-unbound
* lxc file push <unbound.conf | security.zone> $SUITE-
* lxc shell $SUITE-test-unbound
* sudo apt update && sudo apt full-upgrade
* sudo apt install unbound
* sudo service unbound stop
* mv /tmp/unbound.conf /etc/unbound/
* mkdir /etc/unbound/zones
* mv /etc/unbound/
* sudo service unbound start
* observe the failure (memory exhaustion)
* sudo service unbound stop (just in case -- it should be dead)
* setup proposed (or the PPA)
* sudo apt update
* make sure you get the update installed (apt-cache policy unbound)
* upgrade unbound
* sudo service unbound start
* no error should occur from reading the configuration file
* note: there may be a different error in the resolveconf service due to a loopback device being used in an lxc container. This is unrelated to the issue.
[ Where problems could occur ]
* the patch happens in configparser.y . the bug was introduced by another change to this file. It is difficult to know the amount of configurations available and how those can be parsed.
* scanning past bugs in upstream github and debian, I am not seeing recent bugs related to configuration.
[ Other Info ]
* PPA builds available in https:/
[ ORIGINAL BUG REPORT ]
Starting with version 1.19, when loading unbound and using include directive to load a large file with lots of NXDOMAIN (244 859 entries), unbound gives a memory exhausted error and does not load on Ubuntu 24.04
To reproduce
Steps to reproduce the behavior:
add include directive to file with lots (over 244000) of entries like this "local-zone: "vip.xvpn.io" always_nxdomain"
unbound.conf: include: /etc/unbound/
try to start unbound with service start unbound
Expected behavior
Unbound should start
System:
Unbound version: 1.19.2 (1.19.2-1ubuntu3.3)
OS: Ubuntu Noble 24.04.1
unbound: 1.19.2-1ubuntu3.3
Additional information
Error message:
unbound-
Older package 1.19.2-1ubuntu3.1 is working fine with the configuration
If I use just a couple of lines /e.g. 20000) in the include directive works just fine and unbound loads and returns NXDOMAIN for the few remaining domains.
Related branches
- git-ubuntu bot: Approve
- Lena Voytek (community): Approve
- Ubuntu Sponsors: Pending requested
- Canonical Server Reporter: Pending requested
-
Diff: 41 lines (+11/-2)2 files modifieddebian/changelog (+7/-0)
debian/patches/lp-2087526-1-fix-memory-exhaust-in-local-zones.patch (+4/-2)
- git-ubuntu bot: Approve
- Lena Voytek (community): Approve
- Ubuntu Sponsors: Pending requested
- Canonical Server Reporter: Pending requested
-
Diff: 41 lines (+11/-2)2 files modifieddebian/changelog (+7/-0)
debian/patches/lp-2087526-1-fix-memory-exhaust-in-local-zones.patch (+4/-2)
- git-ubuntu bot: Approve
- Athos Ribeiro (community): Approve
- Canonical Server Reporter: Pending requested
-
Diff: 80 lines (+58/-0)3 files modifieddebian/changelog (+8/-0)
debian/patches/lp-2087526-1-fix-memory-exhaust-in-local-zones.patch (+49/-0)
debian/patches/series (+1/-0)
- git-ubuntu bot: Approve
- Simon Quigley (community): Approve
- Canonical Server packageset reviewers: Pending requested
- Canonical Server Reporter: Pending requested
-
Diff: 82 lines (+60/-0)3 files modifieddebian/changelog (+8/-0)
debian/patches/lp-2087526-1-fix-memory-exhaust-in-local-zones.patch (+51/-0)
debian/patches/series (+1/-0)
- git-ubuntu bot: Approve
- Simon Quigley (community): Approve
- Canonical Server packageset reviewers: Pending requested
- Canonical Server Reporter: Pending requested
-
Diff: 82 lines (+60/-0)3 files modifieddebian/changelog (+8/-0)
debian/patches/lp-2087526-1-fix-memory-exhaust-in-local-zones.patch (+51/-0)
debian/patches/series (+1/-0)
- git-ubuntu bot: Approve
- Utkarsh Gupta (community): Approve
- Canonical Server Reporter: Pending requested
-
Diff: 215 lines (+133/-3)3 files modifieddebian/changelog (+122/-0)
debian/control (+3/-2)
debian/rules (+8/-1)
CVE References
| Changed in unbound (Ubuntu Plucky): | |
| status: | Confirmed → In Progress |
| assignee: | nobody → Andreas Hasenack (ahasenack) |
| Changed in unbound (Ubuntu Oracular): | |
| assignee: | nobody → John Chittum (jchittum) |
| Changed in unbound (Ubuntu Noble): | |
| assignee: | nobody → John Chittum (jchittum) |
| Changed in unbound (Ubuntu Jammy): | |
| assignee: | nobody → John Chittum (jchittum) |
| Changed in unbound (Ubuntu Focal): | |
| assignee: | nobody → John Chittum (jchittum) |

Thanks for taking the time to report a bug.
I can't reproduce it here inside a pristine Noble container. Here's how I'm generating the file:
# cd /etc/unbound/ unbound. conf.d/
# echo "server:" > test.conf
# printf ' local-zone: "vip.xvpn%d.io" always_nxdomain\n' {1..40000} >> test.conf
This will generate a file with 40001 lines, which is automatically included by /etc/unbound/ unbound. conf. Restarting the service works as expected.
Note that I'm composing different domain names in order to avoid repetition, but even without this trick things work.
Could you please provide more detailed steps to reproduce, as well as information about your system (how much memory/swap you have, whether you can reproduce this issue on a different system, etc.)?
Thank you.