You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2017/02/07 13:12:19 UTC

[Bug 60704] New: Setting "HttpProtocolOptions Unsafe ..." does not allow Host Header containing "_"

https://bz.apache.org/bugzilla/show_bug.cgi?id=60704

            Bug ID: 60704
           Summary: Setting "HttpProtocolOptions Unsafe ..." does not
                    allow Host Header containing "_"
           Product: Apache httpd-2
           Version: 2.2.31
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core
          Assignee: bugs@httpd.apache.org
          Reporter: m.beier@enbw.com
  Target Milestone: ---

Hi,

actually this bug report affects 2.2.32, but this version is not available in
"Version" dropdown.

In a server to server communication we (accidently) are using hostnames
containing the underline character. With default settings apache 2.2.32 is
refusing to process requests with such hostnames and fails with a http status
400, bad request.

In my understanding the HttpProcotolOptions directive has been introduced to
bring back the legacy behaviour. In my case with hostnames containing underline
characters, this does not work. Requests are declined as "400 Bad Request",
though I set "HttpProtocolOptions Unsafe LenientMethods Allow0.9".

To reproduce start apache 2.2.32 with:
"HttpProtocolOptions Unsafe LenientMethods Allow0.9"

Run the following command:

curl -v -H "Host: bad_request_hostname" http://127.0.0.1/

It returns:

HTTP/1.1 400 Bad Request

With apache 2.4.25 the host header containing underlines is processed
correctly, if HttpProtocolOptions is set to Unsafe.

Best regards,
Michael

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 60704] Setting "HttpProtocolOptions Unsafe ..." does not allow Host Header containing "_"

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60704

--- Comment #7 from Jim Jagielski <ji...@apache.org> ---
In the above snippets I see conf being copied from base in both cases...

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 60704] Setting "HttpProtocolOptions Unsafe ..." does not allow Host Header containing "_"

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60704

Eric Covener <co...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All
            Version|2.2.31                      |2.2.32

--- Comment #1 from Eric Covener <co...@gmail.com> ---
I get the same result in 2.2.x and 2.4.x. I don't think HttpProtocolOptions was
meant to revert every strict processing change.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 60704] Setting "HttpProtocolOptions Unsafe ..." does not allow Host Header containing "_"

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60704

--- Comment #4 from Michael <m....@enbw.com> ---
I tested again on two different servers, same result again:

Apache 2.2.32 and 2.4.25 both configured with on vHost which has a ServerAlias
bad_request_hostname and HttpProtocolOptions Unsafe LenientMethods Allow0.9 in
server (not vHost!) context.

curl -v -H "Host: bad_request_hostname" http://127.0.0.1/

Apache 2.2.32: HTTP/1.1 400 Bad Request

Apache 2.4.25: HTTP/1.1 200 OK

I'm a little confused ..

Michael

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 60704] Setting "HttpProtocolOptions Unsafe ..." does not allow Host Header containing "_"

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60704

--- Comment #5 from Michael <m....@enbw.com> ---
Today I faced another issue, that's confusing me even more. Testcase is apache
2.4.25, HttpProtocolOptions set to "Unsafe LenientMethods Allow0.9".

1) curl -H "Host: my_invalid_hostname" -v http://localhost/
   Returns: HTTP/1.1 200 OK
   OK - Unsafe mode allows a Host header containing a underline.

2) curl -H "Accept<TAB>: application/xml" -v http://localhost/
   Returns: HTTP/1.1 400 Bad Request
   Debug output: Request header field name is malformed: Accept\t:
application/xml

Looking into the sourcecode (server/protocol.c, line 1130) the message "Request
header field name is malformed" only will be logged in strict mode, but not in
unsafe mode ..

Best regards,
Michael

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 60704] Setting "HttpProtocolOptions Unsafe ..." does not allow Host Header containing "_"

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60704

