Limiting output buffer for unauthenticated client (CVE-2025-21605) (#13993)
CI / test-ubuntu-latest (push) Has been cancelled Details
CI / test-sanitizer-address (push) Has been cancelled Details
CI / build-debian-old (push) Has been cancelled Details
CI / build-macos-latest (push) Has been cancelled Details
CI / build-32bit (push) Has been cancelled Details
CI / build-libc-malloc (push) Has been cancelled Details
CI / build-centos-jemalloc (push) Has been cancelled Details
CI / build-old-chain-jemalloc (push) Has been cancelled Details
Codecov / code-coverage (push) Has been cancelled Details
External Server Tests / test-external-standalone (push) Has been cancelled Details
External Server Tests / test-external-cluster (push) Has been cancelled Details
External Server Tests / test-external-nodebug (push) Has been cancelled Details
Spellcheck / Spellcheck (push) Has been cancelled Details

For unauthenticated clients the output buffer is limited to prevent them
from abusing it by not reading the replies
This commit is contained in:
YaacovHazan 2025-04-30 09:58:51 +03:00 committed by GitHub
parent 14dd59ab12
commit de16bee70a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 0 deletions

View File

@ -4217,6 +4217,11 @@ int checkClientOutputBufferLimits(client *c) {
int soft = 0, hard = 0, class; int soft = 0, hard = 0, class;
unsigned long used_mem = getClientOutputBufferMemoryUsage(c); unsigned long used_mem = getClientOutputBufferMemoryUsage(c);
/* For unauthenticated clients the output buffer is limited to prevent
* them from abusing it by not reading the replies */
if (used_mem > 1024 && authRequired(c))
return 1;
class = getClientType(c); class = getClientType(c);
/* For the purpose of output buffer limiting, masters are handled /* For the purpose of output buffer limiting, masters are handled
* like normal clients. */ * like normal clients. */

View File

@ -58,6 +58,24 @@ start_server {tags {"auth external:skip"} overrides {requirepass foobar}} {
assert_match {*unauthenticated bulk length*} $e assert_match {*unauthenticated bulk length*} $e
$rr close $rr close
} }
test {For unauthenticated clients output buffer is limited} {
set rr [redis [srv "host"] [srv "port"] 1 $::tls]
$rr SET x 5
catch {[$rr read]} e
assert_match {*NOAUTH Authentication required*} $e
# Fill the output buffer in a loop without reading it and make
# sure the client disconnected.
# Considering the socket eat some of the replies, we are testing
# that such client can't consume more than few MB's.
catch {
for {set j 0} {$j < 1000000} {incr j} {
$rr SET x 5
}
} e
assert_match {I/O error reading reply} $e
}
} }
start_server {tags {"auth_binary_password external:skip"}} { start_server {tags {"auth_binary_password external:skip"}} {