前言之前对.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
一、漏洞点发现进入靶场,发现存在一个表单,可以向page页面用GET请求方式发送一个名为url的参数,当你输入一个URL时会给你返回一个后缀为.jpg但内容为你的目标URL文件。<!doctype html> <html> <head> <title>test</title> </head> <body> <form action="/page" method="get"> <input type="text" name="url"/> </form> </body> </html>经过测试,url参数存在任意文件读取漏洞:访问/page?url=/etc/passwd:HTTP/1.1 200 OK Server: openresty Date: Wed, 12 Jun 2024 06:32:57 GMT Con
一、代码审计error_reporting(0); if (isset($_GET['code'])) { $code = $_GET['code']; if (strlen($code) > 40) { die("This is too Long."); } if (preg_match("/[A-Za-z0-9]+/", $code)) { die("NO."); } @eval($code); } else { highlight_file(__FILE__); }这次的代码很简单,不可以使用可见字符,需要使用不可见字符运算后进行RCE。二、原理PHP的神奇特性,允许变量的值作为变量名或函数名进行调用,且该变量的值允许运算。或绕过将可见字符转换为使用或运算之后才能得到的结果,这样可以使用不可见字符转换为可见字符串。import re import requests import urllib from sys import * impo
一、信息收集扫描目录,发现index.php.swp文件。ob_start(); function get_hash(){ $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()+-'; $random = $chars[mt_rand(0,73)].$chars[mt_rand(0,73)].$chars[mt_rand(0,73)].$chars[mt_rand(0,73)].$chars[mt_rand(0,73)];//Random 5 times $content = uniqid().$random; return sha1($content); } header("Content-Type: text/html;charset=utf-8"); //*** if(isset($_POST['username']) and $_POST['username'] != '' ) { $admin =
一、信息收集打开靶场,发现页面源码。if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR']; } if(!isset($_GET['host'])) { highlight_file(__FILE__); } else { $host = $_GET['host']; echo $host."<br />"; $host = escapeshellarg($host); echo $host."<br />"; $host = escapeshellcmd($host); echo $host."<br />"; $sandbox = md5("glzjin". $_SERVER['REMOTE_ADDR']); echo 'you ar
Equinox
一个乐于分享的网安人