Skip to content

Commit

Permalink
KEYS: Fix for erroneous trust of incorrectly signed X.509 certs
Browse files Browse the repository at this point in the history
Arbitrary X.509 certificates without authority key identifiers (AKIs)
can be added to "trusted" keyrings, including IMA or EVM certs loaded
from the filesystem. Signature verification is currently bypassed for
certs without AKIs.

Trusted keys were recently refactored, and this bug is not present in
4.6.

restrict_link_by_signature should return -ENOKEY (no matching parent
certificate found) if the certificate being evaluated has no AKIs,
instead of bypassing signature checks and returning 0 (new certificate
accepted).

Reported-by: Petko Manolov <[email protected]>
Signed-off-by: Mat Martineau <[email protected]>
Signed-off-by: David Howells <[email protected]>
Signed-off-by: James Morris <[email protected]>
  • Loading branch information
mjmartineau authored and James Morris committed Jul 18, 2016
1 parent d128471 commit acddc72
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crypto/asymmetric_keys/restrict.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ int restrict_link_by_signature(struct key *trust_keyring,

sig = payload->data[asym_auth];
if (!sig->auth_ids[0] && !sig->auth_ids[1])
return 0;
return -ENOKEY;

if (ca_keyid && !asymmetric_key_id_partial(sig->auth_ids[1], ca_keyid))
return -EPERM;
Expand Down

0 comments on commit acddc72

Please sign in to comment.