bWAPP----Server-Side Includes (SSI) Injection
Server-Side Includes (SSI) Injection
什么是SSI和SSI注入
SSI是英文Server Side Includes的缩写,翻译成中文就是服务器端包含的意思。从技术角度上说,SSI就是在HTML文件中,可以通过注释行调用的命令或指针。SSI具有强大的功能,只要使用一条简单的SSI 命令就可以实现整个网站的内容更新,时间和日期的动态显示,以及执行shell和CGI脚本程序等复杂的功能。SSI 可以称得上是那些资金短缺、时间紧张、工作量大的网站开发人员的最佳帮手。本文将主要结合Apache服务器介绍SSI的使用方法。
ps:(Server-side Includes) 服务器端包含提供了一种对现有HTML文档增加动态内容的方法。apache和iis都可以通过配置支持SSI,在网页内容被返回给用户之前,服务器会执行网页内容中的SSI标签。在很多场景中,用户输入的内容可以显示在页面中,比如一个存在反射XSS漏洞的页面,如果输入的payload不是xss代码而是ssi的标签,服务器又开启了ssi支持的话就会存在SSI漏洞

输入表单,lookup之后

核心代码
1 <div id="main">
2
3 <h1>Server-Side Includes (SSI) Injection</h1>
4
5 <p>What is your IP address? Lookup your IP address... (<a href="http://sourceforge.net/projects/bwapp/files/bee-box/" target="_blank">bee-box</a> only)</p>
6
7 <form action="<?php echo($_SERVER["SCRIPT_NAME"]);?>" method="POST">
8
9 <p><label for="firstname">First name:</label><br /> //firstname表单
10 <input type="text" id="firstname" name="firstname"></p>
11
12 <p><label for="lastname">Last name:</label><br /> //lastname表单
13 <input type="text" id="lastname" name="lastname"></p>
14
15 <button type="submit" name="form" value="submit">Lookup</button>
16
17 </form>
18
19 <br />
20 <?php
21
22 if($field_empty == 1) //这里的PHP只是判断是否有输入
23 {
24
25 echo "<font color=\"red\">Please enter both fields...</font>";
26
27 }
28
29 else
30 {
31
32 echo "";
33
34 }
35
36 ?>
37
38 </div>
防护代码
1 $field_empty = 0;
2
3 function xss($data)
4 {
5
6 switch($_COOKIE["security_level"])
7 {
8
9 case "0" :
10
11 $data = no_check($data);
12 break;
13
14 case "1" :
15
16 $data = xss_check_4($data);
17 break;
18
19 case "2" :
20
21 $data = xss_check_3($data);
22 break;
23
24 default :
25
26 $data = no_check($data);
27 break;
28
29 }
30
31 return $data;
32
33 }
34
35 if(isset($_POST["form"]))
36 {
37
38 $firstname = ucwords(xss($_POST["firstname"])); //ucwords()首字母大写
39 $lastname = ucwords(xss($_POST["lastname"]));
40
41 if($firstname == "" or $lastname == "")
42 {
43
44 $field_empty = 1;
45
46 }
47
48 else
49 {
50
51 $line = '<p>Hello ' . $firstname . ' ' . $lastname . ',</p><p>Your IP address is:' . '</p><h1><!--#echo var="REMOTE_ADDR" --></h1>';
52
53 // Writes a new line to the file
54 $fp = fopen("ssii.shtml", "w");
55 fputs($fp, $line, 200);
56 fclose($fp);
57
58 header("Location: ssii.shtml");
59
60 exit;
61
62 }
63
64 }
65
66 ?>
1.low
low级别,没有防护
能xss

还能构造这种payload
<!--@echo var ="DOCUMEN_NAME"-->

