CVE-2003-0695
Description
Multiple "buffer management errors" in OpenSSH before 3.7.1 may allow attackers to cause a denial of service or execute arbitrary code using (1) buffer_init in buffer.c, (2) buffer_free in buffer.c, or (3) a separate function in channels.c, a different vulnerability than CVE-2003-0693.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Affected products
1Patches
Vulnerability mechanics
Root cause
"Incorrect ordering of allocation-size updates and memory operations in buffer and channel management functions leads to inconsistent state."
Attack vector
An attacker can trigger these buffer management errors by sending crafted SSH protocol messages that cause the internal buffer or channel array to be resized. The advisory states it is uncertain whether these errors are exploitable, but they could lead to denial of service or arbitrary code execution. The preconditions are network access to an OpenSSH server (sshd) running a version prior to 3.7.1. No authentication is required to reach the vulnerable code paths.
Affected code
The bugs reside in `buffer.c` (functions `buffer_init`, `buffer_free`, and `buffer_append_space`) and `channels.c` (the channel array expansion logic in `channel_new`). In `buffer_init`, the allocation size was stored before the buffer was allocated, leaving a window where `buffer->alloc` could be stale. In `buffer_free`, the code unconditionally accessed `buffer->alloc` without checking if it was valid. In `buffer_append_space`, the allocation size was updated after `xrealloc`, so a failure could leave `buffer->alloc` inconsistent. In `channels.c`, `channels_alloc` was incremented before `xrealloc`, causing the reallocation to use the wrong (already-incremented) size.
What the fix does
The patch reorders operations in `buffer_init` so that `buffer->alloc` is set only after `xmalloc` succeeds, preventing a stale allocation size. In `buffer_free`, a guard (`if (buffer->alloc > 0)`) prevents calling `memset` and `xfree` on an uninitialized or zero-size buffer. In `buffer_append_space`, the new allocation size is computed into a local variable `newlen` and assigned to `buffer->alloc` only after `xrealloc` returns, ensuring consistency. In `channels.c`, the `xrealloc` call now uses `(channels_alloc + 10) * sizeof(Channel *)` before incrementing `channels_alloc`, so the correct size is passed to the reallocation.
Preconditions
- networkNetwork access to an OpenSSH server (sshd) prior to 3.7.1
- inputAbility to send crafted SSH protocol messages that trigger buffer or channel resizing
Generated on Jun 16, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
12- www.debian.org/security/2003/dsa-383nvdPatchVendor Advisory
- www.redhat.com/support/errata/RHSA-2003-280.htmlnvdPatchVendor Advisory
- distro.conectiva.com.br/atualizacoes/nvd
- marc.infonvd
- marc.infonvd
- marc.infonvd
- marc.infonvd
- marc.infonvd
- www.debian.org/security/2003/dsa-382nvd
- www.mandriva.com/security/advisoriesnvd
- www.openssh.com/txt/buffer.advnvd
- oval.cisecurity.org/repository/search/definition/oval%3Aorg.mitre.oval%3Adef%3A452nvd
News mentions
0No linked articles in our index yet.