ES256 / ECDSA P-256 keys use secp256k1 instead of NIST P-256 in the OpenSSL build
メンテナーはふだん 1 日以内に返信
@michaelrsweet がすでに取り組んでいます。
2026年10月22日 から。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- c
- 領域
- cryptography, security
調査の方向性
cups/jwt.c の cupsJWTMakePrivateKey()、make_ec_key()、cupsJWTLoadCredentials() 関数と、cups/tls-openssl.c の openssl_create_key() を読みます。issue で特定されている NID_secp256k1 の4箇所を NID_X9_62_prime256v1 に置き換えます。testjwt と testjson を実行し、標準の NIST P-256 キーで ES256 が動作し、ES384 と ES512 も引き続き正しく動作することを確認します。
索引モデルが issue の本文から書いたものです。
説明
In the OpenSSL build, libcups generates every key labelled "P-256" on the secp256k1 curve (the Koblitz curve) instead of NIST P-256 (secp256r1 / NID_X9_62_prime256v1). RFC 7518 section 6.2.1.1 defines the JWK "crv":"P-256" and the ES256 algorithm as NIST P-256. P-384 and P-521 are correct, so it looks like a secp256k1 vs secp256r1 slip, and the only OpenSSL constant for r1 is NID_X9_62_prime256v1.
Affected code (OpenSSL build only; the GnuTLS build uses SECP256R1 and is correct):
- cups/jwt.c, cupsJWTMakePrivateKey(): ES256 key generation uses NID_secp256k1
- cups/jwt.c, make_ec_key(): the "P-256" import/verify branch uses NID_secp256k1
- cups/jwt.c, cupsJWTLoadCredentials(): the curve read-back maps NID_secp256k1 to "P-256"
- cups/tls-openssl.c, openssl_create_key(): CUPS_CREDTYPE_ECDSA_P256_SHA256 uses NID_secp256k1
Effect:
- The key is on the wrong curve while still labelled "P-256". With Python cryptography, the public key point is not on NIST P-256; it is on secp256k1.
- cupsJWTHasValidSignature() rejects a valid ES256 token signed with a real P-256 key, and ES256 tokens CUPS signs are rejected by RFC-compliant libraries. jwcrypto rejects CUPS ES256 tokens, and CUPS reports a standard jwcrypto P-256 token as invalid. ES384 and ES512 are fine. It fails closed; there is no bypass.
- A CUPS_CREDTYPE_ECDSA_P256_SHA256 certificate is generated on secp256k1 but presented as P-256, so standard TLS clients reject it. This type is opt-in; the default is RSA-3072 or P-384.
Present in libcups 3.0.0 and 3.0.3. CUPS 2.5 master has the same code.
Fix: change NID_secp256k1 to NID_X9_62_prime256v1 in all four places. P-384 and P-521 already use NID_secp384r1 and NID_secp521r1.
Verified on macOS arm64 with Homebrew OpenSSL 3.6.3. After the fix the key point is on NIST P-256, jwcrypto verifies CUPS ES256 tokens, CUPS verifies standard P-256 tokens, and testjwt (ES256 and ES384 included) and testjson pass. I can open a PR with the fix if you want.
- 主要言語
- C
- スター
- 84
- フォーク
- 50
- 平均マージ
- 23時間 34分
- マージ済み PR(30日)
- 7
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
OpenPrinting/libcups のほかの issue
-
enhancement priority-high security
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
OpenPrinting/libcups#163 ·
メンテナーはふだん 1 日以内に返信
-
enhancement priority-high security
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
OpenPrinting/libcups#162 ·
メンテナーはふだん 1 日以内に返信
-
enhancement priority-medium
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
OpenPrinting/libcups#121 ·
メンテナーはふだん 1 日以内に返信
-
enhancement priority-medium
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
OpenPrinting/libcups#120 ·
メンテナーはふだん 1 日以内に返信
-
enhancement platform issue
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
OpenPrinting/libcups#109 ·
メンテナーはふだん 1 日以内に返信
OpenPrinting/libcups の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
MerginMaps/geodiff#272 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
open-quantum-safe/liboqs#2644 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
espressif/esp-adf-libs#89 · コメント 1 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
メンテナーはふだん 2 日以内に返信