华域联盟 漏洞资讯 Apache HTTP Server 缓冲区错误漏洞

Apache HTTP Server 缓冲区错误漏洞

Apache HTTP Server 缓冲区错误漏洞

漏洞ID 2116235 漏洞类型 缓冲区错误
发布时间 2020-08-31 更新时间 2021-06-07
CVE编号 CVE-2020-11984 CNNVD-ID CNNVD-202008-281
漏洞平台 N/A CVSS评分 N/A
|漏洞来源
https://cxsecurity.com/issue/WLB-2020080160


http://www.cnnvd.org.cn/web/xxk/ldxqById.tag?CNNVD=CNNVD-202008-281

|漏洞详情
Apache HTTP Server是美国阿帕奇(Apache)基金会的一款开源网页服务器。该服务器具有快速、可靠且可通过简单的API进行扩充的特点。 Apache HTTP Server 2.4.32版本至2.4.44版本中的mod_uwsgi存在缓冲区错误漏洞。攻击者可利用该漏洞获取信息并可能执行代码。
|漏洞EXP
Apache2: Incorrect handling of large requests in mod_proxy_uwsgi

mod_proxy_uwsgi as included in current versions of Apache httpd incorrectly handles large
HTTP requests. The UWSGI line protocol uses uint16_t length values for both header name/values 
and the overall packet size, but mod_proxy_uwsgi does not verify that these size fields do not overflow:

// modules/proxy/mod_proxy_uwsgi.c
static int uwsgi_send_headers(request_rec *r, proxy_conn_rec * conn)
{
  char *buf, *ptr;

  const apr_array_header_t *env_table;
  const apr_table_entry_t *env;

  apr_size_t headerlen = 4;
  apr_uint16_t pktsize, keylen, vallen;

  [...]

  env_table = apr_table_elts(r->subprocess_env);
  env = (apr_table_entry_t *) env_table->elts;

  for (j = 0; j < env_table->nelts; ++j) {
    headerlen += 2 + strlen(env[j].key) + 2 + strlen(env[j].val); 
  }

  ptr = buf = apr_palloc(r->pool, headerlen);

  ptr += 4;

  for (j = 0; j < env_table->nelts; ++j) {
    keylen = strlen(env[j].key); ** A ** 
    *ptr++ = (apr_byte_t) (keylen & 0xff);
    *ptr++ = (apr_byte_t) ((keylen >> 8) & 0xff);
    memcpy(ptr, env[j].key, keylen);
    ptr += keylen;

    vallen = strlen(env[j].val); ** B **
    *ptr++ = (apr_byte_t) (vallen & 0xff);
    *ptr++ = (apr_byte_t) ((vallen >> 8) & 0xff);
    memcpy(ptr, env[j].val, vallen);
    ptr += vallen;
  }

  pktsize = headerlen - 4; ** C **

  buf[0] = 0;
  buf[1] = (apr_byte_t) (pktsize & 0xff);
  buf[2] = (apr_byte_t) ((pktsize >> 8) & 0xff);
  buf[3] = 0;

  return uwsgi_send(conn, buf, headerlen, r);
}

A malicious request can easily overflow pktsize (C) by sending
a small amount of headers with a length that is close to the LimitRequestFieldSize
default value of 8190. This can be used to trick UWSGI into parsing parts of 
the serialized subprocess environment as part of the POST body. 
In most configurations the security impact of this seems to be limited. However,
an attacker might be able to leak sensitive environment variables as part of the POST body and/or 
strip security sensitive headers from the request. 
If UWSGI is explicitly configured in persistent mode (puwsgi), this can
also be used to smuggle a second UWSGI request leading to remote code execution.
(In its standard configuration UWSGI only supports a single request per connection, 
making request smuggling impossible)

RCE against a standard UWSGI config is possible if an attacker can put a controlled 
name or value into subprocess_env that is longer than 0xFFFF bytes: 
This would overflow the size calculation in (A) or (B) and
makes it possible to inject malicious key/value pairs into the UWSGI request. This can be turned
into code execution by setting a malicious UWSGI_FILE var 
(see https://github.com/wofeiwo/webcgi-exploits/blob/master/python/uwsgi-rce-zh.md)

Using an oversized HTTP header for this attack requires a LimitRequestFieldSize 
bypass and should not be possible in normal configurations. 
However, mod_http2 incorrectly enforced LimitRequestFieldSize before 
R1863276 (https://svn.apache.org/viewvc?view=revision&revision=1863276) so systems 
without this commit can be exploited easily. Other config dependent attack vectors might exist. 


Credits: 
Felix Wilhelm of Google Project Zero

This bug is subject to a 90 day disclosure deadline. After 90 days elapse, the bug report 
will become visible to the public. The scheduled disclosure date is 2020-07-23. 
Disclosure at an earlier date is also possible if agreed upon by all parties.

Related CVE Numbers: CVE-2020-11984.



Found by: [email protected]

|参考资料

来源:MLIST

链接:http://www.openwall.com/lists/oss-security/2020/08/08/9

来源:MLIST

链接:http://www.openwall.com/lists/oss-security/2020/08/08/8

来源:GENTOO

链接:https://security.gentoo.org/glsa/202008-04

来源:MLIST

链接:http://www.openwall.com/lists/oss-security/2020/08/08/1

来源:httpd.apache.org

链接:httpd.apache.org/security/vulnerabilities_24.html

来源:MLIST

链接:http://www.openwall.com/lists/oss-security/2020/08/08/10

来源:nvd.nist.gov

链接:https://nvd.nist.gov/vuln/detail/CVE-2020-11984

来源:vigilance.fr

链接:https://vigilance.fr/vulnerability/Apache-

本文由 华域联盟 原创撰写:华域联盟 » Apache HTTP Server 缓冲区错误漏洞

转载请保留出处和原文链接:https://www.cnhackhy.com/94143.htm

本文来自网络,不代表华域联盟立场,转载请注明出处。

作者: sterben

发表回复

联系我们

联系我们

2551209778

在线咨询: QQ交谈

邮箱: [email protected]

工作时间:周一至周五,9:00-17:30,节假日休息

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

关注微博
返回顶部