PHP伪协议应用

PHP伪协议的一些应用

利用 PHP 流

php://filter:
php://filter 是一种元封装器, 设计用于数据流打开时的筛选过滤应用。 这对于一体式(all-in-one)的文件函数非常有用,类似 readfile()、 file() 和 file_get_contents(), 在数据流内容读取之前没有机会应用其他过滤器。

(文件读取、文件包含漏洞)

利用条件:

1.allow_url_include不做要求

2.对allow_url_fopen=on

利用形式:

?file=php://filter/conver.base64-encode/resource=index.php

*文件来源于index.php,并且对其做了一个base64的转码,base64转码后PHP无法识别,所以就会将index.php内容以base64转码后的形式打印出来

题目地址:http://4.chinalover.sinaapp.com/web7/index.php

asdf <?php error_reporting(0); if(!$_GET[file]){echo ' click me? no';} $file=$_GET['file']; if(strstr($file,"../")||stristr($file, "tp")||stristr($file,"input")||stristr($file,"data")){ echo "Oh no!"; exit(); } include($file); //flag:nctf{edulcni_elif_lacol_si_siht} ?>

php://input:

php://input 是个可以访问请求的原始数据的只读流。

利用条件:

1.allow_url_include=On

2.对allow_url_fopen不做要求

*php://input可以读取没有处理过的POST数据

a.com/login.php

username=aaa&password=222

$username=    $_POST['username']
username=aaa&password=222

$username= php://input  写的字符串都可以接收到

利用形式:

?file=php://input 数据利用POST传过去。

题目地址:http://106.12.37.37:10008/

http://123.206.87.240:8002/web8/

extract($_GET)

把传递的值变成变量

例如:a=3&b=4

$a=3

$b=4

$flag

file_get_contents() 函数把整个文件读入一个字符串中。

发布了49 篇原创文章 · 获赞 4 · 访问量 2532

猜你喜欢

转载自blog.csdn.net/weixin_42040292/article/details/103595666
今日推荐