Commit graph

44882 commits

Author SHA1 Message Date
Aydın Mercan
a531f00a75
wipe hmac keys correctly pre-3.0 libcrypto
A lingering `sizeof` from the prototype era of !11094 caused the
key-wipe in `isc_hmac_key_destroy` to use `sizeof(key->len)` instead of
`key->len` for the length argument of `isc_safe_memwipe`.

This results in a buffer overflow of zero bytes in HMAC keys that are
less than 4 bytes. As such, the overflow can only be visibile in keys
that are less than 32-bits, which is beyond broken and creating such
keys are only possible in testing.

Therefore, this change is *not* a security fix since the conditions are
never reachable in any imaginable deployment scenario.

Builds that use OpenSSL >=3.0 are unaffected as the `sizeof` was only
remaining in pre-3.0 builds.
2026-02-06 14:14:43 +03:00
Mark Andrews
2aba637548 fix: test: nsec3/tests_nsec3_change.py updates zone file too fast
The zone file is updated too soon causing the reload to fail.
Add a 1 second sleep to ensure the modification time has changed.

Closes #5734

Merge branch '5734-fix-tests-nsec3-change-py' into 'main'

See merge request isc-projects/bind9!11525
2026-02-06 21:38:22 +11:00
Mark Andrews
8f413fd589 Fix timing in tests_nsec3_change.py
The zone file is updated too soon causing the reload to fail.
Add a 1 second sleep to ensure the modification time has changed.
2026-02-06 09:39:15 +11:00
Michał Kępień
42ab76d9e1 [CVE-2025-13878] sec: test: Add a regression test for the BRID/HHIT crash
Add two short records to example.com.db that cause assertion failures
when converted to wire form.

The checks added to tests.sh are technically not required: the relevant
assertion failures are already hit when the zone is transferred out of
ns1.

Update the relevant unit tests with 1-byte records.

Co-authored-by: Mark Andrews <marka@isc.org>

Closes #5616

Merge branch '5616-add-brid-hhit-towire-tests' into 'main'

See merge request isc-projects/bind9!11522
2026-02-05 19:23:20 +01:00
Matthijs Mekking
ce1d68cbc5
Add a regression test for the BRID/HHIT crash
Add two short records to example.com.db that cause assertion failures
when converted to wire form.

The checks added to tests.sh are technically not required: the relevant
assertion failures are already hit when the zone is transferred out of
ns1.

Update the relevant unit tests with 1-byte records.

Co-authored-by: Mark Andrews <marka@isc.org>
2026-02-05 18:21:52 +01:00
Petr Špaček
3cae2e0cd5 chg: doc: Set up version for BIND 9.21.19
Merge branch 'andoni/set-up-version-for-bind-9.21.19' into 'main'

See merge request isc-projects/bind9!11514
2026-02-04 09:01:33 +00:00
Andoni Duarte Pintado
34b0eb9065 Update BIND version to 9.21.19-dev 2026-02-04 09:36:51 +01:00
Aydın Mercan
fe9fee63c6 chg: dev: initial openssl version splitting
Dealing with OpenSSL has been rapidly turning into an unwieldy situation
as post-3.0 changes turn the library into a different beast.

Start treating pre and post-3.0 versions differently for easier
maintenance.

To help with this Sisyphean task, this MR had to shift things around.

`OPENSSL_NO_DEPRECATED` is now declared in BIND alongside an appropriate
`OPENSSL_API_COMPAT` value. The former value will set to declare either
OpenSSL 1.1.0 or 3.0 as the bare minimum version.

Instead of splitting `md.c` and `hmac.c` into separate version-specific
files, they now live inside `crypto/ossl1_1.c` and `crypto/ossl3.c`.
This way, these functions will be able to utilize the same static
`OSSL_PARAM` tables, removing redundant reconstruction for HMAC.

For pre-3.0, `isc_hmac` has been reverted back to using the `HMAC_`
interface. Using `EVP_MD_CTX`-based functions for HMAC will end up
libcrypto calling the same `HMAC_` functions in the end, giving no
advantage while confusingly using the digest functions.

A new API, `isc_ossl_wrap` has been added. This family of functions
aim to provide a common interface for libcrypto version specific code
while not abstracting away OpenSSL's structures such as `EVP_PKEY`.

