-
Notifications
You must be signed in to change notification settings - Fork 620
dhcp: fix CVE-2022-38177, CVE-2022-38178, CVE-2022-2795 for bind #8971
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
c0fb156
update
elainezhao1 4970606
add patch for dhcp bundled bind
elainezhao1 ce43e9d
apply patch to bind dir
elainezhao1 3f68109
apply patch to bind dir
elainezhao1 a1ed966
apply patch to bind dir
elainezhao1 f09ee06
apply patch to bind dir
elainezhao1 2b1350a
use the backported patch files
elainezhao1 cffd194
Update SPECS/dhcp/dhcp.spec
elainezhao1 a136de6
update paths in patches
elainezhao1 25da8b7
update paths in patches
elainezhao1 1e4d77b
remove autosetup
elainezhao1 a8d9eda
remove autosetup
elainezhao1 a8532be
fix patch
elainezhao1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| From 36c878a0124973f29b7ca49e6bb18310f9b2601f Mon Sep 17 00:00:00 2001 | ||
| From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= <michal@isc.org> | ||
| Date: Thu, 8 Sep 2022 11:11:30 +0200 | ||
| Subject: [PATCH 1/3] Bound the amount of work performed for delegations | ||
|
|
||
| Limit the amount of database lookups that can be triggered in | ||
| fctx_getaddresses() (i.e. when determining the name server addresses to | ||
| query next) by setting a hard limit on the number of NS RRs processed | ||
| for any delegation encountered. Without any limit in place, named can | ||
| be forced to perform large amounts of database lookups per each query | ||
| received, which severely impacts resolver performance. | ||
|
|
||
| The limit used (20) is an arbitrary value that is considered to be big | ||
| enough for any sane DNS delegation. | ||
|
|
||
| (cherry picked from commit 3a44097fd6c6c260765b628cd1d2c9cb7efb0b2a) | ||
|
|
||
| Upstream-Status: Backport | ||
| CVE: CVE-2022-2795 | ||
| Reference to upstream patch: | ||
| https://gitlab.isc.org/isc-projects/bind9/-/commit/bf2ea6d8525bfd96a84dad221ba9e004adb710a8 | ||
|
|
||
| Signed-off-by: Mathieu Dubois-Briand <mbriand@witekio.com> | ||
| --- | ||
| bind_ln/lib/dns/resolver.c | 12 ++++++++++++ | ||
| 1 file changed, 12 insertions(+) | ||
|
|
||
| diff --git a/bind_ln/lib/dns/resolver.c b/bind_ln/lib/dns/resolver.c | ||
| index 8ae9a993bbd7..ac9a9ef5d009 100644 | ||
| --- a/bind_ln/lib/dns/resolver.c | ||
| +++ b/bind_ln/lib/dns/resolver.c | ||
| @@ -180,6 +180,12 @@ | ||
| */ | ||
| #define NS_FAIL_LIMIT 4 | ||
| #define NS_RR_LIMIT 5 | ||
| +/* | ||
| + * IP address lookups are performed for at most NS_PROCESSING_LIMIT NS RRs in | ||
| + * any NS RRset encountered, to avoid excessive resource use while processing | ||
| + * large delegations. | ||
| + */ | ||
| +#define NS_PROCESSING_LIMIT 20 | ||
|
|
||
| /* Number of hash buckets for zone counters */ | ||
| #ifndef RES_DOMAIN_BUCKETS | ||
| @@ -3318,6 +3324,7 @@ fctx_getaddresses(fetchctx_t *fctx, bool badcache) { | ||
| bool need_alternate = false; | ||
| bool all_spilled = true; | ||
| unsigned int no_addresses = 0; | ||
| + unsigned int ns_processed = 0; | ||
|
|
||
| FCTXTRACE5("getaddresses", "fctx->depth=", fctx->depth); | ||
|
|
||
| @@ -3504,6 +3511,11 @@ fctx_getaddresses(fetchctx_t *fctx, bool badcache) { | ||
|
|
||
| dns_rdata_reset(&rdata); | ||
| dns_rdata_freestruct(&ns); | ||
| + | ||
| + if (++ns_processed >= NS_PROCESSING_LIMIT) { | ||
| + result = ISC_R_NOMORE; | ||
| + break; | ||
| + } | ||
| } | ||
| if (result != ISC_R_NOMORE) { | ||
| return (result); | ||
| -- | ||
| 2.34.1 | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| From ef3d1a84ff807eea27b4fef601a15932c5ffbfbf Mon Sep 17 00:00:00 2001 | ||
| From: Mark Andrews <marka@isc.org> | ||
| Date: Thu, 11 Aug 2022 15:15:34 +1000 | ||
| Subject: [PATCH 2/3] Free eckey on siglen mismatch | ||
|
|
||
| Upstream-Status: Backport | ||
| CVE: CVE-2022-38177 | ||
| Reference to upstream patch: | ||
| https://gitlab.isc.org/isc-projects/bind9/-/commit/5b2282afff760b1ed3471f6666bdfe8e1d34e590 | ||
|
|
||
| Signed-off-by: Mathieu Dubois-Briand <mbriand@witekio.com> | ||
| --- | ||
| bind_ln/lib/dns/opensslecdsa_link.c | 2 +- | ||
| 1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
|
||
| diff --git a/bind_ln/lib/dns/opensslecdsa_link.c b/bind_ln/lib/dns/opensslecdsa_link.c | ||
| index 83b5b51cd78c..7576e04ac635 100644 | ||
| --- a/bind_ln/lib/dns/opensslecdsa_link.c | ||
| +++ b/bind_ln/lib/dns/opensslecdsa_link.c | ||
| @@ -224,7 +224,7 @@ opensslecdsa_verify(dst_context_t *dctx, const isc_region_t *sig) { | ||
| siglen = DNS_SIG_ECDSA384SIZE; | ||
|
|
||
| if (sig->length != siglen) | ||
| - return (DST_R_VERIFYFAILURE); | ||
| + DST_RET(DST_R_VERIFYFAILURE); | ||
|
|
||
| if (!EVP_DigestFinal_ex(evp_md_ctx, digest, &dgstlen)) | ||
| DST_RET (dst__openssl_toresult3(dctx->category, | ||
| -- | ||
| 2.34.1 | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| From 65f5b2f0162d5d2ab25f463aa14a8bae71ace3d9 Mon Sep 17 00:00:00 2001 | ||
| From: Mark Andrews <marka@isc.org> | ||
| Date: Thu, 11 Aug 2022 15:28:13 +1000 | ||
| Subject: [PATCH 3/3] Free ctx on invalid siglen | ||
|
|
||
| (cherry picked from commit 6ddb480a84836641a0711768a94122972c166825) | ||
|
|
||
| Upstream-Status: Backport | ||
| CVE: CVE-2022-38178 | ||
| Reference to upstream patch: | ||
| https://gitlab.isc.org/isc-projects/bind9/-/commit/1af23378ebb11da2eb0f412e4563d6 | ||
|
|
||
| Signed-off-by: Mathieu Dubois-Briand <mbriand@witekio.com> | ||
| --- | ||
| bind_ln/lib/dns/openssleddsa_link.c | 2 +- | ||
| 1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
|
||
| diff --git a/bind_ln/lib/dns/openssleddsa_link.c b/bind_ln/lib/dns/openssleddsa_link.c | ||
| index 8b115ec283f0..b4fcd607c131 100644 | ||
| --- a/bind_ln/lib/dns/openssleddsa_link.c | ||
| +++ b/bind_ln/lib/dns/openssleddsa_link.c | ||
| @@ -325,7 +325,7 @@ openssleddsa_verify(dst_context_t *dctx, const isc_region_t *sig) { | ||
| siglen = DNS_SIG_ED448SIZE; | ||
|
|
||
| if (sig->length != siglen) | ||
| - return (DST_R_VERIFYFAILURE); | ||
| + DST_RET(ISC_R_NOTIMPLEMENTED); | ||
|
|
||
| isc_buffer_usedregion(buf, &tbsreg); | ||
|
|
||
| -- | ||
| 2.34.1 | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was curious why you had to revert back to
%setupand realized I've made a mistake in my initial suggestion by forgetting about the-Nflag to disable auto patching. I've tested this to work locally:Sorry for the trouble.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Documentation about
%autosetupif you're curious: https://rpm-software-management.github.io/rpm/manual/autosetup.html.