Apache httpd is a popular and widely used web server, powering a significant portion of the internet. However, like any software, it is not immune to vulnerabilities. In this post, we will dissect the CVE-2017-7679 vulnerability, which affects Apache httpd versions 2.2.x before 2.2.33 and 2.4.x before 2.4.26. This vulnerability exists within the mod_mime module and can allow an attacker to read one byte past the end of a buffer when sending a malicious Content-Type response header. We will explore the cause of the vulnerability, take a look at the code snippet responsible for it, and discuss possible exploitation methods.

Understanding the Vulnerability

Before diving into the code, let's first understand mod_mime. Mod_mime is an Apache httpd module that helps associate metadata with files and resources served by the webserver. For example, it can be used to determine the MIME type of a file being served or to process other HTTP headers like Content-Disposition.

The CVE-2017-7679 vulnerability lies within the mod_mime module, where this buffer overread can cause a Denial of Service (DoS) attack or information disclosure by crashing the server or leaking memory content. Although this vulnerability may not lead to Remote Code Execution (RCE), it still poses a significant risk, especially for those hosting sensitive data.

Dissecting the Code

Now that we understand the underlying problem, let's take a look at the code snippet responsible for the buffer overread:

char *buffer = apr_pstrdup(r->pool, field);
char *last_elem = last_field(buffer);
while (last_elem > buffer) {
   if (*last_elem == ',') {
      *last_elem = '\';

In the code snippet above, the function last_field() returns a pointer to the last non-space character in the buffer. The issue arises in the while loop: it's possible for last_elem to become less than buffer, resulting in a situation where the loop reads one byte before the start of the buffer, causing a buffer overread.

Original References

1. Apache httpd's Official Advisory - http://httpd.apache.org/security/vulnerabilities_24.html
2. CVE-2017-7679 - https://nvd.nist.gov/vuln/detail/CVE-2017-7679

Exploiting CVE-2017-7679

Although the vulnerable code is within the Apache httpd web server, exploiting it is not entirely straightforward. One possible exploitation method revolves around sending specially crafted HTTP requests containing malicious Content-Type headers to the target server.

Keep in mind that, unlike an RCE, this vulnerability mainly allows for DoS attacks and information leakage via memory disclosure. Attackers can repeatedly send malicious requests to the server to crash it or leak sensitive data from the server's memory.


To mitigate this vulnerability, it's crucial to update your Apache httpd server to the latest patched versions - 2.2.33 or 2.4.26 and later. Also, monitor your server logs for any suspicious activity that might indicate an attempted exploitation of CVE-2017-7679. Keeping your server up-to-date is the best way to defend against this and many other known vulnerabilities.


CVE-2017-7679 is a buffer overread vulnerability within Apache httpd's mod_mime module. Despite not resulting in RCE, it still poses a threat in the form of DoS attacks and memory disclosure. By understanding this vulnerability, its causes, and possible exploitation methods, server administrators can take appropriate steps to protect their systems. Always be sure to update your Apache httpd server regularly and diligently monitor your server logs for any signs of an attack.


Published on: 06/20/2017 01:29:00 UTC
Last modified on: 06/06/2021 11:15:00 UTC