High firefox Memory Corruption 🔧 Commit mapped

Overview

High
Severity
CVSS
No
Exploited ITW
Fixed
Fix Status
Impacthigh
DescriptionMemory safety bugs present in Firefox ESR 140.9.0, Thunderbird ESR 140.9.0, Firefox 149.0.1 and Thunderbird 149.0.1. Some of these bugs showed evidence of memory corruption and we presume that with enough effort some of these could have been exploited to run arbitrary code.
ComponentNetworking
Bug ClassMemory Corruption
Tracker2022369
Fix commitbfd859794be2 (firefox) +7/-1
CISA KEVNot listed
CreditedBrian Grinstead, Christian Holler, Tom Schuster and the Mozilla Fuzzing Team
Disclosed2026-04-07

Changed Functions

FunctionChangeNotes
if
netwerk/cookie/CookieStorage.cpp
modified

Files Changed

  • netwerk/cookie/CookieStorage.cpp
diff --git a/netwerk/cookie/CookieStorage.cpp b/netwerk/cookie/CookieStorage.cpp
index 3b811fc0815..8df262aa8f1 100644
--- a/netwerk/cookie/CookieStorage.cpp
+++ b/netwerk/cookie/CookieStorage.cpp
@@ -609,6 +609,7 @@ void CookieStorage::RemoveOlderCookiesByBytes(CookieEntry* aEntry,
                                               uint32_t removeBytes,
                                               nsCOMPtr<nsIArray>& aPurgedList) {
   MOZ_ASSERT(aEntry);
+  CookieKey key(aEntry->mBaseDomain, aEntry->mOriginAttributes);
 
   // remove insecure older cookies until we are within the byte limit
   // (CHIPS cookies will not be detected here since they must be secure)
@@ -617,11 +618,16 @@ void CookieStorage::RemoveOlderCookiesByBytes(CookieEntry* aEntry,
 
   // remove secure cookies if we still have cookies to remove
   if (bytesRemoved <= removeBytes) {
+    // Re-lookup: aEntry may have been freed if pass 1 emptied it.
+    CookieEntry* entry = mHostTable.GetEntry(key);
+    if (!entry) {
+      return;
+    }
     // remove secure older cookies until we are within the byte limit
     MOZ_LOG(gCookieLog, LogLevel::Debug,
             ("Still too many cookies for partition, purging secure\n"));
     uint32_t bytesStillToRemove = removeBytes - bytesRemoved;
-    RemoveOldestCookies(aEntry, true, bytesStillToRemove, aPurgedList);
+    RemoveOldestCookies(entry, true, bytesStillToRemove, aPurgedList);
   }
 }
 
Loading diff…