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 ...
随机推荐
- python 虚拟环境安装
windows虚拟环境的搭建 安装 # 建议使用pip3安装到python3环境下 pip3 install virtualenv pip3 install virtualenvwrapper-win ...
- vue多页面与单页面开发的区别。
进入一家新的公司,要开发移动端app项目,前端技术选型时前端组长选的是vue的多页面开发,当时很蒙,vue不是单页面开发吗?咋出来多页面的.接触之后才发现确实存在也挺简单的,省去了路由表的配置.那就给 ...
- JS实现页面计时
前言 计时功能在网页上是非常多的,现在我就用原生JS做个计时功能吧 HTML <div><label>得到毫</label> <h5></h5&g ...
- SVN如何回滚到指定版本
以下内容网上收集整理. 方法一. 利用Export,这样你可以不丢失你新建的文件.打开你想要回滚的文件夹(受SVN版本控制).右键Tortoise SVN,然后在列表中选择 show log, 在看到 ...
- update不能直接使用select的返回结果
update不能直接使用select的返回结果,这是会报错的,这是SQL的语法规定的,若想在update中与select结合使用,sql需要这样写: 1.其中field1,field2为表中的字段名 ...
- 爬虫双色球所有的历史数据并保存到SQLite
前言 上一篇介绍了双色球走势图是怎么实现的,这一篇介绍怎么实现爬虫所有的双色球历史数据,也可以同步分享怎么同步福彩3D数据.采用的C#来实现的. 同步双色球的地址:https://datachart. ...
- 简单的学生管理(C语言)
#include<stdio.h> #include<stdlib.h> #include<string.h> struct Student_type{ char ...
- Android 教你如何发现 APP 卡顿
最近部门打算优化下 APP 在低端机上的卡顿情况,既然想优化,就必须获取卡顿情况,那么如何获取卡顿情况就是本文目的. 一般主线程过多的 UI 绘制.大量的 IO 操作或是大量的计算操作占用 CPU,导 ...
- 购买GPRS DTU时应该怎么选择
GPRS DTU如今是一种被广泛应用的物联网无线数据终端,主要是利用GPRS网络为用户提供无线长距离数据透传功能,在电力.环保.物流.气象等行业领域有着广泛应用.目前市场上的GPRS DTU产品眼花缭 ...
- vue+el-table在ajax分页时支持全选单页和全选所有
需求:el-table中,ajax分页的情况下,要支持全选单页和全选所有页中的记录,效果如下图所示: 界面代码: <el-table :data="tableDat ...