Apache mod_speling HTTP Referrer Cross-site scripting vulnerability
Release Date:
20-09-2017
Software:
Apache HTTP Server
Versions tested:
Apache http server 2.4.27 stable.
Vulnerability discovered:
Reflected Cross-site Scripting in mod_speling module.
Vulnerability impact:
Low.
Vulnerability information:
The Apache HTTP Server ships with an optional module named mod_speling. The name mod_speling is intentionally misspelt, as the package provides a friendly HTTP error message when a website visitor requests a URL page name which does not exist, but potential spelling alternatives are available (such as asking for indexs.html which is not found, while index.html exists). The mod_speling module will suggest the valid alternative of index.html, or provide a hyperlink to go back to the referring page and report this dead hyperlink to the website author. The vulnerability exists where the requested page name does not exist, and a correctly spelled page is present, where malicious javascript input is used in the HTTP 'Referrer' header. The source code uses the Apache escape_uri() method, which correctly escapes URL hyperlinks but does not safely encode HTML input such as : and / which would be used in a URL. Cross-site scripting is executed when a visitor clicks on the Apache generated hyperlink.
https://github.com/apache/httpd/blob/trunk/modules/mappers/mod_speling.c#L486
"<a href=\"";
*(const char **)apr_array_push(t) = ap_escape_uri(sub_pool, ref);
*(const char **)apr_array_push(t) = "\">referring page</a> "
"about the broken link.\n";
Example:
GET /indexs.html HTTP/1.0
Referer: javascript:alert(document.cookie)/foo
Recommendation:
The source code has since been patched to use the ap_escape_html() function instead. Future stable releases will contain this fix e.g. 2.4.28 stable
Workaround:
N/A.
Credit:
This vulnerability was disclosed by Patrick Webster.
Disclosure timeline:
18-Sep-2017 - Discovered during audit. Reported to Apache Security Team. Report acknowledged.
19-Sep-2017 - Source code patched.
20-Sep-2017 - Disclosure.
About OSI Security:
OSI Security is an independent network and computer security auditing
and consulting company based in Sydney, Australia. We provide internal
and external penetration testing, vulnerability auditing and wireless
site audits, vendor product assessments, secure network design,
forensics and risk mitigation services.
We can be found at http://www.osisecurity.com.au/
20-09-2017
Software:
Apache HTTP Server
Versions tested:
Apache http server 2.4.27 stable.
Vulnerability discovered:
Reflected Cross-site Scripting in mod_speling module.
Vulnerability impact:
Low.
Vulnerability information:
The Apache HTTP Server ships with an optional module named mod_speling. The name mod_speling is intentionally misspelt, as the package provides a friendly HTTP error message when a website visitor requests a URL page name which does not exist, but potential spelling alternatives are available (such as asking for indexs.html which is not found, while index.html exists). The mod_speling module will suggest the valid alternative of index.html, or provide a hyperlink to go back to the referring page and report this dead hyperlink to the website author. The vulnerability exists where the requested page name does not exist, and a correctly spelled page is present, where malicious javascript input is used in the HTTP 'Referrer' header. The source code uses the Apache escape_uri() method, which correctly escapes URL hyperlinks but does not safely encode HTML input such as : and / which would be used in a URL. Cross-site scripting is executed when a visitor clicks on the Apache generated hyperlink.
https://github.com/apache/httpd/blob/trunk/modules/mappers/mod_speling.c#L486
"<a href=\"";
*(const char **)apr_array_push(t) = ap_escape_uri(sub_pool, ref);
*(const char **)apr_array_push(t) = "\">referring page</a> "
"about the broken link.\n";
Example:
GET /indexs.html HTTP/1.0
Referer: javascript:alert(document.cookie)/foo
Recommendation:
The source code has since been patched to use the ap_escape_html() function instead. Future stable releases will contain this fix e.g. 2.4.28 stable
Workaround:
N/A.
Credit:
This vulnerability was disclosed by Patrick Webster.
Disclosure timeline:
18-Sep-2017 - Discovered during audit. Reported to Apache Security Team. Report acknowledged.
19-Sep-2017 - Source code patched.
20-Sep-2017 - Disclosure.
About OSI Security:
OSI Security is an independent network and computer security auditing
and consulting company based in Sydney, Australia. We provide internal
and external penetration testing, vulnerability auditing and wireless
site audits, vendor product assessments, secure network design,
forensics and risk mitigation services.
We can be found at http://www.osisecurity.com.au/