SD-JWT: DisclosureProcessor has no depth bound, and chained Disclosures make memory grow quadratically

オープン
#773 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
68/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
php
領域
backend, security

調査の方向性

Start by reading DisclosureProcessor::processValue() and the existing SD-JWT tests. Trace how disclosed values and claim paths are processed recursively, then add a depth bound that rejects excessive nesting with InvalidTokenException. Run the SD-JWT tests and confirm a deeply chained payload is rejected while existing valid cases still pass.

索引モデルが issue の本文から書いたものです。

説明

bug
Version(s) affected

4.3.x and 5.0.x branches (SD-JWT is not in any release yet).

Description

DisclosureProcessor follows the digests found in disclosed values recursively, as SD-JWT allows, but nothing bounds how deep Disclosures may reference one another. Every level copies the claim path twice: once into the recorded paths, once as the argument of the pending recursive call. Memory therefore grows with the square of the length of a chain of Disclosures. The JSON depth limit does not help, because each Disclosure is a separate JSON document.

On 4.3.x, 1,000 chained Disclosures (117 kB) peak at 30 MB, and 4,000 (465 kB) at 370 MB, against 7.3 MB for 4,000 Disclosures side by side. Under memory_limit=128M, about 2,400 chained Disclosures end the request with a fatal error instead of the InvalidTokenException the class documents. The same code runs in verifyWithKeyBinding() before the Key Binding JWT is checked, and in SDJWT::select(), which verifies no signature.

The chain has to start from a digest covered by the Issuer signature. #772 is one way for a holder to obtain one.

Possible Solution

Bound the depth of the processed payload, disclosed values included, in DisclosureProcessor::processValue(), and reject deeper payloads with InvalidTokenException. A bound of 64 levels rejects the 4,000-Disclosure chain at 5 MB, and the existing SD-JWT tests still pass.

Additional Context

Found by the Anthropic OSS Scanner (ANT-2026-1MJ6B2EH).

主要言語
PHP
スター
954
フォーク
119
平均マージ
48分
マージ済み PR(30日)
17

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

web-token/jwt-framework のほかの issue

web-token/jwt-framework の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。