One defect on one line of src/Binding/HTTPRedirect.php, present in the released v6.2.4 (the
version GHSA-r7hw-jx6r-756g names as patched) and on master:
The HTTP-Redirect binding verifies the query-string signature against
SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock — the test keypair that ships in
simplesamlphp/xml-security — instead of the peer's metadata key. Anyone can produce a
"validly signed" SAMLRequest/SAMLResponse on this binding, and a genuinely signed message
from the real peer fails.
src/Binding/HTTPRedirect.php at v6.2.4 — import at :24, use at :199-205:
use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock;
...
$container = ContainerSingleton::getInstance();
$blacklist = $container->getBlacklistedEncryptionAlgorithms();
$verifier = (new SignatureAlgorithmFactory($blacklist))->getAlgorithm(
$query['SigAlg'],
// TODO: Need to use the key from the metadata
PEMCertificatesMock::getPublicKey(PEMCertificatesMock::SELFSIGNED_PUBLIC_KEY),
);
if ($verifier->verify($signedQuery, base64_decode($query['Signature'])) === false) {
throw new SignatureVerificationFailedException('Failed to verify signature.');
}
return $message;PEMCertificatesMock lives in the TestUtils namespace of simplesamlphp/xml-security and is
installed as a normal runtime dependency, so both halves of that keypair are public.
The consequences are symmetric and both bad:
SAMLRequest/SAMLResponse query string with the published
SELFSIGNED private key. verify() returns true and receive() returns the message as
successfully verified.SignatureVerificationFailedException is thrown for legitimate traffic.
This is on the library's ordinary dispatch path: Binding::getCurrentBinding() (src/Binding.php:55-56,:82-89) returns new HTTPRedirect() for any GET carrying SAMLRequest or SAMLResponse, so a
consumer that uses the binding layer reaches it without doing anything unusual.
Note also :181-183 — when the Signature parameter is absent the message is returned without any
verification, which is correct for the binding (the profile decides whether a signature is required)
but means that between the two paths receive() never authenticates anything: no signature is
accepted as-is, and a signature is accepted when it was made with a key the whole world has.
For an IdP built on this library the immediate consequence is forged signed LogoutRequests (log
out any subject) and forged signed AuthnRequests attributed to a trusted SP; for an SP, forged
LogoutResponse/LogoutRequest.
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N — 9.1 Critical.
AT:P is "the consumer uses Binding::getCurrentBinding() / HTTPRedirect::receive() and relies on
its signature check". A consumer that verifies signatures itself is unaffected, which is the only
thing holding this below a flat 10.
The TODO is the fix: take the key from the peer's metadata, the way
HTTPArtifact::verifyMessageSignature() already does with $idpMetadata->getPublicKeys('signing', true).
Until that plumbing exists, the safer interim behaviour is to refuse rather than to verify against a
known key:
throw new \RuntimeException(
'HTTP-Redirect signature verification requires the peer metadata key; ' .
'verify the signature in the caller until this is implemented.'
);so that a consumer relying on the binding fails closed instead of accepting attacker signatures. A
CI grep that fails the build when anything under src/ imports SimpleSAML\XMLSecurity\TestUtils\
would stop the class of mistake.
Fuente: NVD
Evaluación gratuita de vulnerabilidades
Evalúa tus prácticas de seguridad en la nube en 9 dominios de seguridad para evaluar tu nivel de riesgo e identificar brechas en tus defensas.
Obtén una demostración personalizada
"La mejor experiencia de usuario que he visto en mi vida, proporciona una visibilidad completa de las cargas de trabajo en la nube."
"Wiz proporciona un panel único para ver lo que ocurre en nuestros entornos en la nube."
"Sabemos que si Wiz identifica algo como crítico, en realidad lo es."