mirror of
https://git.yoctoproject.org/poky
synced 2026-04-20 00:32:13 +02:00
curl: Backport patch for CVE-2022-35252
https://curl.se/docs/CVE-2022-35252.html (From OE-Core rev: 40bbdb43b247ffc5dd1990f51fb824a089c0987f) Signed-off-by: Robert Joslyn <robert.joslyn@redrectangle.org> Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
2c42fa484a
commit
68dfce5f52
72
meta/recipes-support/curl/curl/CVE-2022-35252.patch
Normal file
72
meta/recipes-support/curl/curl/CVE-2022-35252.patch
Normal file
@@ -0,0 +1,72 @@
|
||||
From 62c09239ac4e08239c8e363b06901fc80637d8c7 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Stenberg <daniel@haxx.se>
|
||||
Date: Mon, 29 Aug 2022 00:09:17 +0200
|
||||
Subject: [PATCH] cookie: reject cookies with "control bytes"
|
||||
|
||||
Rejects 0x01 - 0x1f (except 0x09) plus 0x7f
|
||||
|
||||
Reported-by: Axel Chong
|
||||
|
||||
Bug: https://curl.se/docs/CVE-2022-35252.html
|
||||
|
||||
CVE-2022-35252
|
||||
|
||||
Closes #9381
|
||||
|
||||
Upstream-Status: Backport [https://github.com/curl/curl/commit/8dfc93e573ca740544a2d79ebb]
|
||||
|
||||
Signed-off-by: Robert Joslyn <robert.joslyn@redrectangle.org>
|
||||
---
|
||||
lib/cookie.c | 29 +++++++++++++++++++++++++++++
|
||||
1 file changed, 29 insertions(+)
|
||||
|
||||
diff --git a/lib/cookie.c b/lib/cookie.c
|
||||
index cb0c03b..e0470a1 100644
|
||||
--- a/lib/cookie.c
|
||||
+++ b/lib/cookie.c
|
||||
@@ -438,6 +438,30 @@ static bool bad_domain(const char *domain)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
+/*
|
||||
+ RFC 6265 section 4.1.1 says a server should accept this range:
|
||||
+
|
||||
+ cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
|
||||
+
|
||||
+ But Firefox and Chrome as of June 2022 accept space, comma and double-quotes
|
||||
+ fine. The prime reason for filtering out control bytes is that some HTTP
|
||||
+ servers return 400 for requests that contain such.
|
||||
+*/
|
||||
+static int invalid_octets(const char *p)
|
||||
+{
|
||||
+ /* Reject all bytes \x01 - \x1f (*except* \x09, TAB) + \x7f */
|
||||
+ static const char badoctets[] = {
|
||||
+ "\x01\x02\x03\x04\x05\x06\x07\x08\x0a"
|
||||
+ "\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14"
|
||||
+ "\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x7f"
|
||||
+ };
|
||||
+ size_t vlen, len;
|
||||
+ /* scan for all the octets that are *not* in cookie-octet */
|
||||
+ len = strcspn(p, badoctets);
|
||||
+ vlen = strlen(p);
|
||||
+ return (len != vlen);
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* Curl_cookie_add
|
||||
*
|
||||
@@ -590,6 +614,11 @@ Curl_cookie_add(struct Curl_easy *data,
|
||||
badcookie = TRUE;
|
||||
break;
|
||||
}
|
||||
+ if(invalid_octets(whatptr) || invalid_octets(name)) {
|
||||
+ infof(data, "invalid octets in name/value, cookie dropped");
|
||||
+ badcookie = TRUE;
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
else if(!len) {
|
||||
/*
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@@ -28,6 +28,7 @@ SRC_URI = "https://curl.se/download/${BP}.tar.xz \
|
||||
file://CVE-2022-32206.patch \
|
||||
file://CVE-2022-32207.patch \
|
||||
file://CVE-2022-32208.patch \
|
||||
file://CVE-2022-35252.patch \
|
||||
"
|
||||
SRC_URI[sha256sum] = "0aaa12d7bd04b0966254f2703ce80dd5c38dbbd76af0297d3d690cdce58a583c"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user