还能构造成exec
2.medium
function xss_check_4($data)
{ // addslashes - returns a string with backslashes before characters that need to be quoted in database queries etc.
// These characters are single quote ('), double quote ("), backslash (\) and NUL (the NULL byte).
// Do NOT use this for XSS or HTML validations!!! return addslashes($data); }
addslashes()在符号前加反斜线
3.high
1 function xss_check_3($data, $encoding = "UTF-8")
2 {
3
4 // htmlspecialchars - converts special characters to HTML entities
5 // '&' (ampersand) becomes '&'
6 // '"' (double quote) becomes '"' when ENT_NOQUOTES is not set
7 // "'" (single quote) becomes ''' (or ') only when ENT_QUOTES is set
8 // '<' (less than) becomes '<'
9 // '>' (greater than) becomes '>'
10
11 return htmlspecialchars($data, ENT_QUOTES, $encoding);
12
13 }
将预定义的字符装换为html实体字符
bWAPP----Server-Side Includes (SSI) Injection的更多相关文章
- ssi(Server Side Includes)介绍
Server Side Includes (SSI) is a simple interpreted server-side scripting language used almost exclus ...
- Atitit Server Side Include ssi服务端包含规范 csi esi
Atitit Server Side Include ssi服务端包含规范 csi esi 一.CSI (Client Side Includes) 1 1.1. 客户端包含1 1.2. Ang ...
- Windows Azure 网站 (WAWS) 中的服务器端包含 (SSI)
编辑人员注释:本文章由 Windows Azure 网站团队的项目经理Erez Benari 撰写. Windows Azure 网站客户普遍关心的一个问题是关于我们对服务器端包含(Server ...
- 动态内容的缓存技术:CSI vs SSI vs ESI
CDN 中动态内容是不太好解决的,通常需要很麻烦的技术和方法来实现这些功能,比如我设计过一种动态缓存的方法,基于 session 栏接,然后根据热点来做动态缓存时间的控制.目前开放的实现 Cache ...
- WEB APPLICATION PENETRATION TESTING NOTES
此文转载 XXE VALID USE CASE This is a nonmalicious example of how external entities are used: <?xml v ...
- 缓存Cache
转载自 博客futan 这篇文章将全面介绍有关 缓存 ( 互动百科 | 维基百科 )cache以及利用PHP写缓存caching的技术. 什么是缓存Cache? 为什么人们要使用它? 缓存 Cach ...
- Caching Tutorial
for Web Authors and Webmasters This is an informational document. Although technical in nature, it a ...
- 115 Java Interview Questions and Answers – The ULTIMATE List--reference
In this tutorial we will discuss about different types of questions that can be used in a Java inter ...
- Nginx - Rewrite Module
Initially, the purpose of this module (as the name suggests) is to perform URL rewriting. This mecha ...
随机推荐
- git学习(六) git reset操作
git reset 操作 git reset git reset HEAD 文件名 移除不必要的添加到暂存区的文件 git reset HEAD^ 或者 commitid 去掉上一次的提交 git r ...
- Graph-GraphSage
MPNN很好地概括了空域卷积的过程,但定义在这个框架下的所有模型都有一个共同的缺陷: 1. 卷积操作针对的对象是整张图,也就意味着要将所有结点放入内存/显存中,才能进行卷积操作.但对实际场景中的大规模 ...
- 如何用vue实现一个矩形标记区域 rectangle marker
代码地址:vue-rectangle-marker 一.前言 一些cms系统经常会用到区域标记功能,所以写了个用vue实现的矩形标记区域,包含拖拽.放大缩小.重置功能. 二.实现结果 初始 标记 三. ...
- EFCore之SQL扩展组件BeetleX.EFCore.Extension
EFCore是.NETCore团队开发的一个ORM组件,但这个组件在执行传统SQL的时候并不方便,因此BeetleX.EFCore.Extension的设计目的是让EFCore执行传 ...
- 一起学Vue:入门
Why-为什么需要Vue? 前端开发存在的问题? 其一,需求变化频率更高 产品功能迭代前端肯定需要跟着调整. 提意见的人多,前端嘛谁都能看得见,所以,谁都可以指手画脚提一点意见.产品经理.项目经理.老 ...
- STM32入门系列-创建寄存器模板
介绍如何使用 KEIL5 软件创建寄存器模板, 方便之后使用寄存器方式来操作STM32开发板上的LED,让大家创建属于自己的寄存器工程模板. 获取工程模板的基础文件 首先我们在电脑任意位置创建一个文件 ...
- Go语言中的互斥锁和读写锁(Mutex和RWMutex)
目录 一.Mutex(互斥锁) 不加锁示例 加锁示例 二.RWMutex(读写锁) 并发读示例 并发读写示例 三.死锁场景 1.Lock/Unlock不是成对出现 2.锁被拷贝使用 3.循环等待 虽然 ...
- python框架Django简介与安装
Django简介 关注公众号"轻松学编程"了解更多. 发布于2005年,最负盛名且成熟的Python网络框架 最初用来制作在线新闻的Web站点 开源Web框架,遵守BSD协议 BS ...
- [BZOJ 4818/LuoguP3702][SDOI2017] 序列计数 (矩阵加速DP)
题面: 传送门:https://www.lydsy.com/JudgeOnline/problem.php?id=4818 Solution 看到这道题,我们不妨先考虑一下20分怎么搞 想到暴力,本蒟 ...
- Ordering Cows
题意描述 好像找不到链接(找到了请联系作者谢谢),所以题目描述会十分详细: Problem 1: Ordering Cows [Bruce Merry, South African Computer ...