Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP5:GA
curl.26477
curl-CVE-2022-35252.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File curl-CVE-2022-35252.patch of Package curl.26477
From 20612d1797807826a5730dee2e74c876b8de01d9 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg <daniel@haxx.se> Date: Mon, 22 Aug 2022 08:30:28 +0200 Subject: [PATCH] cookie: reject cookies with "control bytes" Rejects 0x01 - 0x1f (except 0x09) plus 0x7f Reported-by: Axel Chong --- lib/cookie.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) Index: curl-7.66.0/lib/cookie.c =================================================================== --- curl-7.66.0.orig/lib/cookie.c +++ curl-7.66.0/lib/cookie.c @@ -410,6 +410,30 @@ static bool bad_domain(const char *domai return !strchr(domain, '.') && !strcasecompare(domain, "localhost"); } +/* + Syntax (from RFC 6265) says: + + 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() @@ -556,6 +580,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) { /* this was a "<name>=" with no content, and we must allow
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor