ES256 / ECDSA P-256 keys use secp256k1 instead of NIST P-256 in the OpenSSL build
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ó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/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ệ
- c
- Lĩnh vực
- cryptography, security
Hướng nghiên cứu
Đọc các hàm cupsJWTMakePrivateKey(), make_ec_key() và cupsJWTLoadCredentials() trong cups/jwt.c, cùng với openssl_create_key() trong cups/tls-openssl.c. Thay thế bốn chỗ sử dụng NID_secp256k1 được xác định trong issue bằng NID_X9_62_prime256v1. Chạy testjwt và testjson, sau đó kiểm tra để đảm bảo ES256 hoạt động với các khóa NIST P-256 tiêu chuẩn, trong khi ES384 và ES512 vẫn hoạt động chính xác.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- C
- Star
- 84
- Fork
- 50
- Merge trung bình
- 10 giờ 49 phút
- Pull request đã merge (30 ngày)
- 5
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
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 OpenPrinting/libcups
-
enhancement priority-high security
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
OpenPrinting/libcups#163 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement priority-high security
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
OpenPrinting/libcups#162 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement priority-medium
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
OpenPrinting/libcups#121 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement priority-medium
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
OpenPrinting/libcups#120 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement platform issue
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
OpenPrinting/libcups#109 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của OpenPrinting/libcups
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Bug Status: Needs Triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Remove unused FVS_* macrosĐang mởinterpreter-core type-feature
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[onnx] update to 1.22.0Đang mởcategory:port-update
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Update OpenBSD CI to OpenBSD 8.0 and vmactions/openbsd-vm v1.4.9Có thể đã có người làm @hyoklee đã nhận hôm nay. Đang mở
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 2 ngày