Currently the main user of this API is the `dst` family of functions
where some ECDSA and RSA opeations need to use the new `OSSL_PARAM`
functionality by requirement or to avoid speed penalties.

Furthermore OpenSSL based logging has been moved from `isc_tls` to
`isc_ossl_wrap` as its a more appropriate place for such functionality.

Merge branch 'aydin/openssl-version-split' into 'main'

See merge request isc-projects/bind9!11094
2026-02-02 12:43:48 +03:00
Aydın Mercan
ecb677658f
don't transform errors in hmac_sign
The change from DST_R_OPENSSLFAILURE to ISC_R_CRYPTOFAILURE seems to be
benign. Furthermore it should a bug to rely on the exacts crypto failure
code.
2026-02-02 11:50:14 +03:00
Aydın Mercan
19c9053a6b
use isc_ossl_wrap to generate epheremal tls keys 2026-02-02 11:50:14 +03:00
Aydın Mercan
b748651bb0
explicitly set ec points properties in pre-3.0 openssl
Generating a P-256 key in pre-3.0 wasn't explicitly using uncompressed
named curves in DNSSEC but was when generating an epheremal TLS key.
2026-02-02 11:50:14 +03:00
Aydın Mercan
251af02fe7
make generate_pkcs11_ec_key consistent with others 2026-02-02 11:50:14 +03:00
Aydın Mercan
c2f3a23a3e
expose isc__crypto_md in isc/ossl_wrap.h
This is a bit of a namespace convention violation but it fits the spirit of
this header since it is exposing OpenSSL-isms to others.

Further work is needed to make sure the exposed EVP_MD isn't needed
anymore.
2026-02-02 11:50:14 +03:00
Aydın Mercan
21f80a2bd7
make isc_ossl_wrap_ecdsa_set_deterministic consistent with style 2026-02-02 11:50:14 +03:00
Aydın Mercan
8c69fedc7c
switch away from ossl_param builders from ecdsa functions 2026-02-02 11:50:14 +03:00
Aydın Mercan
fe617aa830
set parameters in batch for rsa keygen
On top on improving readability, doing so allows us to use a uint32_t
for setting the e value, getting rid of allocating an unneccessary
BIGNUM.
2026-02-02 11:50:14 +03:00
Aydın Mercan
3bd3754994
remove libcrypto version specific code in opensslecdsa_link
Using `EVP_SIGNATURE` explicit algoritms for signatures have been added
in OpenSSL 3.4 and so is skipped for the initial OpenSSL version
specific code splitting.
2026-02-02 11:50:14 +03:00
Aydın Mercan
f4d88404e2
remove libcrypto version specific code in opensslrsa_link
Using `EVP_SIGNATURE` explicit algoritms for signatures have been added
in OpenSSL 3.4 and so is skipped for the initial OpenSSL version
specific code splitting.
2026-02-02 11:50:14 +03:00
Aydın Mercan
f21d237374
move openssl error reporting to isc/ossl_wrap
While being the best place at the time, the tlserr2result doesn't belong
inside TLS code since it is generic to OpenSSL and mostly used in the
dst interface. The newly created ossl_wrap interface is the idea place
for flushing the OpenSSL thread error queue.
2026-02-02 11:50:14 +03:00
Aydın Mercan
c4a25e633c
add openssl_wrap
The isc_ossl_wrap API is intended to separate OpenSSL version specific
code that needs to expose the libcrypto internals and keep isc_crypto
clean.
2026-02-02 11:50:14 +03:00
Aydın Mercan
5ae9b4d14c
cleanup unused header in isc/md.h
Use `isc/crypto.h` whenever needed instead.
2026-02-02 11:50:14 +03:00
Aydın Mercan
8f106f2b66
Separate isc_hmac between pre and post OpenSSL 3.0
Instead of the `EVP_MD_CTX` based functions, use either the new
`EVP_MAC` or the old `HMAC_CTX` based functions.

`EVP_MAC` is the recommended way using using MAC functions in post-3.0
while `HMAC_CTX` is used internally by `EVP_MD_CTX`, making the latter
redundant.
2026-02-02 11:50:14 +03:00
Aydın Mercan
f9ec4a1cdf
switch isc_md_type_t to a proper enum
Get rid of the OpenSSL-isms that plague the codebase where the hash type
is `EVP_MD *`

