CVE-2026-58050 - libssh2 publickey attribute count integer overflow
CVE-2026-58050 + libssh2 publickey attribute count integer overflow + High + 2026-06-28
One-sentence business risk
A malicious SSH server can corrupt client memory, putting automation workers and deployment tooling at risk.
Research notes
- Root cause: libssh2 publickey listing trusts an attacker-controlled 32-bit attribute count and multiplies it by
sizeof(libssh2_publickey_attribute)without checking for overflow before allocation. - Affected versions: libssh2 through 1.11.1 on 32-bit platforms using publickey subsystem responses.
- Fixed / safe versions: upstream commit/release after 1.11.1 that bounds attribute allocation; disable publickey listing against untrusted servers until patched.
- Public exploit / PoC signal: public PoC or exploit details are referenced by NVD; use only safe regression tests and do not execute exploit payloads against production.
- CVSS: 7.0 CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:H.
Exact vulnerable code pattern
uint32_t count = read_u32(peer);
attrs = calloc(count, sizeof(*attrs));
for (i = 0; i < count; i++) attrs[i] = parse_attr(peer);
Fixed / mitigated code pattern
uint32_t count = read_u32(peer);
if (count > MAX_ATTRS || count > SIZE_MAX / sizeof(*attrs)) return PROTOCOL_ERROR;
attrs = calloc(count, sizeof(*attrs));
for (i = 0; i < count; i++) parse_attr_checked(peer, &attrs[i]);
Dependency or runtime update:
rg -n "libssh2_publickey|libssh2|publickey_list" .
# apply upstream fix after 1.11.1 or vendor distro patch
ctest --output-on-failure
Step-by-step integration guide
- Inventory
libssh2in source, lockfiles, SBOMs, CI images, containers, deployment manifests, and managed runtimes. - Upgrade or patch to
upstream commit/release after 1.11.1 that bounds attribute allocation; disable publickey listing against untrusted servers until patched; if no upstream package is available, apply the local guard shown above and track the vendor release as a blocking follow-up. - Replace every vulnerable
memory-safetypattern with a fail-closed implementation that validates ownership, bounds, canonical paths, origin/session binding, or parser limits before acting. - Add a regression test that reproduces the advisory shape safely and proves the request is rejected, bounded, or authorized.
- Deploy through canary, monitor auth, file, parser, crash, and CI-runner logs, then remove temporary edge blocks only after all runtimes are fixed.
Alternative mitigations
- Disable the vulnerable feature path, decoder, plugin, runner backend, proxy agent, or route while the patch rolls out.
- Add WAF/reverse-proxy rules for SQL metacharacters, traversal tokens, unsafe Docker flags, oversized/nested payloads, or unexpected session-origin transitions matching this trigger class.
- Restrict egress and access to untrusted artifacts, SSH servers, media uploads, workflow execution, and administrative delegation until fixed versions are verified.
- Rotate credentials and invalidate sessions if logs show the vulnerable path was reachable by untrusted users.
Detection signature
id: cve-2026-58050-libssh2-publickey-attribute-count-integer-overfl
source: NVD
package_or_product: "libssh2"
affected: "libssh2 through 1.11.1 on 32-bit platforms using publickey subsystem responses"
fixed: "upstream commit/release after 1.11.1 that bounds attribute allocation; disable publickey listing against untrusted servers until patched"
cvss: "7.0 CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:H"
signals:
- "memory-safety"
- "CVE-2026-58050"
- "libssh2"
action: "upgrade, add a regression test, and verify deploy artifact"
Copy-paste skill
You are remediating CVE-2026-58050 (libssh2 publickey attribute count integer overflow) in this repository.
Produce a reviewer-ready PR or TRIAGE.md. Inventory libssh2 across source, lockfiles, images, CI, deployment manifests, and SBOMs. Apply upstream commit/release after 1.11.1 that bounds attribute allocation; disable publickey listing against untrusted servers until patched. Replace the vulnerable memory-safety pattern with the fail-closed pattern, add a regression test for the advisory trigger, and document owner, rollout, rollback, and validation evidence. Do not run public exploit PoCs against production or expose secrets in logs.
Keywords, affected tech stack, and revenue tags
- Keywords:
CVE-2026-58050,memory-safety,libssh2,NVD. - Affected tech stack:
c/c++. - Revenue tags:
sellable_to_fintech,enterprise_blocker,high_priority_sla.