Bug 48719 - [BUG] mod_proxy_ajp return wrong error message when client cookie is very big
Summary: [BUG] mod_proxy_ajp return wrong error message when client cookie is very big
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_proxy_ajp (show other bugs)
Version: 2.2.4
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
Keywords: ErrorMessage, MassUpdate
Depends on:
Reported: 2010-02-09 22:56 UTC by Kevin Q
Modified: 2018-11-07 21:08 UTC (History)
2 users (show)

test jsp page (739 bytes, application/octet-stream)
2010-02-09 22:56 UTC, Kevin Q

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Q 2010-02-09 22:56:37 UTC
Created attachment 24959 [details]
test jsp page

1 error in apache-mod_proxy_ajp
1.1 In apache-mod_proxy_ajp-tomcat connection,
when jsp page on tomcat trys to create a very big cookie(about 8000B) to user explorer, (or just try to read a very big cookie from user explorer),
error occurs.

With the size of cookie changed,
the following error log generated(in apache/logs/error_log):

[Tue Feb 09 14:02:40 2010] [error] ajp_msg_get_string(): 
BufferOverflowException 8188 8192
[Tue Feb 09 14:02:40 2010] [error] ajp_unmarshal_response: Null header name
[Tue Feb 09 14:02:40 2010] [error] (120001)APR does not understand this 
error code: proxy: send body failed to (

[Tue Feb 09 12:37:22 2010] [error] ajp_check_msg_header() incoming message 
is too big 8196, max is 8192
[Tue Feb 09 12:37:22 2010] [error] ajp_ilink_receive() received bad header
[Tue Feb 09 12:37:22 2010] [error] ajp_read_header: ajp_ilink_receive failed
[Tue Feb 09 12:37:22 2010] [error] (120007)APR does not understand this 
error code: proxy: send body failed to (

[Tue Feb 09 13:42:22 2010] [error] (70014)End of file found: 
ajp_ilink_receive() can't receive header
[Tue Feb 09 13:42:22 2010] [error] ajp_read_header: ajp_ilink_receive failed
[Tue Feb 09 13:42:22 2010] [error] (120006)APR does not understand this 
error code: proxy: read response failed from 

And with the size of cookie changed,different error message 
return to user explorer. 
But not describe the truly reason (cookie or url or just ajp_header are out of limit).

1.2 source check

1.2.1 base source
  + Apache 2.2.4 mod_proxy_ajp
  + Tomcat 5.5.23 connectors/ajp

1.2.2 source extraction
--SEND (apache_tomcat_ajp)--
    ... ...
    ... ...

    ... ...
    ... ...

    ... ...
    ... ...

    ... ...
    ajp_msg_append_*();    // msg->len += 1/2/4/...

    ... ...
    ... ...

    if((msg->len + 1) >= 8KB)    // <== ERROR: msg->len + 4 
(msg->header_len) + 1 >= 8KB
        // <== fine process for too big error

    ... ...
    // write prefix 2 bytes to buf[0-1]
    ... ...
    // write len (msg->len - 4) 2 bytes to buf[2-3]
    len = msg->len - 4;        // <== ERROR: msg->len used as save buf used 
    ... ...


    ... ...
    // get msglen from buf
    if(msglen > 8KB){    // <== ERROR: msglen used as save buf used length
        // output: [Wed Dec 30 14:17:43 2009] [error] ajp_check_msg_header() 
incoming message is too big 8196, max is 8192
        // this message should nerver appear
    ... ...

1.3 wrong use of len(in struct ajp_msg)/header_len/msglen(in ajp_header buf).
It seems that these three value has different meaning in describe the ajp_header. But in two places, it was used in different meaning.
So that when the ajp_header size reached about AJP_MSG_BUFFER_SZ,
error occurs in many places.

2 For many applications' necessory,
we suggest the value of AJP_MSG_BUFFER_SZ up to 16KB.
This value should be a good balance between performance and availability.

3 wrong function name in log output.
line: 102 function name error.
line: 113 function name error.

4 test jsp page (in attachment)
Comment 1 William A. Rowe Jr. 2018-11-07 21:08:52 UTC
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.