文件包含漏洞 PHP伪协议


伪协议   

include  $name . '.inc'

include  $name 

require  $name

allow_url_include  

fopen($name)

file_get_contents($name)

file_exists($name)

allow_url_fopen

php  很多伪协议

所有的伪协议,在使用时,前面都不能有内容。

file://  绝对路径     file://c:\windows\win.ini
                     对方服务器上的路径 
                     ../../../../../windows/win.ini
                     文件包含时,不能有后缀,如果有后缀,可以尝试00截断以及长文件名截断

http://  指定url     http://www.a.com/a.txt?  
                    使用?或#绕过后缀
                    当用在include中时同时,要求php.ini文件中,allow_url_include=On
                    当用在file类函数中时同时,要求php.ini文件中,allow_url_fopen=On

php://    
        php://input  接收到post数据(整个post的数据都是到,例如:post提交 uname=zs&upass=123456,php://input收到的内容就是`uname=zs&upass=123456`)
                    不能有后缀
                    当用在include中时同时,要求php.ini文件中,allow_url_include=On
                    当用在file类函数中时同时,要求php.ini文件中,allow_url_fopen=On

        php://filter/read=convert.base64-encode/resource=a.php   读出来a.php的内容,并且base64编码。    主要作用用来读php文件源代码
                    可以使用相对路径,已经绝对路径
                    不能有后缀
                    当用在include中时同时,要求php.ini文件中,allow_url_include=On/Off
                    当用在file类函数中时同时,要求php.ini文件中,allow_url_fopen=On/Off


data://  data://text/plain,abc       
         data:text/plain;base64,YWJj    就会收到abc
                    当用在include中时同时,要求php.ini文件中,allow_url_include=On
                    当用在file类函数中时同时,要求php.ini文件中,allow_url_fopen=On


./ 无变化
可能会有文件包含

php://filter/read=convert.base64-encode/resource=news  能否读出来内容
能读出来,前面没内容,后面有内容
不能读出来,前面有内容,后面有内容  基本结束

data://text/plain,abc   是否显示出来内容

如果显示,可以远程文件包含   data://text/plain,abc<?php phpinfo();?>
不显示,不能用远程

猜你喜欢

转载自blog.csdn.net/qq_29443517/article/details/102670678
今日推荐