一、代码审计打开靶场,获得以下代码:// php版本:5.4.44 header("Content-type: text/html; charset=utf-8"); highlight_file(__FILE__); class evil{ public $hint; public function __construct($hint){ $this->hint = $hint; } public function __destruct(){ if($this->hint==="hint.php") @$this->hint = base64_encode(file_get_contents($this->hint)); var_dump($this->hint); } function __wakeup() { if ($this->hint != "
一、简介XXE漏洞全称XML外部实体注入,需要有XML知识基础。XML主要用于数据传输与交换,有点类似于PHP的对象序列化,只不过这种更加简便且结构更加清晰。不过DTD的出现允许了XML文档调用外部文件,当网页程序没有对调用的XML文档进行检查时,可以导致的有任意文件读取、内网探测、系统命令执行。。下面是一个样例XML-DTD文件。<?xml version="1.0"?> <!DOCTYPE note [ <!ELEMENT note (to,from,heading,body)> <!ELEMENT to (#PCDATA)> <!ELEMENT from (#PCDATA)> <!ELEMENT heading (#PCDATA)> <!ELEMENT body (#PCDATA)> ]> <note> <to>Tove</to> <from>Jani</from> <heading>Reminder<
一、RCE简介RCE漏洞,全称远程命令/代码执行漏洞,可以让攻击者直接向后台服务器远程注入操作系统命令或者代码,从而控制后台系统。RCE分为:远程命令执行Remote Command Execute远程代码执行Remote Code Execute二、远程命令执行漏洞原理一般出现这种漏洞,是因为应用系统从设计上需要给用户提供指定的远程命令操作的接口。比如我们常见的路由器、防火墙、入侵检测等设备的web管理界面上。一般会给用户提供一个ping操作的web界面,用户从web界面输入目标IP,提交后,后台会对该IP地址进行一次ping测试,并返回测试结果。 如果,设计者在完成该功能时,没有做严格的安全控制,则可能会导致攻击者通过该接口提交“意想不到”的命令,从而让后台进行执行,从而控制整个后台服务器。这种漏洞形成的条件有两个:有执行系统命令的函数。函数中存在外部可操作的变量。相关函数system() :执行外部程序,并且显示输出exec()/shell_exec(): 通过 shell 环境执行命令,并且将完整的输出以字符串的方式返回pcntl_exec() :在当前进程空间执行指定程序pa
一、文件上传简介当今大多数网站都允许进行文件上传,可这是一个十分危险的行为,未经验证的文件上传操作会导致服务器权限被窃取,也就是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($
index.phpinclude 'tm.php'; // Next step in tm.php if (preg_match('/tm\.php\/*$/i', $_SERVER['PHP_SELF'])) { exit("no way!"); } if (isset($_GET['source'])) { $path = basename($_SERVER['PHP_SELF']); if (!preg_match('/tm.php$/', $path) && !preg_match('/index.php$/', $path)) { exit("nonono!"); } highlight_file($path); exit(); }basename函数漏洞:在使用默认语言环境设置时,basename() 会删除文件名开头的非 ASCII 字符。例如:$path1="/www/%ffindex.php"; echo basename
Equinox
一个乐于分享的网安人