Testing for CVE-2018-11784 - Apache Struts 2 Open Redirect vulnerability

On Wednesday 3 October 2018 the Apache Software Foundation has released information about an Open Redirect vulnerability in Apache Struts 2. The vulnerability received identifier CVE-2018-11784.

This page explains how you can test if your web application is vulnerable to this issue.

The vulnerability announcements describes the vulnerability as follows:
When the default servlet returned a redirect to a directory (e.g. redirecting to '/foo/' when the user requested '/foo') a specially crafted URL could be used to cause the redirect to be generated to any URI of the attackers choice.

By simply looking at the code change that was introduced to fix this issue (see reference 2), we can see that leading slashes are being removed. 
This is exactly the way in which you can test if your application is vulnerable.

Proof of concept:
  1. Identify a subfolder of you application, for example http://application/foo/
  2. Change the URL so that there are at least 2 leading slashes before the subfolder, and that there is no trailing slash. The test URL then becomes http://application//foo
  3. If you browse to the URL created in step two, and your application redirects you to http://foo/ then your application is vulnerable to this issue.

References:

Tags: 

You might also be interested in...