]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Do not update StoreEntry expiration after errorAppendEntry() (#1580)
authorAlex Rousskov <rousskov@measurement-factory.com>
Sun, 12 Nov 2023 09:33:20 +0000 (09:33 +0000)
committerAmos Jeffries <yadij@users.noreply.github.com>
Tue, 28 Nov 2023 14:03:29 +0000 (03:03 +1300)
errorAppendEntry() is responsible for setting entry expiration times,
which it does by calling StoreEntry::storeErrorResponse() that calls
StoreEntry::negativeCache().

This change was triggered by a vulnerability report by Joshua Rogers at
https://megamansec.github.io/Squid-Security-Audit/cache-uaf.html where
it was filed as "Use-After-Free in Cache Manager Errors". The reported
"use after free" vulnerability was unknowingly addressed by 2022 commit
1fa761a that removed excessively long "reentrant" store_client calls
responsible for the disappearance of the properly locked StoreEntry in
this (and probably other) contexts.

src/cache_manager.cc

index 61c7f65be62e945d570d37fdc10b5791ad784e16..65bf22dd074162f7c16dd42af92196449f18812f 100644 (file)
@@ -326,7 +326,6 @@ CacheManager::start(const Comm::ConnectionPointer &client, HttpRequest *request,
         err->url = xstrdup(entry->url());
         err->detailError(new ExceptionErrorDetail(Here().id()));
         errorAppendEntry(entry, err);
-        entry->expires = squid_curtime;
         return;
     }