]> git.ipfire.org Git - thirdparty/bind9.git/commit
Add tests for CVE-2022-2795
authorMichał Kępień <michal@isc.org>
Tue, 6 Sep 2022 11:36:44 +0000 (13:36 +0200)
committerMichal Nowak <mnowak@isc.org>
Thu, 20 Oct 2022 08:19:22 +0000 (10:19 +0200)
commit67319f10045890e2090787d2fd80927a5c2a6c7d
treeae382546d14399f479203dc9120c6767846459b8
parent828e7f5257803c2200b43474a458e9c259948b73
Add tests for CVE-2022-2795

Add a test ensuring that the amount of work fctx_getaddresses() performs
for any encountered delegation is limited: delegate example.net to a set
of 1,000 name servers in the redirect.com zone, the names of which all
resolve to IP addresses that nothing listens on, and query for a name in
the example.net domain, checking the number of times the findname()
function gets executed in the process; fail if that count is excessively
large.

Since the size of the referral response sent by ans3 is about 20 kB, it
cannot be sent back over UDP (EMSGSIZE) on some operating systems in
their default configuration (e.g. FreeBSD - see the
net.inet.udp.maxdgram sysctl).  To enable reliable reproduction of
CVE-2022-2795 (retry patterns vary across BIND 9 versions) and avoid
false positives at the same time (thread scheduling - and therefore the
number of fetch context restarts - vary across operating systems and
across test runs), extend bin/tests/system/resolver/ans3/ans.pl so that
it also listens on TCP and make "ns1" in the "resolver" system test
always use TCP when communicating with "ans3".

Also add a test (foo.bar.sub.tld1/TXT) that ensures the new limitations
imposed on the resolution process by the mitigation for CVE-2022-2795 do
not prevent valid, glueless delegation chains from working properly.

(cherry picked from commit 604d8f0b967563b0ba9dcd4f09559fdd9e21dfbe)
bin/tests/system/resolver/ans2/ans.pl
bin/tests/system/resolver/ans3/ans.pl
bin/tests/system/resolver/ns1/named.conf.in
bin/tests/system/resolver/ns6/named.conf.in
bin/tests/system/resolver/ns6/redirect.com.db [new file with mode: 0644]
bin/tests/system/resolver/ns6/tld1.db [new file with mode: 0644]
bin/tests/system/resolver/ns7/named1.conf.in
bin/tests/system/resolver/ns7/named2.conf.in
bin/tests/system/resolver/ns7/sub.tld1.db [new file with mode: 0644]
bin/tests/system/resolver/ns7/tld2.db [new file with mode: 0644]
bin/tests/system/resolver/tests.sh