Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

SSH.NET Fails to Strictly Adhere to SSH Protocol Standards

未關閉
#1,568 1 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 3 天內回覆

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
42/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
csharp

研究方向

從 RFC 4253 和 RFC 5656 開始,然後重現所描述的兩種情況:大小寫混合的橢圓曲線名稱,以及使用八位元組字串表示 r 和 s 的 ECDSA 簽章。檢視涉及的 SSH.NET 驗證路徑,並為通訊協定邊界情況新增完整的測試。當格式錯誤的名稱和簽章能依照標準一致地被拒絕時,即表示完成。

由索引模型根據 Issue 內容生成。

描述

Issue Summary: SSH.NET Fails to Strictly Adhere to SSH Protocol Standards
1. Elliptic Curve Name Case Sensitivity

According to [RFC 5656], the elliptic curve name must strictly match the defined format, which is case-sensitive. For example, nistp256 (all lowercase) is the correct identifier for the NIST P-256 curve. However, SSH.NET incorrectly accepts nistP256 (mixed case) without raising an error.

Observed Behavior:

  • SSH.NET tolerates curve names with incorrect case (e.g., nistP256), while strict implementations like OpenSSH reject these values, leading to compatibility issues.

Impact:

  • This behavior violates the SSH protocol standard, potentially causing interoperability problems with compliant clients/servers.
  • It may obscure configuration errors, leading to production issues that are difficult to debug.

Suggested Fix:

  • Ensure that SSH.NET strictly enforces case-sensitive validation of elliptic curve names as defined in the standard.

2. Improper Handling of ECDSA Signature Format

The ECDSA signature in SSH must follow the format specified in RFC 4253:

  • The signature is an ecdsa_signature_blob containing two mpint values: r and s.

However, SSH.NET does not validate the format of the signature and accepts invalid representations, such as encoding r and s as octet strings instead of mpint.

Observed Behavior:

  • When the server sends an invalid ECDSA signature (e.g., r and s encoded as octet strings), SSH.NET does not report an error.
  • Strict clients, like OpenSSH, correctly reject such signatures with errors such as "Signature from server's host key is invalid."

Impact:

  • Interoperability Risk: Inconsistent behavior when communicating with standards-compliant clients.
  • Security Risk: Weak or incorrect signature validation could expose users to potential attacks (e.g., replay attacks or signature forgery).

Suggested Fix:

  • Implement strict validation of the ecdsa_signature_blob to ensure r and s are properly formatted as mpint values.

3. Steps to Reproduce
Case Sensitivity Issue:
  1. Configure SSH.NET to use the nistP256 curve name.
  2. Attempt to connect to a strict client/server, such as OpenSSH.
  3. Observe that SSH.NET establishes the connection, while OpenSSH rejects the curve name if it’s mismatched.
Invalid ECDSA Signature Issue:
  1. Set up an SSH server to send an ECDSA signature with r and s encoded as octet strings.
  2. Use SSH.NET to connect to the server.
  3. Observe that SSH.NET accepts the connection, while OpenSSH fails with a signature validation error.

4. Proposed Actions
  • Validation Enforcement: Add strict checks for curve names and signature format in SSH.NET.
  • Comprehensive Testing: Introduce test cases to cover protocol edge cases and ensure compliance with RFC standards.
  • Community Discussion: Gather feedback on the potential impacts of enforcing stricter validation and provide configuration options if needed.

5. References
主要語言
C#
星號
4.4k
分支
988
平均合併
4 天 22 小時
30 天內合併 PR
5

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

sshnet/SSH.NET 的其他 Issue

查看 sshnet/SSH.NET 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。