Impact
Attackers can cause excessive memory usage in SSH clients or servers by
sending compressed packets that expand to excessive sizes when
decompressed. On systems with limited memory resources, this can lead
to crashes.
Two compression algorithms are affected:
zlib: Activates immediately after key exchange, enabling
unauthenticated attacks
zlib@openssh.com: Activates post-authentication, enabling
authenticated attacks
Both algorithms lack decompression size limits and are vulnerable to
decompression bombs. The vulnerability affects:
- SSH servers: Unauthenticated attacks via
zlib, authenticated attacks
via zlib@openssh.com
- SSH clients: Unauthenticated attacks via
zlib from malicious servers,
authenticated attacks via zlib@openssh.com after client authenticates
to malicious server
Each SSH packet can decompress ~255 MB from 256 KB of wire data
(1029:1 amplification ratio). This high compression ratio is achieved
by compressing highly repetitive data such as sequences of zeros.
Multiple packets in a single connection or across multiple connections
can rapidly exhaust available memory, causing OOM kills in
memory-constrained environments or consumption of excessive system
resources.
With the default configuration (parallel_login=false), an attack can
consume around a couple hundred megabytes of memory. When
parallel_login=true, memory consumption can reach multiple gigabytes.
Removing zlib from defaults mitigates unauthenticated attacks but does
not fully resolve the vulnerability. Authenticated attacks remain
possible via zlib@openssh.com for both clients and servers.
Workarounds
For vulnerable versions, the recommended mitigation is to disable all compression algorithms:
Best workaround - Disable all compression:
{preferred_algorithms, [{compression, ['none']}]}
Alternative mitigations (less secure):
-
Disable only pre-auth zlib compression (authenticated users can still exploit via zlib@openssh.com):
{modify_algorithms, [{rm, [{compression, ['zlib']}]}]}
-
Limit concurrent sessions (reduces attack surface but does not prevent exploitation):
{max_sessions, N} % Cap total concurrent sessions (default is infinity)
Affected/Unaffected Versions
A version larger than or equal to one of the listed patched versions is unaffected; otherwise, a version that satisfies an expression listed under affected versions is affected, and if it does not, it is unaffected.
The documentation of the new OTP version scheme describes how versions should be compared. Note that versions used prior to OTP 17.0, when the new OTP version scheme was introduced, are never listed since it is not well defined how to compare those versions.
In the case of this vulnerability, versions prior to OTP 17.0 are also affected.
Credits
Thanks to Igor Morgenstern at Aisle Research for finding and responsibly disclosing this vulnerability to the Erlang/OTP project.
Impact
Attackers can cause excessive memory usage in SSH clients or servers by
sending compressed packets that expand to excessive sizes when
decompressed. On systems with limited memory resources, this can lead
to crashes.
Two compression algorithms are affected:
zlib: Activates immediately after key exchange, enablingunauthenticated attacks
zlib@openssh.com: Activates post-authentication, enablingauthenticated attacks
Both algorithms lack decompression size limits and are vulnerable to
decompression bombs. The vulnerability affects:
zlib, authenticated attacksvia
zlib@openssh.comzlibfrom malicious servers,authenticated attacks via
zlib@openssh.comafter client authenticatesto malicious server
Each SSH packet can decompress ~255 MB from 256 KB of wire data
(1029:1 amplification ratio). This high compression ratio is achieved
by compressing highly repetitive data such as sequences of zeros.
Multiple packets in a single connection or across multiple connections
can rapidly exhaust available memory, causing OOM kills in
memory-constrained environments or consumption of excessive system
resources.
With the default configuration (
parallel_login=false), an attack canconsume around a couple hundred megabytes of memory. When
parallel_login=true, memory consumption can reach multiple gigabytes.Removing
zlibfrom defaults mitigates unauthenticated attacks but doesnot fully resolve the vulnerability. Authenticated attacks remain
possible via
zlib@openssh.comfor both clients and servers.Workarounds
For vulnerable versions, the recommended mitigation is to disable all compression algorithms:
Best workaround - Disable all compression:
{preferred_algorithms, [{compression, ['none']}]}Alternative mitigations (less secure):
Disable only pre-auth zlib compression (authenticated users can still exploit via
zlib@openssh.com):{modify_algorithms, [{rm, [{compression, ['zlib']}]}]}Limit concurrent sessions (reduces attack surface but does not prevent exploitation):
{max_sessions, N} % Cap total concurrent sessions (default is infinity)Affected/Unaffected Versions
A version larger than or equal to one of the listed patched versions is unaffected; otherwise, a version that satisfies an expression listed under affected versions is affected, and if it does not, it is unaffected.
The documentation of the new OTP version scheme describes how versions should be compared. Note that versions used prior to OTP 17.0, when the new OTP version scheme was introduced, are never listed since it is not well defined how to compare those versions.
In the case of this vulnerability, versions prior to OTP 17.0 are also affected.
Credits
Thanks to Igor Morgenstern at Aisle Research for finding and responsibly disclosing this vulnerability to the Erlang/OTP project.