SSLContext#min_version= and #max_version= silently accept prefix strings and empty strings
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
Issue 指向 ext/openssl/ossl_ssl.c 中的 parse_proto_version(),並展示了目前的比較方式和建議的長度檢查。閱讀該函式,並找出 SSLContext#min_version= 和 #max_version= 的測試。補上空字串、前綴和內嵌 NUL 位元組的測試,並確認它們會引發 ArgumentError,而完整的版本名稱仍可正常運作。
由索引模型根據 Issue 內容生成。
描述
Description
parse_proto_version() in ext/openssl/ossl_ssl.c compares the input protocol version name using strncmp(map[i].name, RSTRING_PTR(str), RSTRING_LEN(str)) without verifying that the string lengths match.
// ext/openssl/ossl_ssl.c:879-882
for (i = 0; i < numberof(map); i++)
if (!strncmp(map[i].name, RSTRING_PTR(str), RSTRING_LEN(str)))
return map[i].version;
rb_raise(rb_eArgError, "unrecognized version %+"PRIsVALUE, str);
Actual Behavior
Because only RSTRING_LEN(str) bytes are compared:
""(empty string),"S", or"SSL"silently matches"SSL2"(SSL2_VERSION)"T","TLS", or:TLSsilently matches"TLS1"(TLS1_VERSION)- Strings with embedded NUL bytes (e.g.,
"TLS1\0_3") silently match"TLS1"(TLS1_VERSION)
Expected Behavior
Empty strings, partial prefixes, and strings containing embedded NUL bytes should raise ArgumentError (unrecognized version).
Suggested Fix
Verify that the string lengths are equal and compare using memcmp():
for (i = 0; i < numberof(map); i++)
if ((size_t)RSTRING_LEN(str) == strlen(map[i].name) &&
memcmp(map[i].name, RSTRING_PTR(str), RSTRING_LEN(str)) == 0)
return map[i].version;
(Discussed with @rhenium on [email protected] and agreed to track here as a regular bug.)
- 主要語言
- C
- 星號
- 276
- 分支
- 205
- 平均合併
- 21 小時 17 分鐘
- 30 天內合併 PR
- 17
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
ruby/openssl 的其他 Issue
-
難度 4/5 3-5 天 新手友好度 55/100
維護者通常 1 天內回覆
-
Add OpenSSL::SSL::SSLContext#client_hello_cb= (binding for SSL_CTX_set_client_hello_cb())可能已有人在做 @kou 於 37 天前認領。 未關閉
難度 4/5 3-5 天 新手友好度 53/100
維護者通常 1 天內回覆
-
Documenting how to use OpenSSL::SSL::SSLContext in PQC use cases可能已有人在做 @junaruga 於 23 天前認領。 未關閉
難度 3/5 1-2 天 新手友好度 55/100
維護者通常 1 天內回覆
-
Expose XOFs like SHAKE128 and SHAKE256可能已有人在做 @rhenium 於 133 天前認領。 未關閉
難度 4/5 3-5 天 新手友好度 48/100
維護者通常 1 天內回覆
-
難度 5/5 一週以上 新手友好度 35/100
維護者通常 1 天內回覆
相似的 Issue
-
isolation2 lockmodes fails on cassert builds: extra AccessShareLock on partition root可能已有人在做 @tuhaihe 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 78/100
apache/cloudberry#2356 ·
維護者通常 2 天內回覆
-
難度 1/5 1 小時以內 新手友好度 86/100
-
難度 1/5 1-3 小時 新手友好度 78/100
crosspoint-reader/crosspoint-reader#4535 ·
維護者通常 1 天內回覆
-
[core] Clients never advertise RNS_UD_CS_SUPPORT_ERRINFO_PDU, so a conforming server can't send them Set Error Info可能已有人在做 @akallabeth 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 75/100
FreeRDP/FreeRDP#14230 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 1/5 1 小時以內 新手友好度 88/100
Genymobile/scrcpy#7178 ·
維護者通常 3 天內回覆