SD-JWT: VerifiedSDJWT::getIssuerSignedJwt() keeps the signatures the loader did not verify
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 55/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- php
- Ambito
- backend-api-design, security
Direzione di ricerca
Start by reading SDJWTVerifier::process() and trace how LoadingResult::getSignatureIndex() is used when the JWS is verified and returned. Review JsonSerializationTest::aGeneralSdJwtIsVerifiedByAnyOfItsSignatures; add coverage for a prepended unsigned signature and update the expectation for the returned verified JWT. Done means the returned issuer-signed JWT exposes the verified signature first, while the presented SD-JWT remains available through getSdJwt().
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Version(s) affected
4.3.x-dev and 5.0.x-dev (unreleased), since #750
Description
When the loader of the Issuer-signed JWT accepts the general JWS JSON serialization, SDJWTVerifier::verify() and verifyWithKeyBinding() return the whole JWS in VerifiedSDJWT::getIssuerSignedJwt(), every signature included, although only one of them was verified. Whoever holds the SD-JWT can put an entry of their own in front of the Issuer's signature: the protected header at index 0 of the "verified" Issuer-signed JWT is then theirs (typ, kid, x5c…), including a typ that the configured TypeChecker refuses.
The claims, the header checkers and the algorithm check still apply to the signature that was verified, so no token is accepted that should be refused. The impact is on applications that read a header parameter of the result to branch or to attribute the issuer.
Conditions: the loader has JSONGeneralSerializer (jws_json_general in the bundle, whose default is compact only). With key binding, only the Holder can do it, because sd_hash covers the first signature.
How to reproduce
- Issue a compact SD-JWT whose protected header is
{"alg":"ES256","typ":"visitor+sd-jwt","kid":"issuer-2026"}. - Rewrite it as a general JSON SD-JWT whose
signaturesstart with{"protected": b64u({"alg":"ES256","typ":"staff+sd-jwt","kid":"chosen-by-the-holder"}), "header": {"disclosures": [...]}, "signature": b64u(64 arbitrary bytes)}, followed by the Issuer's entry. - Verify it with a loader that has the compact, flattened and general serializers, ES256 and
TypeChecker(['visitor+sd-jwt']).
The token is accepted with the Issuer's claims, the loader reports signature index 1, and getIssuerSignedJwt()->getSignature(0)->getProtectedHeader() is the header written by the holder.
Possible Solution
SDJWTVerifier::process() uses LoadingResult::getSignatureIndex() for its algorithm check, then returns $loaded->getJws() and drops the index. Return $loaded->getJws()->split()[$loaded->getSignatureIndex()] instead, so that signature 0 is the verified one in every serialization; the token as presented stays available from getSdJwt().
Also:
- say in the docblock of
getIssuerSignedJwt()and in the documentation that only the protected header is authenticated (the unprotected header of the verified entry can be changed by anyone, in the flattened serialization too); - update
JsonSerializationTest::aGeneralSdJwtIsVerifiedByAnyOfItsSignatures, which expects two signatures, and add a test with a prepended unsigned entry.
Additional Context
Found by the Anthropic OSS Scanner (ANT-2026-MHZ2TD30). To be fixed before 4.3.0.
- Lingua principale
- PHP
- Stelle
- 954
- Fork
- 119
- Merge medio
- 48m
- PR unite (30g)
- 17
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di web-token/jwt-framework
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
web-token/jwt-framework#757 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
web-token/jwt-framework#773 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 57/100
web-token/jwt-framework#772 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
web-token/jwt-framework#771 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
web-token/jwt-framework#770 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di web-token/jwt-framework
Issue simili
-
enhancement priority Sales
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
novalo-dev/Prestashop-MCP-Server#201 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
Include flows spanning the full report time windowForse già presa @somethingwithproof l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
Cacti/plugin_flowview#306 ·
I maintainer di solito rispondono entro 1 giorno
-
bug origin: upstream priority: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
mattytap/Mattytap-Sermons#105 ·
-
priority:low type:bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
crazy-goat/workerman-bundle#1189 ·
I maintainer di solito rispondono entro 1 giorno