By using a proper enum, alongside the cleanup, we also get the ability
to use constants for known hash sizes instead of having a function call
every time.

`EVP_MD_CTX_get0_md` has been removed instead of being adapted since it
wasn't used anymore.
2026-02-02 11:12:55 +03:00
Aydın Mercan
35eeefb437
initial openssl version splitting
Dealing with OpenSSL has been rapidly turning into an unwieldy situation
as post-3.0 changes turn the library into a different beast.

Start treating pre and post-3.0 versions differently for easier
maintenance.
2026-02-02 11:12:53 +03:00
Colin Vidal
8dfa96b91b chg: dev: dns_rdataset_clone() and dns_rdataset_isassociated() const parameters
`dns_rdataset_clone()` takes now a const source rdataset. Also,
`dns_rdataset_isassociated()` also takes a const rdataset.

Merge branch 'colin/rdataset-const' into 'main'

See merge request isc-projects/bind9!11462
2026-01-30 20:28:39 +01:00
Colin Vidal
d0d4b40b62 dns_rdataset_* const parameters
dns_rdataset_clone() now have a const source rdataset. Also,
dns_rdataset_isassociated() also takes a const rdataset.
2026-01-30 19:33:42 +01:00
Ondřej Surý
40bffcc8a6 chg: usr: Enable minimal ANY answers by default
ANY queries are widely abused by attackers doing reflection attacks as
they return the largest answers.  Enable minimal ANY answers by default
to reduce the attack surface of the DNS servers.

Closes #5723

Merge branch '5723-change-minimal_any-default-to-yes' into 'main'

See merge request isc-projects/bind9!11505
2026-01-29 04:29:45 +01:00
Ondřej Surý
0bebf8ee9d
Enable minimal ANY answers by default
ANY queries are widely abused by attackers doing reflection attacks as
they return the largest answers.  Enable minimal ANY answers by default
to reduce the attack surface of the DNS servers.
2026-01-28 15:38:18 +01:00
Mark Andrews
6c1bc49ec7 fix: test: ISC_RUN_TEST_IMPL should use a static declaration
These functions don't need to be called from multiple places and
by making them static we will detect when they are not added to the
list functions to be tested.

Closes #5715

Merge branch '5715-isc_run_test_impl-should-use-a-static-declaration' into 'main'

See merge request isc-projects/bind9!11480
2026-01-28 21:23:48 +11:00
Mark Andrews
22d664aa15 ISC_RUN_TEST_IMPL should use a static declaration
These functions don't need to be called from multiple places and
by making them static we will detect when they are not added to the
list functions to be tested.
2026-01-28 07:26:04 +11:00
Mark Andrews
7e39596d57 chg: dev: Use enum rather than numbers for isc_base64_tobuffer and isc_hex_tobuffer
Use isc_one_or_more and isc_zero_or_more rather than (-2) and
(-1) when calling isc_base64_tobuffer. Similarly for
isc_hex_tobuffer. This should help reduce the probability
that the wrong number is used and it makes the intent clearer.

Closes #5713

Merge branch '5713-use-macros-with-isc_base64_tobuffer-and-isc_hex_tobuffer' into 'main'

See merge request isc-projects/bind9!11479
2026-01-28 07:22:59 +11:00
Mark Andrews
d92369cc8f Add spatch for isc_one_or_more and isc_zero_or_more 2026-01-28 00:25:04 +11:00
Mark Andrews
5843289550 Use isc__zero_or_more when calling isc_base64_tobuffer 2026-01-28 00:25:04 +11:00
Mark Andrews
62fd89d4a1 Use isc_one_or_more when calling isc_base64_tobuffer 2026-01-28 00:25:04 +11:00
Mark Andrews
7feb0f5b53 Use isc_one_or_more when calling isc_hex_tobuffer 2026-01-27 23:57:34 +11:00
Mark Andrews
07610f8566 Add enum for use with isc_base64_tobuffer and isc_hex_tobuffer
This adds the following enum isc_one_or_more and isc_zero_or_more
which specify if one or more or zeror or more bytes are required
when reading the unbounded base64 / hex encoded data.
2026-01-27 23:57:34 +11:00
Arаm Sаrgsyаn
fd568032ac fix: usr: Fix a possible issue with reponse policy zones and catalog zones
If a response policy zone (RPZ) or a catalog zone contained an
`$INCLUDE` directive, then manually reloading that zone could
fail to process the changes in the response policy or in the
catalog, respectively. This has been fixed.

