Drupal 7.14 <= Full Path Disclosure Vulnerability
About Drupal:
"Drupal is an open source content management platform powering millions of websites and
Applications. It's built, used, and supported by an active and diverse community of people
Around the world ."
Drupal is used by common companies like Ing/Diba, Amnesty International and The White House.
Issue: Full Path Disclosure
Risk Level: Medium
The remote attacker has the possibility to detect the full local path of drupal.
This information can be used for processing further attacks against the server.
In between des/bootstrap. inc, line 2695:
-------------------------------------
Function request_path (){
Static $ path;
If (isset ($ path )){
Return $ path;
}
If (isset ($ _ GET ['q']) {
// This is a request with? Q = foo/bar query string. $ _ GET ['q'] is
// Overwritten in drupal_path_initialize (), but request_path () is called
// Very early in the bootstrap process, so the original value is saved in
// $ Path and returned in later CILS.
$ Path = $ _ GET ['q'];
}
Elseif (isset ($ _ SERVER ['request _ URI ']) {
// This request is either a clean URL, or 'index. php', or nonsense.
// Extract the path from REQUEST_URI.
$ Request_path = strtok ($ _ SERVER ['request _ URI '],'? ');
$ Base_path_len = strlen (rtrim (dirname ($ _ SERVER ['script _ name']), '\/');
// Unescape and strip $ base_path prefix, leaving q without a leading slash.
$ Path = substr (urldecode ($ request_path), $ base_path_len + 1 );
// If the path equals the script filename, either because 'index. php' was
// Explicitly provided in the URL, or because the server added it
// $ _ SERVER ['request _ URI '] even when it wasn' t provided in the URL (some
// Versions of Microsoft IIS do this), the front page should be served.
If ($ path = basename ($ _ SERVER ['php _ SELF ']) {
$ Path = '';
}
}
Else {
// This is the front page.
$ Path = ''; www.2cto.com
}
// Under certain conditions Apache's RewriteRule directive prepends the value
// Assigned to $ _ GET ['q'] with a slash. Moreover we can always have a trailing
// Slash in place, hence we need to normalize $ _ GET ['q'].
$ Path = trim ($ path ,'/');
Return $ path;
}
-------------------------------------
Exploit/Proof Of Concept:
Http://www.2cto.com /? Q [] = x
-------------------------------------
Solution:
Search:
$ Path = trim ($ path ,'/');
And add the following line above:
If (is_array ($ path) {die ();}
-------------------------------------