Equinox 个人博客
Java反序列化Java序列化与反序列化依赖于两个函数writeObject()与readObject(),只要一个类实现了Serializable接口就可以使用这两个函数进行序列化与反序列化。Java反序列化漏洞原理类似PHP反序列化,PHP反序列化时会触发wakeup()函数,而Java中没有这种通用的函数,要实现类似wakeup()函数在反序列化时被触发的功能需要重写readObject()。Java反序列化漏洞需要触发一个被重写的readObject(),这个readObject()调用了一个其他类也有同名的函数,导致非预期的函数被执行。举个例子:原本的程序预期:从接口接到A类对象序列化的字节流调用A类的readObject()进行反序列化A类的readObject()中调用反序列化出来的A类对象中的一个B类对象的F方法完成反序列化传入恶意序列化字节流后:在A类对象中放置B类对象的位置嵌入一个恶意的C类对象,其中B与C有一个共同的F方法从接口接到A类对象序列化的字节流调用A类的readObject()进行反序列化A类的readObject()中调用反序列化出来的A类对象中的C类
一、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获
SQL注入原理由于程序员对插入SQL语句的用户输入参数检查不严格,导致的恶意SQL命令被插入语句并执行。例如:原始查询语句为 select * from user where id=$value$value为用户输入变量,由于没有过滤,在用户输入 1 and 1=2时查询语句变为 select * from user where id=1 and 1=2,返回永假页面。SQL数据库重要信息MySQL端口3306默认数据库:information_schemamysql.innodb_table_stats:这个表不储存列,所以看列的时候要另行他路。三个表名:SCHEMATA:所有数据库库名TABLES:所有数据库库名与表名COLUMNS:库名、表名、字段名基础查询语句select * from {table_name}select * from {table_name} where {column_name}={data}select * from {table_name} where {column_name}={data} and {other_column}={data} ...
一、代码审计打开靶场,获得以下代码:// 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<
Equinox
一个乐于分享的网安人