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 ...
随机推荐
- 第二十五章 ansible基础
一.Ansible概述 1.什么是Ansible Ansible是一个自动化统一配置管理工具,自动化主要体现在Ansible集成了丰富模块以及功能组件,可以通过一个命令完成一系列的操作,进而能减少重复 ...
- 51node1256 乘法匿元(扩展欧几里得)
#include<iostream> using namespace std; int gcd(int a,int b,int &x,int &y){ if (b==0){ ...
- IntentService下载任务
onHandleIntent开启一个线程按顺序处理任务,不适合做大量任务 public class MainActivity extends AppCompatActivity { protected ...
- 开发工具:Mybatis.Plus.插件三种方式的逆向工程
本文源码:GitHub·点这里 || GitEE·点这里 一.逆向工程简介 在Java开发中,持久层最常用的框架就是mybatis,该框架需要编写sql语句,mybatis官方提供逆向工程,可以把数据 ...
- 4G DTU的使用方法和应用领域
4G DTU是一种数据传输单元,通俗理解就是,用来传输数据的一种硬件.既然是用来传输数据的,那就能将它视为一个管道,也就是说,指令同过它传给设备,而管道是不对这些指令做出响应的. 4G DTU如何使用 ...
- scrapy反反爬虫策略和settings配置解析
反反爬虫相关机制 Some websites implement certain measures to prevent bots from crawling them, with varying d ...
- 01_cifsd 高性能网络共享服务
01_cifsd 高性能网络共享服务 1.简介 cifsd 是一款高性能I/O网络文件共享服务, 通过一种与kernel直接交互的方式实现, github简介:https://github.com/n ...
- 2018-12-7 CSAPP及C++
今天虽然起床迟,但从结果上来看,学习效率还算不赖.从这几天的状况来看,为记录晚上上床后的学习内容,决定把在床上的学习内容算在后一天的学习中.那么从现在开始就可以协商英语的半个小时100个单词了. 英语 ...
- Apache Kylin远程代码执行漏洞复现(CVE-2020-1956)
Apache Kylin远程代码执行(CVE-2020-1956) 简介 Apache Kylin 是美国 Apache 软件基金会的一款开源的分布式分析型数据仓库.该产品主要提供 Hadoop/Sp ...
- Java_大体介绍(超级短的那种)
Java三大版本 Java SE: Java Standard Edition, 定位于客户端, 用于桌面应用软件编程 Java ME: Java Micro Edition, 用于嵌入式系统开发 J ...