You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Tyler Benson (JIRA)" <ji...@apache.org> on 2017/01/17 22:27:26 UTC

[jira] [Updated] (HTTPCLIENT-1803) Malformed path not handled well

     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1803?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tyler Benson updated HTTPCLIENT-1803:
-------------------------------------
    Description: 
When using URIBuilder's constructor with a malformed url argument, host passed in by {{setHost}} call not honored.

{quote}
        String path = "@notexample.com/mypath"
        URI uri = new URIBuilder(path).setHost("example.com").build();
        org.junit.Assert.assertEquals("example.com", uri.getHost())
{quote}

This is caused by the original string being passed into the constructor being treated as the path, but not verifying the presence of a leading {{/}} character.
This can be seen with other arguments:

{{path = "example"}} -> {{//example.comexample}}

Fix:  URIBuilder should ensure path starts with a leading {{/}}.

Reason priority is considered Major:
In our case, this caused a security vulnerability because the user provided path was able to override our specified host, resulting in giving network access to a sensitive environment.  We worked around this in our code by ensuring the leading {{/}}, but this seems like something better handled by the framework.

  was:
When using URIBuilder's constructor with a malformed url argument, host passed in by {{setHost}} call not honored.

{{
        String path = "@notexample.com/mypath"
        URI uri = new URIBuilder(path).setHost("example.com").build();
        org.junit.Assert.assertEquals("example.com", uri.getHost())
}}

This is caused by the original string being passed into the constructor being treated as the path, but not verifying the presence of a leading {{/}} character.
This can be seen with other arguments:

{{path = "example"}} -> {{//example.comexample}}

Fix:  URIBuilder should ensure path starts with a leading {{/}}.

Reason priority is considered Major:
In our case, this caused a security vulnerability because the user provided path was able to override our specified host, resulting in giving network access to a sensitive environment.  We worked around this in our code by ensuring the leading {{/}}, but this seems like something better handled by the framework.


> Malformed path not handled well
> -------------------------------
>
>                 Key: HTTPCLIENT-1803
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1803
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient (async), HttpClient (classic)
>    Affects Versions: 4.5.1
>            Reporter: Tyler Benson
>
> When using URIBuilder's constructor with a malformed url argument, host passed in by {{setHost}} call not honored.
> {quote}
>         String path = "@notexample.com/mypath"
>         URI uri = new URIBuilder(path).setHost("example.com").build();
>         org.junit.Assert.assertEquals("example.com", uri.getHost())
> {quote}
> This is caused by the original string being passed into the constructor being treated as the path, but not verifying the presence of a leading {{/}} character.
> This can be seen with other arguments:
> {{path = "example"}} -> {{//example.comexample}}
> Fix:  URIBuilder should ensure path starts with a leading {{/}}.
> Reason priority is considered Major:
> In our case, this caused a security vulnerability because the user provided path was able to override our specified host, resulting in giving network access to a sensitive environment.  We worked around this in our code by ensuring the leading {{/}}, but this seems like something better handled by the framework.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org