Skip to content

openssl: bound EC point length in ssh2_ecdsa_create_key() - #2541

Closed
abdul-khaliq-khalid wants to merge 1 commit into
libssh2:masterfrom
abdul-khaliq-khalid:ecdsa-create-key-point-bound
Closed

abdul-khaliq-khalid wants to merge 1 commit into
libssh2:masterfrom
abdul-khaliq-khalid:ecdsa-create-key-point-bound

Conversation

@abdul-khaliq-khalid

Copy link
Copy Markdown
Contributor

The OpenSSL 3 path of ssh2_ecdsa_create_key copies the generated public point into the fixed octal_value[EC_MAX_POINT_LEN] stack buffer, handing the length reported by EVP_PKEY_get_octet_string_param straight back as the destination capacity without checking it against the buffer. Every other point extraction in this file bounds the length against EC_MAX_POINT_LEN first, including the legacy path a few lines below in the same function. Add the same check right after the length is queried so both branches guard the stack write the same way.

@vszakats vszakats changed the title openssl: bound EC point length in ssh2_ecdsa_create_key openssl: bound EC point length in ssh2_ecdsa_create_key() Aug 27, 2026
@vszakats
vszakats requested a balanced review from Copilot August 27, 2026 10:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Bounds the OpenSSL 3 EC public-point length before writing to a fixed-size stack buffer.

Changes:

  • Rejects public points larger than EC_MAX_POINT_LEN.
  • Aligns OpenSSL 3 behavior with the legacy path.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@vszakats vszakats closed this in ede8045 Aug 27, 2026
@vszakats

Copy link
Copy Markdown
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants