Hi Dickson,

Thanks for the detailed analysis.

All three issues appear valid. The Expires and Path cases deviate from the
mandatory algorithms in RFC 6265, while the Domain case concerns a
SHOULD-level requirement.

I would suggest addressing them in separate pull requests, starting with
Expires.

Cheers,

Arturo

On Tue, 17 Nov 2026 at 8:31 PM, Dickson Wu via dev <[email protected]>
wrote:

> Hi all,
>
> I'm Dickson, a security researcher at SEAL & CertiK. While running the
> public http-state cookie tests against HttpClient I hit three spots where
> the RFC 6265 cookie spec behaves differently from the RFC. None of them has
> security impact as far as I can tell - they're interop issues. I don't have
> a JIRA account yet, so I'm sending them here first. Happy to open JIRA
> tickets instead if you'd rather track them there.
>
> All three reproduce on 5.7-beta1 from Maven Central and on master b202e12,
> using RFC6265CookieSpecFactory in STRICT mode.
>
> 1. Expires with a mismatched weekday is rejected. RFC 6265 5.1.1 only uses
> the time, day, month and year tokens, so a valid date whose weekday doesn't
> match should still be accepted. HttpClient's date parse fails and the whole
> cookie is dropped (http-state cases 0002, 0003, comma0006, comma0007). For
> example "a=b; Expires=Mon, 01 Jan 2030 00:00:00 GMT" (that date is a
> Tuesday).
>
> https://www.google.com/url?q=https://github.com/apache/httpcomponents-client/blob/b202e125f2144bf4bc136d91895abf18fecf5fba/httpclient5/src/main/java/org/apache/hc/client5/http/impl/cookie/BasicExpiresHandler.java%23L84-L89&source=gmail&ust=1795021508838000&sa=E
>
> 2. A Path ending in a slash matches the path without it. Per 5.1.4, cookie
> path "/foo/" shouldn't match a request for "/foo", but pathMatch() strips
> the trailing slash first, so the cookie gets sent (case path0014). Section
> 8.5 already says Path isn't a security boundary, so this is just
> conformance.
>
> https://www.google.com/url?q=https://github.com/apache/httpcomponents-client/blob/b202e125f2144bf4bc136d91895abf18fecf5fba/httpclient5/src/main/java/org/apache/hc/client5/http/impl/cookie/BasicPathHandler.java%23L70-L95&source=gmail&ust=1795021508838000&sa=E
>
> 3. An empty Domain attribute after a valid one rejects the cookie. Per
> 5.2.3 the empty "Domain=" should be ignored and the earlier Domain=
>
> https://www.google.com/url?q=http://example.com&source=gmail&ust=1795021508838000&sa=E
> kept. The attribute map keeps only the last value, and BasicDomainHandler
> then rejects it as blank (case optional-domain0041).
>
> https://www.google.com/url?q=https://github.com/apache/httpcomponents-client/blob/b202e125f2144bf4bc136d91895abf18fecf5fba/httpclient5/src/main/java/org/apache/hc/client5/http/impl/cookie/RFC6265CookieSpec.java%23L172-L187&source=gmail&ust=1795021508838000&sa=E
>
> https://www.google.com/url?q=https://github.com/apache/httpcomponents-client/blob/b202e125f2144bf4bc136d91895abf18fecf5fba/httpclient5/src/main/java/org/apache/hc/client5/http/impl/cookie/BasicDomainHandler.java%23L63-L69&source=gmail&ust=1795021508838000&sa=E
>
> I left out quoted values since HTTPCLIENT-661 and HTTPCLIENT-1006 already
> cover them.
>
> I don't have a patch for these yet. The Expires one probably needs a looser
> date parser, and the Domain one needs the attributes processed in order, so
> I wanted to check whether you'd want any of them changed before writing
> one.
>
> Best,
> Dickson
>

Reply via email to