前言之前对.htaccess文件上传漏洞的理解还是有些太浅显了,故在这里进行补充。简介.htaccess是一个配置文件,用于运行Apache网络服务器软件的网络服务器上。当.htaccess文件被放置在一个通过Apache Web服务器加载的目录中时,.htaccess文件会被Apache Web服务器软件检测并执行。这些.htaccess文件可以用来改变Apache Web服务器软件的配置,以启用/禁用Apache Web服务器软件所提供的额外功能和特性。.htaccess文件提供了针对目录改变配置的方法, 即在一个特定的文档目录中放置一个包含一条或多条指令的文件, 以作用于此目录及其所有子目录。作为用户,所能使用的命令受到限制。管理员可以通过 Apache 的 AllowOverride 指令来设置。.htaccess文件上传漏洞我们可以通过上传.htaccess来将图片文件解析为可执行文件,来执行我们上传的图片马。常见利用方法#在当前目录下,所有文件都会被解析成php代码执行 <IfModule > SetHandler application/x-httpd
intval函数绕过$num="3e3"; if(intval($num) < 2020 && intval($num + 1) > 2021) { echo "yes"; } else { echo "no"; }basename函数绕过1. 函数作用basename() 函数返回路径中的文件名部分。$path="/www/index.php"; echo basename($path)."<br />"; //output: index.php echo basename($path,".php")."<br />"; //output: index2. 函数漏洞在使用默认语言环境设置时,basename() 会删除文件名开头的非 ASCII 字符。例如:$path1="/www/%ffindex.php"; echo basename($path1).&q
信息收集打开题目,发现文件上传位置,猜测考点为文件上传。尝试上传一句话木马1.php。不允许的后缀,经过测试其他绕过后缀也无法上传。图片头检测,在一句话前加上GIF89a。PHP标签检测,使用<script language="php">@eval($_POST[cmd]);</script>作为一句话木马。成功上传,但是由于后缀为png无法调用PHP引擎进行解析。考虑使用.user.ini进行绕过。.user.ini.user.ini这个文件在PHP 5.3.0被加入到PHP中,他的作用类似Apache中的.htaccsee文件,其中两个有趣的设置:auto_prepend_file和auto_append_file我们指定一个文件(如a.jpg),那么该文件就会被包含在要执行的php文件中(如index.php),类似于在index.php中插入一句:require(./a.jpg);这两个设置的区别只是在于auto_prepend_file是在文件前插入;auto_append_file在文件最后插入(当文件调用的有exit()时该设置
代码审计include 'flag.php'; $flag='MRCTF{xxxxxxxxxxxxxxxxxxxxxxxxx}'; if(isset($_GET['gg'])&&isset($_GET['id'])) { $id=$_GET['id']; $gg=$_GET['gg']; if (md5($id) === md5($gg) && $id !== $gg) { echo 'You got the first step'; if(isset($_POST['passwd'])) { $passwd=$_POST['passwd']; if (!is_numeric($passwd)) { if($passwd==1234567) { echo 'Good Job!';
一、SSTI简介SSTI就是服务器端模板注入(Server-Side Template Injection),实际上也是一种注入漏洞。由于未对用户输入的数据进行过滤,导致由用户输入的模板引擎渲染标识符中的内容被渲染,导致RCE(任意代码执行)漏洞。二、判断模板引擎最出名的一张图。解释:绿色箭头指成功执行,红色箭头指原样返回或报错。区分Jinja2与Twig通过{{7*'7'}}返回的值。Jinja2:7777777Twig:49三、Smarty1. 简介这是一个基于PHP服务的模板引擎,是为了让前端界面(html)与程序代码(php)分离而产生的一种解决方案,Smarty 的原理是变量替换原则,我们只需要在html文件里写好Smarty的标签即可,如果对用户的输入不加处理直接回显可能会导致SSTI漏洞。2. 漏洞确认POC:{$smarty.version}返回版本号。3. 任意文件读取POC:string:{include file='[file path]'}解释:{include}标签所导致,被该标签引入的文件只会单纯的输出文件内容,就算引入 php 文件也是如此。通过self获
Equinox
一个乐于分享的网安人