[HNCTF 2022 WEEK2]easy_include

[HNCTF 2022 WEEK2]easy_include

image-20240426013859750

 <?php
//WEB手要懂得搜索

if(isset($_GET['file'])){
    $file = $_GET['file'];
    if(preg_match("/php|flag|data|\~|\!|\@|\#|\\$|\%|\^|\&|\*|\(|\)|\-|\_|\+|\=/i", $file)){
        die("error");
    }
    include($file);
}else{
    highlight_file(__FILE__);
}

只有个文件包含,preg_match函数的漏洞也用不了,在不能上传文件的时候可以尝试包含日志文件,日志文件很可能会记录UA头

image-20240426014327753

把UA头改成,然后把file改成nginx目录:/var/log/nginx/access.log

image-20240426014922510

成功执行phpinfo

image-20240426014950031

接下来直接cat flag

posted @ 2024-04-26 01:50  redfish999  阅读(256)  评论(0)    收藏  举报