
PEACH
Un cadre d’isolation des locataires
A certificate, a certification request and an attribute certificate are a SEQUENCE { signed part, signatureAlgorithm, signatureValue }. Only the signed part is covered by the signature. pki-framework decoded the other two fields loosely, so anyone can derive, without any key, an unlimited number of distinct encodings of a valid certificate, CSR or attribute certificate. Each has its own SHA-256 fingerprint, and all decode, verify and validate.
signatureValue are ignored.signatureAlgorithm is compared with the signed one by OID only, so its parameters can be absent, NULL or, for sha*WithRSAEncryption, any element at all.AlgorithmIdentifier with a third element is accepted. md2/md4/md5WithRSAEncryption accept any parameter and re-encode it as NULL.signatureValue BIT STRING is ignored. One unused bit can be declared whenever the last bit of the signature is zero, which is the case for about one signature in two.toDER(), toPEM() and Certificate::equals() made it worse, because they worked on a re-encoding of the parsed objects and not on the bytes received. Two encodings of the same certificate compare equal. A certificate whose signed part was re-encoded, for instance with an explicit critical FALSE added, is equal to the genuine one and is found by CertificateBundle::contains(), although its signature no longer verifies. fromASN1() also checked the signature over such a re-encoding, so that altered certificate verifies when it is decoded from an element tree.
This works for RSA, ECDSA and EdDSA certificates, for CSRs and for attribute certificates. OpenSSL rejects the certificate variants.
Any control keyed on the received bytes can be sidestepped: deny lists, pinning, deduplication, x5t and x5t#S256 thumbprints, audit records. A revoked or banned certificate is presented again under a new fingerprint and is still valid. The README and the threat model promise the opposite: a signed object has a single accepted encoding, and Certificate::equals() compares the two encodings octet by octet.
No signature is forged. The parsed content of every variant is the one the issuer signed, so no privilege is gained beyond what the genuine object grants.
All releases of spomky-labs/pki-framework from 1.0.0 up to and including 1.6.3. 1.6.2 made the signature check run over the received signed part and refused trailing bytes, but left the outer fields as they were.
Fixed in 1.6.4. A signed structure must have exactly three elements and a signature of whole octets. The outer algorithm identifier of a certificate and of an attribute certificate must repeat the signed one byte for byte. An AlgorithmIdentifier refuses a third element, sha224/256/384/512WithRSAEncryption accept NULL or absent parameters only, and md2/md4/md5WithRSAEncryption accept NULL only. A decoded certificate, CSR or attribute certificate keeps the encoding it came from: toDER(), toPEM(), toASN1() and equals() work on those bytes, and fromASN1() verifies the signature over the elements it was given. Objects built in memory are encoded from their fields as before.
A certificate, CSR or attribute certificate carrying one of these encodings no longer decodes: a malformed structure raises a DecodeException, a mismatched algorithm an UnexpectedValueException. A CSR signed with sha*WithRSAEncryption still has two accepted encodings of its algorithm identifier, with NULL or absent parameters, because RFC 4055 requires both to be accepted.
Before keying a control on the bytes received, check that Certificate::fromDER($bytes)->toDER() returns $bytes, and that $cert->signatureAlgorithm()->toASN1()->toDER() equals $cert->tbsCertificate()->signature()->toASN1()->toDER(). Before 1.6.4, the first check catches the extra elements, the unused bits and a re-encoded signed part, and the second catches the parameter variants. A genuine certificate whose issuer encoded the signed part loosely fails the first check too. The same two checks apply to attribute certificates. For a CSR, also refuse signature algorithm parameters other than NULL or absent.
Source: NVD
Évaluation gratuite des vulnérabilités
Évaluez vos pratiques de sécurité cloud dans 9 domaines de sécurité afin d’évaluer votre niveau de risque et d’identifier les lacunes dans vos défenses.
Obtenez une démo personnalisée
"La meilleure expérience utilisateur que j’ai jamais vue, offre une visibilité totale sur les workloads cloud."
"Wiz fournit une interface unique pour voir ce qui se passe dans nos environnements cloud."
"Nous savons que si Wiz identifie quelque chose comme critique, c’est qu’il l’est réellement."