Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2026-54697 Overview
CVE-2026-54697 is an integer overflow vulnerability [CWE-190] in the ConnectBot SSH Client Library (cbssh), a Kotlin-based SSH library built on Kaitai Struct and KStateMachine. The flaw resides in DerReader.readLength(), which accepts excessive long-form Distinguished Encoding Rules (DER) length octets and accumulates them into an Int. Primitive readers then allocate arrays without validating the declared size against remaining input. Applications that load an attacker-controlled private key file through SshClient.authenticatePublicKey(), SshKeys.decodePemPrivateKey(), SshSigning.sign(), or SshSigning.getPublicKey() can trigger integer wraparound, excessive allocation, or an uncaught OutOfMemoryError. The issue is fixed in version 0.3.1.
Critical Impact
A malicious private-key file processed by the library causes a denial-of-service condition in the host application through memory exhaustion or unhandled runtime errors. No confidentiality or integrity impact has been demonstrated.
Affected Products
- ConnectBot SSH Client Library (cbssh) versions prior to 0.3.1
- Kotlin applications consuming cbssh for SSH authentication and key handling
- Android and JVM-based SSH clients embedding cbssh for PEM private key decoding
Discovery Timeline
- 2026-10-13 - CVE-2026-54697 published to the National Vulnerability Database
- 2026-10-13 - Last updated in NVD database
Technical Details for CVE-2026-54697
Vulnerability Analysis
The vulnerability is an integer overflow in the DER (Distinguished Encoding Rules) length parser used to decode PEM-encoded private key material. DER encoding permits a long-form length field where the first byte indicates how many subsequent bytes carry the actual length value. The ConnectBot DerReader.readLength() function does not cap the number of long-form length octets it will accept. It shifts and accumulates each byte into a signed 32-bit Int, which overflows when the attacker provides sufficient length bytes.
Downstream primitive readers trust the resulting length value and attempt to allocate backing arrays sized by the declared length. Because the allocation size is never compared against the remaining input buffer, the library requests arbitrarily large allocations. The runtime either wraps the integer to a negative or small positive value, allocates a multi-gigabyte buffer, or throws an unrecoverable OutOfMemoryError that propagates out of the SSH authentication path.
Root Cause
The root cause combines two defects. First, DerReader.readLength() accepts an unbounded number of long-form length octets rather than enforcing a sane maximum. Second, the primitive readers never cross-check the declared length against the number of bytes actually available in the input stream. Both conditions must be validated before allocation to prevent attacker-controlled sizing of memory.
Attack Vector
Exploitation requires an application or user to load an attacker-provided private key file through one of the exposed APIs: SshClient.authenticatePublicKey(), SshKeys.decodePemPrivateKey(), SshSigning.sign(), or SshSigning.getPublicKey(). The attack is local and requires user interaction to import or select the malicious key. SSH server host keys and agent-forwarding messages do not traverse this input path and are not affected.
The vulnerability manifests in the DER length-decoding routine. See the GitHub Security Advisory GHSA-vc8p-8pxg-rfwg and the GitHub Commit Details for the complete fix.
Detection Methods for CVE-2026-54697
Indicators of Compromise
- Application crashes or hangs after a user imports a .pem, .key, or similar private key file
- OutOfMemoryError entries in application logs originating from DerReader or SshKeys.decodePemPrivateKey stack frames
- Spikes in resident memory for processes embedding cbssh immediately following key-load operations
Detection Strategies
- Perform software composition analysis (SCA) across build manifests to identify cbssh dependencies below version 0.3.1
- Statically scan PEM files in user profiles for DER length prefixes exceeding a reasonable maximum (for example, more than four long-form length bytes)
- Add runtime assertions or wrappers around SshKeys.decodePemPrivateKey() that reject input files larger than expected private-key sizes
Monitoring Recommendations
- Alert on repeated OutOfMemoryError exceptions in SSH client processes, correlating with key-import events
- Monitor filesystem events for new private-key files written to user-accessible directories prior to SSH authentication attempts
- Track process memory growth and sudden terminations for applications linking cbssh to detect exploitation attempts
How to Mitigate CVE-2026-54697
Immediate Actions Required
- Upgrade all applications depending on ConnectBot cbssh to version 0.3.1 or later
- Audit distributed binaries and build pipelines for transitive dependencies on vulnerable cbssh versions
- Restrict private key imports to trusted sources and files reviewed by administrators
Patch Information
The maintainers released the fix in GitHub Release v0.3.1. The patch bounds the number of long-form DER length octets accepted by DerReader.readLength() and validates declared lengths against the remaining input before allocation. Review the GitHub Commit Details for implementation specifics.
Workarounds
- Until the upgrade is applied, do not load untrusted PEM private key files through SshClient.authenticatePublicKey(), SshKeys.decodePemPrivateKey(), SshSigning.sign(), or SshSigning.getPublicKey()
- Enforce a maximum file-size check on candidate private key files before passing them to the library (typical RSA 4096 PEM files are under 4 KB)
- Run SSH client processes under memory limits (for example, JVM -Xmx flags or Linux cgroups) so that an exploit terminates the process without affecting the wider host
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

