rootvector2 opened a new pull request, #1543:
URL: https://github.com/apache/httpcomponents-core/pull/1543

   `ForwardedRequest` builds the `host` parameter by concatenating `host="` + 
`authority.getHostName()` + `"`, with no `quoted-pair` escaping. The host name 
is whatever the client put in the `Host` header, and `Host.parse` happily 
accepts a `"`, so `Host: somehost",for=127.0.0.1;host="otherhost` comes back 
out as `host="somehost",for=127.0.0.1;host="otherhost";proto=HTTP`. That is a 
well formed two element `Forwarded` list whose second element is entirely 
client controlled, so a downstream node that takes `for=` from the closest 
element is handed an attacker chosen client address and any IP based trust 
decision on that field is void. Found while reading through the proxy 
interceptors in `http.protocol`.
   
   Escape `DQUOTE` and `\` per RFC 9110 section 5.6.4 at the three points where 
a quoted parameter is emitted. `by` and `for` share the helper because their 
values come from `InetSocketAddress.getHostString()`, which returns the host 
name the socket was created with and on a forwarded connection that name is 
also client supplied. The escaping belongs in the interceptor that assembles 
the field value, so no caller has to pre-sanitize the authority.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to