From: Wouter Wijngaards Date: Tue, 21 Dec 2010 14:19:55 +0000 (+0000) Subject: - algorithm compromise protection using the algorithms signalled in X-Git-Tag: release-1.4.8rc1~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=daab92e954d21d8a1f9a95f7a7b5ad6da4ec0aee;p=thirdparty%2Funbound.git - algorithm compromise protection using the algorithms signalled in the DS record. Also, trust anchors, DLV, and RFC5011 receive this, and thus, if you have multiple algorithms in your trust-anchor-file then it will now behave different than before. Also, 5011 rollover for algorithms needs to be double-signature until the old algorithm is revoked. git-svn-id: file:///svn/unbound/trunk@2358 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/doc/Changelog b/doc/Changelog index a4f02e33d..9ba77404d 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,12 @@ +21 December 2010: Wouter + - algorithm compromise protection using the algorithms signalled in + the DS record. Also, trust anchors, DLV, and RFC5011 receive this, + and thus, if you have multiple algorithms in your trust-anchor-file + then it will now behave different than before. Also, 5011 rollover + for algorithms needs to be double-signature until the old algorithm + is revoked. + It is not an option, because I see no use to turn the security off. + 17 December 2010: Wouter - squelch 'tcp connect: bla' in logfile, (set verbosity 2 to see them). - fix validation in this case: CNAME to nodata for co-hosted opt-in diff --git a/validator/autotrust.c b/validator/autotrust.c index e43d94166..943f57b54 100644 --- a/validator/autotrust.c +++ b/validator/autotrust.c @@ -972,27 +972,17 @@ verify_dnskey(struct module_env* env, struct val_env* ve, struct trust_anchor* tp, struct ub_packed_rrset_key* rrset) { char* reason = NULL; - if(tp->ds_rrset) { - /* verify with ds, any will do to prime autotrust */ - enum sec_status sec = val_verify_DNSKEY_with_DS( - env, ve, rrset, tp->ds_rrset, 0, &reason); - verbose(VERB_ALGO, "autotrust: validate DNSKEY with DS: %s", - sec_status_to_string(sec)); - if(sec == sec_status_secure) { - return 1; - } - } - if(tp->dnskey_rrset) { - /* verify with keys */ - enum sec_status sec = val_verify_rrset(env, ve, rrset, - tp->dnskey_rrset, 0, &reason); - verbose(VERB_ALGO, "autotrust: validate DNSKEY with keys: %s", - sec_status_to_string(sec)); - if(sec == sec_status_secure) { - return 1; - } - } - return 0; + uint8_t sigalg[ALGO_NEEDS_MAX+1]; + int downprot = 1; + enum sec_status sec = val_verify_DNSKEY_with_TA(env, ve, rrset, + tp->ds_rrset, tp->dnskey_rrset, downprot?sigalg:NULL, &reason); + /* sigalg is ignored, it returns algorithms signalled to exist, but + * in 5011 there are no other rrsets to check. if downprot is + * enabled, then it checks that the DNSKEY is signed with all + * algorithms available in the trust store. */ + verbose(VERB_ALGO, "autotrust: validate DNSKEY with anchor: %s", + sec_status_to_string(sec)); + return sec == sec_status_secure; } /** Find minimum expiration interval from signatures */ @@ -1024,6 +1014,8 @@ rr_is_selfsigned_revoked(struct module_env* env, struct val_env* ve, char* reason = NULL; verbose(VERB_ALGO, "seen REVOKE flag, check self-signed, rr %d", (int)i); + /* no algorithm downgrade protection necessary, if it is selfsigned + * revoked it can be removed. */ sec = dnskey_verify_rrset(env, ve, dnskey_rrset, dnskey_rrset, i, &reason); return (sec == sec_status_secure); diff --git a/validator/val_utils.c b/validator/val_utils.c index 928af2b2a..b0475d803 100644 --- a/validator/val_utils.c +++ b/validator/val_utils.c @@ -551,8 +551,8 @@ val_verify_DNSKEY_with_TA(struct module_env* env, struct val_env* ve, struct ub_packed_rrset_key* ta_ds, struct ub_packed_rrset_key* ta_dnskey, uint8_t* sigalg, char** reason) { - /* as long as this is false, we can consider this DS rrset to be - * equivalent to no DS rrset. */ + /* as long as this is false, we can consider this anchor to be + * equivalent to no anchor. */ int has_useful_ta = 0, digest_algo = 0, alg; struct algo_needs needs; size_t i, num; @@ -591,9 +591,8 @@ val_verify_DNSKEY_with_TA(struct module_env* env, struct val_env* ve, * And check it is the strongest digest */ if(!ds_digest_algo_is_supported(ta_ds, i) || !ds_key_algo_is_supported(ta_ds, i) || - ds_get_digest_algo(ta_ds, i) != digest_algo) { + ds_get_digest_algo(ta_ds, i) != digest_algo) continue; - } /* Once we see a single DS with a known digestID and * algorithm, we cannot return INSECURE (with a @@ -620,9 +619,8 @@ val_verify_DNSKEY_with_TA(struct module_env* env, struct val_env* ve, num = rrset_get_count(ta_dnskey); for(i=0; iregion, qstate->env, ve, - dnskey_rrset, ta->ds_rrset, ta->dnskey_rrset, 0, &reason); + dnskey_rrset, ta->ds_rrset, ta->dnskey_rrset, downprot, + &reason); if(!kkey) { log_err("out of memory: verifying prime TA"); return NULL;