ap_find_token() Buffer Overread
A bug in token list parsing introduced by HTTP strict parsing changes allows ap_find_token() to read past the end of its input string. An attacker could craft request headers to cause a segmentation fault or make the function return an incorrect value.
Originally disclosed on HackerOne
- Fixed in 21 days
- Paid in 21 days
- Disclosed after 51 days
Summary by the program
The HTTP strict parsing changes added in 2.2.32 and 2.4.24 introduced a bug in token list parsing, which allows ap_find_token() to search past the end of its input string. By maliciously crafting a sequence of request headers, an attacker may be able to cause a segmentation fault, or to force ap_find_token() to return an incorrect value.
Acknowledgements: We would like to thank Javier Jiménez ([email protected]) for reporting this issue.
Reported to security team: 6th May 2017 Issue public: 19th June 2017 Update Released: 19th June 2017 Affects: 2.4.25, 2.2.32
The report
Versions Affected: httpd 2.2.32 httpd 2.4.24 (unreleased) httpd 2.4.25
Description: The HTTP strict parsing changes added in 2.2.32 and 2.4.24 introduced a bug in token list parsing, which allows ap_find_token() to search past the end of its input string. By maliciously crafting a sequence of request headers, an attacker may be able to cause a segmentation fault, or to force ap_find_token() to return an incorrect value.
Mitigation: 2.2.32 users should either apply the patch available at https://www.apache.org/dist/httpd/patches/apply_to_2.2.32/CVE-2017-7668.patch or upgrade in the future to 2.2.33, which is currently unreleased.
2.4.25 users should upgrade to 2.4.26.
You can contact me on [email protected] or [email protected]
I would like to donate the bug bounty's money (if any) to charity and preferably do it in behalf of my company, SensePost..
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the strict parsing changes added in versions 2.2.32 and 2.4.24 introduced an off-by-one or missing bounds check in token list parsing, so ap_find_token() can read past the end of the input string.
Impact
An attacker may be able to cause a segmentation fault or force ap_find_token() to return an incorrect value.
What the attacker needed
Send crafted request headers
The fix
Users should apply the provided patch or upgrade to a fixed version (2.4.26 for 2.4.25 users, or 2.2.33 when released).
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
This is a memory safety bug in the Apache web server. When the server parses certain request headers, a function called ap_find_token() can read beyond the end of the text it was given. That can crash the server or make it behave incorrectly.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.