bWAPP----iFrame Injection
iFrame Injection
直接上代码
1 <div id="main">
2
3 <h1>iFrame Injection</h1>
4
5 <?php
6
7 if($_COOKIE["security_level"] == "1" || $_COOKIE["security_level"] == "2") //如果防御级别不是low执行这里,
8 {
9
10 ?>
11 <iframe frameborder="0"
src="robots.txt" //对高度和宽度的参数进行xss()函数
height="<?php echo xss($_GET["ParamHeight"])?>"
width="<?php echo xss($_GET["ParamWidth"])?>">
</iframe>
12 <?php
13
14 }
15
16 else
17 {
18
19 ?>
20 <iframe frameborder="0" //如果防御级别是0,对URL,宽度,高度都进行xss()
src="<?php echo xss($_GET["ParamUrl"])?>"
height="<?php echo xss($_GET["ParamHeight"])?>"
width="<?php echo xss($_GET["ParamWidth"])?>">
</iframe>
21 <?php
22
23 }
24
25 ?>
26
27 </div>
防御代码
1 if(!(isset($_GET["ParamUrl"])) || !(isset($_GET["ParamHeight"])) || !(isset($_GET["ParamWidth"]))) //如果这三个参数有一个没有传参,
2 {
3
4 header("Location: iframei.php?ParamUrl=robots.txt&ParamWidth=250&ParamHeight=250"); //展示这个
5
6 exit;
7
8 }
9
10 function xss($data)
11 {
12
13 switch($_COOKIE["security_level"])
14 {
15
16 case "0" :
17
18 $data = no_check($data);
19 break;
20
21 case "1" :
22
23 $data = xss_check_4($data);
24 break;
25
26 case "2" :
27
28 $data = xss_check_3($data);
29 break;
30
31 default :
32
33 $data = no_check($data);
34 break;
35
36 }
37
38 return $data;
1.low
当low级别时,no_check()
该函数为不做任何处理
low级别时对三个参数不做任何处理
<iframe frameborder="0"
src="robots.txt"
height="<?php echo xss($_GET["ParamHeight"])?>"
width="<?php echo xss($_GET["ParamWidth"])?>">
</iframe>
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); }
前边已经碰到过好多次
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 }
前边也已经碰到过好多次
bWAPP----iFrame Injection的更多相关文章
- bWAPP练习--injection篇之HTML Injection - Reflected (GET)
什么是Injection? injection,中文意思就是注入的意思,常见的注入漏洞就是SQL注入啦,是现在应用最广泛,杀伤力很大的漏洞. 什么是HTML injection? 有交互才会产生漏洞, ...
- bWAPP练习--injection篇SQL Injection (GET/Search)
SQL注入: SQL注入,就是通过把SQL命令插入到Web表单提交或输入域名或页面请求的查询字符串,最终达到欺骗服务器执行恶意的SQL命令.具体来说,它是利用现有应用程序,将(恶意)的SQL命令注入到 ...
- bWAPP练习--injection篇之HTML Injection - Reflected (POST)
POST的和之前的GET的过程差不多,只是表单的提交方式不一样而已. low 我们在表单中填入一个超链接 <a href="http://www.cnblogs.com/ESHLkan ...
- Web API接口安全了解
2017版OWASP top 10 将API安全纳入其中,足以说明API被广泛使用且安全问题严重.自己尝试整理一下,但限于本人搬砖经验还不足.水平有限,本文只能算是抛砖引玉,希望大伙不吝赐教. 了解W ...
- IP-reputation feature
IP-reputation feature https://blog.norz.at/citrix-netscaler-ip-reputation-feature/ I recently had to ...
- 前端 跨站脚本(XSS)攻击的一些问题,解决<script>alert('gansir')</script>
问题1:跨站脚本(XSS)的一些问题,主要漏洞证据: <script>alert('gansir')</script>,对于这个问题怎么解决? (测试应当考虑的前端基础攻击问题 ...
- 跟bWAPP学WEB安全(PHP代码)--HTML注入和iFrame注入
背景 这里讲解HTML注入和iFrame注入,其他的本质都是HTML的改变.那么有人会问,XSS与HTML注入有啥区别呢?其实本质上都是没有区别的,改变前端代码,来攻击客户端,但是XSS可以理解为注入 ...
- OWASP 之 HTML Injection
Summary HTML injection is a type of injection issue that occurs when a user is able to control an in ...
- 渗透测试平台bwapp简单介绍及安装
先来介绍一下bwapp bwapp是一款非常好用的漏洞演示平台,包含有100多个漏洞 SQL, HTML, iFrame, SSI, OS Command, XML, XPath, LDAP, PHP ...
随机推荐
- Seaborn系列 | 散点图scatterplot()
散点图 解读 可以通过调整颜色.大小和样式等参数来显示数据之间的关系. 函数原型 seaborn.scatterplot(x=None, y=None, hue=None, style=None, s ...
- C++ 设置软件激活不息屏
SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED);
- laytable 前台删除后加载当前页数据。
laytable一次性获取数据后,点击删除调用后台删除.返回成功状态后刷新当前页数据. 渲染方法: //渲染表格 function renderingTable(pageIndex, sourceDa ...
- 笔记本电脑插网线能上网,但是连不上WIFI,或者连上WiFi显示无internet,怎么解决?
1.鼠标 右键 "此电脑",选择"属性"
- 基于.Net Core开发的物联网平台 IoTSharp V1.5 发布
很高兴的宣布新版本的发布, 这次更新我们带来了大量新特性, 最值得关注的是, 我们逐步开始支持分布式, 这意味着你可以通过多台服务器共同处理数据, 而不是原来的单机处理, 我们也将遥测数据进行分开存储 ...
- 有关hashMap跟hashTable的区别
HashMap和Hashtable都实现了Map接口 HashMap是非synchronized,而Hashtable是synchronized HashTable使用Enumeration,Hash ...
- eclipse配置打开选中文件存储的目录快捷配置
方便同时复制多个包的文件 https://jingyan.baidu.com/article/adc8151353a896f723bf73cd.html
- day03基本数据类型
运算符补充 今天补充一些简单知识: #!/usr/bin/env python # -*- coding:utf-8 -*- value = "我是中国人" # 判断'中国'是 ...
- jq animate 的第二写法
俩个参数的写法 例子: $('#div1').animate({num:'auto'},{ duration : 1000, //运动时间 easing : 'linear', //运动形式 ...
- LuoguP3602 Koishi Loves Segments
题面 n个区间和数轴上的m个关键点 (0<=n,m<=4*1e5,数轴范围 \(-1^7\) ~ \(1^7\))每个关键点有被区间区间覆盖的次数上限,求最多能放多少个区间到数轴上 传送门 ...