Firefox · Networking
CVE-2025-8037
Logic Error in Networking
Overview
Medium
Severity
—
CVSS
No
Exploited ITW
Fixed
Fix Status
Changed Functions
| Function | Change | Notes |
|---|---|---|
ifnetwerk/cookie/CookieValidation.cpp |
modified |
Files Changed
modules/libpref/init/StaticPrefList.yamlnetwerk/cookie/CookieValidation.cpptesting/web-platform/meta/cookies/name/name.html.ini
Patch
diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml
index ce9bd259a86..6cab7827923 100644
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -13136,6 +13136,12 @@
value: true
mirror: always
+# When true, Firefox will reject nameless cookies that contain `=` in value.
+- name: network.cookie.block_nameless_with_equal_char
+ type: RelaxedAtomicBool
+ value: true
+ mirror: always
+
# If we should attempt to race the cache and network.
- name: network.http.rcwn.enabled
type: bool
diff --git a/netwerk/cookie/CookieValidation.cpp b/netwerk/cookie/CookieValidation.cpp
index f1d4147af97..004cb6e3422 100644
--- a/netwerk/cookie/CookieValidation.cpp
+++ b/netwerk/cookie/CookieValidation.cpp
@@ -547,10 +547,19 @@ bool CookieValidation::CheckValue(const CookieStruct& aCookieData) {
const auto* start = aCookieData.value().BeginReading();
const auto* end = aCookieData.value().EndReading();
+ bool shouldBlockEqualInNamelessCookie =
+ aCookieData.name().IsEmpty() &&
+ StaticPrefs::network_cookie_block_nameless_with_equal_char();
+
auto charFilter = [&](unsigned char c) {
if (StaticPrefs::network_cookie_blockUnicode() && c >= 0x80) {
return true;
}
+
+ if (c == '=' && shouldBlockEqualInNamelessCookie) {
+ return true;
+ }
+
return std::find(std::begin(illegalCharacters), std::end(illegalCharacters),
c) != std::end(illegalCharacters);
};
diff --git a/testing/web-platform/meta/cookies/name/name.html.ini b/testing/web-platform/meta/cookies/name/name.html.ini
index 39785c86831..cf11472bb02 100644
--- a/testing/web-platform/meta/cookies/name/name.html.ini
+++ b/testing/web-platform/meta/cookies/name/name.html.ini
@@ -3,3 +3,7 @@
expected:
if (os == "mac") and not debug: FAIL
[FAIL, PASS]
+ [Set a nameless cookie (that has an = in its value)]
+ expected: FAIL
+ [Set a nameless cookie (that has multiple ='s in its value)]
+ expected: FAIL
Loading diff…
Regression Test / PoC
shipped with the fix
diff --git a/testing/web-platform/meta/cookies/name/name.html.ini b/testing/web-platform/meta/cookies/name/name.html.ini
index 39785c86831..cf11472bb02 100644
--- a/testing/web-platform/meta/cookies/name/name.html.ini
+++ b/testing/web-platform/meta/cookies/name/name.html.ini
@@ -3,3 +3,7 @@
expected:
if (os == "mac") and not debug: FAIL
[FAIL, PASS]
+ [Set a nameless cookie (that has an = in its value)]
+ expected: FAIL
+ [Set a nameless cookie (that has multiple ='s in its value)]
+ expected: FAIL
Loading diff…
References
On This Page