SD-JWT: VerifiedSDJWT::getIssuerSignedJwt() keeps the signatures the loader did not verify
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 55/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- php
- Lĩnh vực
- backend-api-design, security
Hướng nghiên cứu
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().
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- PHP
- Star
- 954
- Fork
- 119
- Merge trung bình
- 48 phút
- Pull request đã merge (30 ngày)
- 17
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của web-token/jwt-framework
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
web-token/jwt-framework#757 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
web-token/jwt-framework#773 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 57/100
web-token/jwt-framework#772 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
web-token/jwt-framework#771 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
web-token/jwt-framework#770 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của web-token/jwt-framework
Issue tương tự
-
enhancement priority Sales
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
novalo-dev/Prestashop-MCP-Server#201 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Include flows spanning the full report time windowCó thể đã có người làm @somethingwithproof đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
Cacti/plugin_flowview#306 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug origin: upstream priority: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
mattytap/Mattytap-Sermons#105 ·
-
priority:low type:bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
crazy-goat/workerman-bundle#1189 ·
Maintainer thường phản hồi trong vòng 1 ngày