Open Redirect Vulnerability in GTranslate
Recently while looking in to what turned out to be unrelated probing from a hacker for WordPress plugins we took a look at the plugin GTranslate and found that it has an open redirect vulnerability.
In the file /url_addon/gtranslate.php a redirect will occur if two variables are the same:
30 31 32 33 | if($glang == $main_lang) { header('Location: ' . $page_url, true, 301); exit; } |
The variable $main_lang is currently hardcoded to “en” in the file /url_addon/config.php and the value of the other is set to the value of the GET input “glang”:
7 | $glang = $_GET['glang']; |
The value of $page_url, which is where the redirect occurs to is generated with the following code:
12 13 14 15 16 17 18 | $page_url = '/'.$_GET['gurl']; $page_url_segments = explode('/', $page_url); foreach($page_url_segments as $i => $segment) { $page_url_segments[$i] = rawurlencode($segment); } $page_url = implode('/', $page_url_segments); |
By specifying a value for the GET input “gurl” that starts with a “/” and the includes a URL without the protocol, the value of $page_url will be the URL with “//” before it, which tells the web browser to redirect to URL with whatever protocol the current page has. The protocol would either be http:// or https:// depending on which one you used with the request to /url_addon/config.php.
We contacted the developer about the issue and got an automated response that they would respond soon, but we haven’t heard from them since.
Proof of Concept
The following proof of concept will redirect you to our website.
Make sure to replace “[path to WordPress]” with the location of WordPress.
http://[path to WordPress]/wp-content/plugins/gtranslate/url_addon/gtranslate.php?glang=en&gurl=/www.pluginvulnerabilities.com
Timeline
- February 3, 2017 – Developer notified.
- February 17, 2017 – WordPress.org Plugin Directory notified.
- February 17, 2017 – Removed from WordPress.org Plugin Directory.
- February 18, 2017 – Version 2.8.11 submitted to WordPress.org Plugin Directory subversion repository, which fixes issue.