Support for UUID OIDs in X509v3 extensions

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

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

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
javascript

調査の方向性

Start with the forge.asn1.fromDer and forge.asn1.derToOid calls shown in the report, and compare the behavior introduced by commit 3e0c35a. Reproduce the UUID OID example using the supplied hexadecimal value. Done means UUID-based OIDs parse correctly while the security limitation that motivated the regression remains covered.

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

説明

There seems to have been a regression in forge 1.3.2 where OIDs with a bit length exceeding 53 bits (32 bits in some cases) are no longer allowed, while in 1.3.1 they were allowed, but parsed incorrectly. The change was caused by this commit, which addresses an integer overflow vulnerability.

For my specific use case, using a UUID OID (subtree 2.25) in a certificate's SAN extension causes parsing errors that were not present in version 1.3.1 and lower.

The behavior is illustrated by the following code:

const forge = require('node-forge');

const hex = "06146982d0c480ebc5cda2b8c183a5adfeb4a7b99915";
const bytes = forge.util.hexToBytes(hex);
const buffer = forge.util.createBuffer(bytes);

try {
    const asn1 = forge.asn1.fromDer(buffer);
    const oid = forge.asn1.derToOid(asn1.value);

    console.log("OID:", oid);
    // forge 1.3.1 prints "OID: 2.25.1156467861", which is wrong
} catch (e) {
    console.error("Error:", e.message);
    // forge 1.3.2 prints "Error: OID value too large; max is 53-bits."
}

OID maximum length is a messy topic. From an ASN.1 perspective, there is no real maximum depth/length limit for OIDs in general, but the X509v3 specification seems to only require support for OID arc lengths up to 28 bits.

This confuses things a little, and I do understand that to prevent vulnerabilities like CVE-2025-66030 from reoccurring, there is a need to put some form of limitation in place. I also understand that putting the limitation at 53 bits (i.e. JavaScript's MAX_SAFE_INTEGER) is very convenient from an implementation perspective.

However, given the existence of OID subtree 2.25, and the fact that the forge ASN.1 implementation seems to be intended to provide generic ASN.1 functionality beyond the scope of X509v3, I believe the 53 bit limit to be too restrictive, and would argue in favor of raising it to 128 bits. This will require replacing the current Number-based implementation with a BigInt-based implementation.

Some more examples of the current lay of the land, regarding this:

  • OpenSSL supports OIDs at least up to 128 bits.
  • The Python cryptography library, and the Rust dependency it relies on for its ASN.1 parsing (rust-asn1), both support OIDs up to 128 bits. (Admittedly, I was the one to push for that, and also provided the implementation.)
  • PeculiarVentures/ASN1.js supports OIDs at least up to 128 bits.
主要言語
JavaScript
スター
5.4k
フォーク
875
平均マージ
3分
マージ済み PR(30日)
6

環境構築

はじめの一歩

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

digitalbazaar/forge のほかの issue

digitalbazaar/forge の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

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

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