Closes #5714

Merge branch '5714-zone_loaddone-rpz-and-catz-bugfix' into 'main'

See merge request isc-projects/bind9!11489
2026-01-27 11:32:07 +00:00
Aram Sargsyan
d81a2457d6 Add a new check in the RPZ system test
Check that reloading a response policy zone which has an '$INCLUDE'
directive defined is working as expected.
2026-01-27 11:31:15 +00:00
Aram Sargsyan
31290eccb1 Fix a bug in zone_loaddone()
The zone_loaddone() function disables database notifications for
a catalog zones and response policy zones (RPZ) when loading had
failed. Howerer, the 'result != ISC_R_SUCCESS' check is insufficient,
because the DNS_R_SEENINCLUDE result also indicates success.

Add a second condition for the "if" block.
2026-01-27 11:31:15 +00:00
Nicki Křížek
f81e90e3e1 fix: test: Resolve the system_test_dir in pytest
If the system_test_dir contains a symlink, then it might cause issues
further down when using relative_to(), unless it is resolved first. This
has been observed on FreeBSD13 in CI where /home is a symlink to
/usr/home.

Merge branch 'nicki/pytest-freebsd13-artifacts-path' into 'main'

See merge request isc-projects/bind9!11490
2026-01-27 11:46:55 +01:00
Nicki Křížek
b1e3469059 Resolve the system_test_dir in pytest
If the system_test_dir contains a symlink, then it might cause issues
further down when using relative_to(), unless it is resolved first. This
has been observed on FreeBSD13 in CI where /home is a symlink to
/usr/home.
2026-01-27 11:05:18 +01:00
Mark Andrews
4195821686 fix: usr: Fix brid and hhit implementation
Fix bugs in BRID and HHIT implementation and enable
the unit tests.

Closes #5710

Merge branch '5710-fix-hhit-and-brid-issues' into 'main'

See merge request isc-projects/bind9!11491
2026-01-27 16:45:55 +11:00
Mark Andrews
97af8fc519 Fix brid and hhit unit tests
These tests were not being run.
2026-01-27 16:05:29 +11:00
Mark Andrews
10366e4f4e Remove extraneous space at start of brid and hhit records 2026-01-27 16:05:29 +11:00
Mark Andrews
bdb9c838a8 Fix isc_base64_tobuffer call for brid and hhit
Zero length records were not being rejected.
2026-01-27 16:05:24 +11:00
Nicki Křížek
0d3b369c6b fix: test: Fix a race condition in dnssec test
When dumpdb command is executed, it might take a while until the file is
written. Rather than checking the file once, use the WatchLog mechanism
to allow the desired line to appear before a timeout happens.

This affected test_validation_recovery and test_cache tests which have
been intermittently failing on EL8 in our CI.

Merge branch 'nicki/fix-dnssec-test-dumpdb-race' into 'main'

See merge request isc-projects/bind9!11487
2026-01-26 13:10:25 +01:00
Nicki Křížek
6eb2088320 Fix a race condition in dnssec test
When dumpdb command is executed, it might take a while until the file is
written. Rather than checking the file once, use the WatchLog mechanism
to allow the desired line to appear before a timeout happens.

This affected test_validation_recovery and test_cache tests which have
been intermittently failing on EL8 in our CI.
2026-01-26 10:45:34 +01:00
Štěpán Balážik
11e6d1c0b9 chg: test: Use isctest.asyncserver in the "resolver" system test
Depends on !11403, !11419

Merge branch 'stepan/resolver-asyncserver' into 'main'

See merge request isc-projects/bind9!11411
2026-01-24 15:23:35 +00:00
Štěpán Balážik
c336c1feab Fix bugs in 'resolver/ans2' and 'resolver/ans3'
There were multiple typos and omissions regarding query minimization.
2026-01-24 13:04:09 +01:00
Štěpán Balážik
cef851740b Reimplement 'resolver/ans10' server using AsyncDnsServer
Ensure packet-for-packet compatibility with the old server.
2026-01-24 13:04:09 +01:00