--- Comment #3 from Eric Covener <co...@gmail.com> ---
(In reply to Michael from comment #2)
> Hi Eric,
> 
> can you clarify, what the same result means?
> 
> Do you get the same results as I did:
> apache 2.4.x works and apache 2.2.x does not?
> 
> Or did apache 2.4.25 and 2.2.32 behave the same and work / do not work both?
> 

sorry, both rejected the underscore and HTTPProtocolOptions didn't change
either behavior.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 60704] Setting "HttpProtocolOptions Unsafe ..." does not allow Host Header containing "_"

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60704

--- Comment #2 from Michael <m....@enbw.com> ---
Hi Eric,

can you clarify, what the same result means?

Do you get the same results as I did:
apache 2.4.x works and apache 2.2.x does not?

Or did apache 2.4.25 and 2.2.32 behave the same and work / do not work both?

Michael

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 60704] Setting "HttpProtocolOptions Unsafe ..." does not allow Host Header containing "_"

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60704

--- Comment #8 from Eric Covener <co...@gmail.com> ---
(In reply to Jim Jagielski from comment #7)
> In the above snippets I see conf being copied from base in both cases...
This is already fixed in 2.2.x HEAD

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 60704] Setting "HttpProtocolOptions Unsafe ..." does not allow Host Header containing "_"

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60704

--- Comment #6 from paolo@adnovum.ch <pa...@adnovum.ch> ---
I have the same behaviour. Even with 
HttpProtocolOptions  Unsafe LenientMethods Allow0.9

requests may still be blocked, and I have the following log-entry:

[Thu Mar 09 11:02:51 2017] [debug] protocol.c(828): [client 10.0.209.5] HTTP
Request Line; Excess whitespace (disallowed by HttpProtocolOptions Strict


I compared the code with httpd/2.4.25 (where the request is not blocked), and
the functions merge_core_server_configs (core.c) do slightly differ:

in 2.2.32:
static void *merge_core_server_configs(apr_pool_t *p, void *basev, void *virtv)
{
    core_server_config *base = (core_server_config *)basev;
    core_server_config *virt = (core_server_config *)virtv;
    core_server_config *conf;

    conf = (core_server_config *)apr_pmemdup(p, base,
sizeof(core_server_config));

in 2.4.25:
static void *merge_core_server_configs(apr_pool_t *p, void *basev, void *virtv)
{
    core_server_config *base = (core_server_config *)basev;
    core_server_config *virt = (core_server_config *)virtv;
    core_server_config *conf = (core_server_config *)
                               apr_pmemdup(p, base,
sizeof(core_server_config));

As you can see, in 2.4.25 the 'conf' is taken from 'base' and not from 'virtv'
like in 2.2.32.
I changed the code in 2.2.32. and then the request is not blocked any more.
I have no idea if this is the right solution, because of the other parameters
that are used.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 60704] Setting "HttpProtocolOptions Unsafe ..." does not allow Host Header containing "_"

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60704

William A. Rowe Jr. <wr...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |MassUpdate
         Resolution|---                         |LATER
             Status|NEW                         |RESOLVED

--- Comment #9 from William A. Rowe Jr. <wr...@apache.org> ---
Please help us to refine our list of open and current defects; this is a mass
update of old and inactive Bugzilla reports which reflect user error, already
resolved defects, and still-existing defects in httpd.

As repeatedly announced, the Apache HTTP Server Project has discontinued all
development and patch review of the 2.2.x series of releases. The final release
2.2.34 was published in July 2017, and no further evaluation of bug reports or
security risks will be considered or published for 2.2.x releases. All reports
older than 2.4.x have been updated to status RESOLVED/LATER; no further action
is expected unless the report still applies to a current version of httpd.

If your report represented a question or confusion about how to use an httpd
feature, an unexpected server behavior, problems building or installing httpd,
or working with an external component (a third party module, browser etc.) we
ask you to start by bringing your question to the User Support and Discussion
mailing list, see [https://httpd.apache.org/lists.html#http-users] for details.
Include a link to this Bugzilla report for completeness with your question.

If your report was clearly a defect in httpd or a feature request, we ask that
you retest using a modern httpd release (2.4.33 or later) released in the past
year. If it can be reproduced, please reopen this bug and change the Version
field above to the httpd version you have reconfirmed with.

Your help in identifying defects or enhancements still applicable to the
current httpd server software release is greatly appreciated.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org