bWAPP----HTML Injection - Reflected (GET)
HTML Injection - Reflected (GET)
进入界面,
html标签注入

这是核心代码
1 <div id="main">
2
3 <h1>HTML Injection - Reflected (GET)</h1>
4
5 <p>Enter your first and last name:</p>
6
7 <form action="<?php echo($_SERVER["SCRIPT_NAME"]);?>" method="GET">
8
9 <p><label for="firstname">First name:</label><br />
10 <input type="text" id="firstname" name="firstname"></p> //first name 框
11
12 <p><label for="lastname">Last name:</label><br /> //last name 框
13 <input type="text" id="lastname" name="lastname"></p>
14
15 <button type="submit" name="form" value="submit">Go</button> //按钮标签
16
17 </form>
18
19 <br />
20 <?php
21
22 if(isset($_GET["firstname"]) && isset($_GET["lastname"])) //以GET方式获取表单传递的firstname和lastname,isset检测是否存在
23 {
24
25 $firstname = $_GET["firstname"]; //接受参数
26 $lastname = $_GET["lastname"];
27
28 if($firstname == "" or $lastname == "") //如果其中一个为空,显示下边内容
29 {
30
31 echo "<font color=\"red\">Please enter both fields...</font>";
32
33 }
34
35 else
36 {
37
38 echo "Welcome " . htmli($firstname) . " " . htmli($lastname);
39
40 }
41
42 }
43
44 ?>
45
46 </div>
过滤部分
1 function htmli($data)
2 {
3
4 switch($_COOKIE["security_level"])
5 {
6
7 case "0" :
8
9 $data = no_check($data);
10 break;
11
12 case "1" :
13
14 $data = xss_check_1($data);
15 break;
16
17 case "2" :
18
19 $data = xss_check_3($data);
20 break;
21
22 default :
23
24 $data = no_check($data);
25 break;;
26
27 }
28
29 return $data;
30
31 }
32
33 <label>Set your security level:</label><br />
34
35 <select name="security_level">
36
37 <option value="0">low</option>
38 <option value="1">medium</option>
39 <option value="2">high</option>
40
41 </select>
1.low级别
function no_check($data)
{ return $data; }
没有过滤
2.medium
1 function xss_check_1($data)
2 {
3
4 // Converts only "<" and ">" to HTLM entities
5 $input = str_replace("<", "<", $data);
6 $input = str_replace(">", ">", $input);
7
8 // Failure is an option
9 // Bypasses double encoding attacks
10 // <script>alert(0)</script>
11 // %3Cscript%3Ealert%280%29%3C%2Fscript%3E
12 // %253Cscript%253Ealert%25280%2529%253C%252Fscript%253E
13 $input = urldecode($input);
14
15 return $input;
16
17 }
str_replace():对<,>,进行替换,
urldecode()用于解码已编码的 URL 字符串,其原理就是把十六进制字符串转换为中文字符
也就是进行URL编码可以绕过过滤
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 }
htmlspecialchars() 函数把预定义的字符转换为 HTML 实体。
预定义的字符是:
- & (和号)成为 &
- " (双引号)成为 "
- ' (单引号)成为 '
- < (小于)成为 <
- > (大于)成为 >
bWAPP----HTML Injection - Reflected (GET)的更多相关文章
- bWAPP----HTML Injection - Reflected (URL)
HTML Injection - Reflected (URL) 核心代码 1 <div id="main"> 2 3 <h1>HTML Injection ...
- bWAPP----HTML Injection - Reflected (POST)
bWAPP--low--HTML Injection - Reflected (POST) 只不过是把传递方式换成post, 防护的三个级别和内容与GET相同 1 function htmli($da ...
- bWAPP练习--injection篇之HTML Injection - Reflected (GET)
什么是Injection? injection,中文意思就是注入的意思,常见的注入漏洞就是SQL注入啦,是现在应用最广泛,杀伤力很大的漏洞. 什么是HTML injection? 有交互才会产生漏洞, ...
- bWAPP练习--injection篇之HTML Injection - Reflected (POST)
POST的和之前的GET的过程差不多,只是表单的提交方式不一样而已. low 我们在表单中填入一个超链接 <a href="http://www.cnblogs.com/ESHLkan ...
- bWAPP练习--injection篇SQL Injection (GET/Search)
SQL注入: SQL注入,就是通过把SQL命令插入到Web表单提交或输入域名或页面请求的查询字符串,最终达到欺骗服务器执行恶意的SQL命令.具体来说,它是利用现有应用程序,将(恶意)的SQL命令注入到 ...
- 前端 跨站脚本(XSS)攻击的一些问题,解决<script>alert('gansir')</script>
问题1:跨站脚本(XSS)的一些问题,主要漏洞证据: <script>alert('gansir')</script>,对于这个问题怎么解决? (测试应当考虑的前端基础攻击问题 ...
- Web API接口安全了解
2017版OWASP top 10 将API安全纳入其中,足以说明API被广泛使用且安全问题严重.自己尝试整理一下,但限于本人搬砖经验还不足.水平有限,本文只能算是抛砖引玉,希望大伙不吝赐教. 了解W ...
- OWASP 之 HTML Injection
Summary HTML injection is a type of injection issue that occurs when a user is able to control an in ...
- Cross-Site Scripting:Reflected 跨站点脚本:获取
随机推荐
- IntelliJ IDEA 15款 神级超级牛逼插件推荐(超赞,谁用谁知道)
满满的都是干货 所有插件都是在 ctrl+alt+s 里的plugins 里进行搜索安装 1.CodeGlance 代码迷你缩放图插件 2. Codota 代码提示工具,扫描你的代码后,根据你的敲击 ...
- 剑指offer——2
剑指offer 机器人的运动范围 数组的应用和递归 package com.wang.test; public class Myso { /** * 题目描述 * 地上有一个m行和n列的方格.一个机器 ...
- 基于Spring读写分离
为什么是基于Spring的呢,因为实现方案基于Spring的事务以及AbstractRoutingDataSource(spring中的一个基础类,可以在其中放多个数据源,然后根据一些规则来确定当前需 ...
- Pytorch加载并可视化FashionMNIST指定层(Udacity)
加载并可视化FashionMNIST 在这个notebook中,我们要加载并查看 Fashion-MNIST 数据库中的图像. 任何分类问题的第一步,都是查看你正在使用的数据集.这样你可以了解有关图像 ...
- 赛门铁克和DigiCert证书有什么区别?
在众多国人眼里,赛门铁克Symantec名气更胜于DigiCert证书.但是,我们知道2017年赛门铁克因一系列原因被DigiCert收购,品牌名称也被更新为DigiCert Secure Site. ...
- Pytest 系列(25)- 标记用例级别 @allure.
如果你还想从头学起Pytest,可以看看这个系列的文章哦! https://www.cnblogs.com/poloyy/category/1690628.html 前言 平时写测试用例也会划分优先级 ...
- win32之临界区
线程安全问题 每个线程都有自己的栈,而局部变量是存储在栈中的,这就意味着每个线程都有一份自己的"局部变量",如果线程 仅仅使用 "局部变量" 那么就不存在线程安 ...
- 4G DTU是什么?
要从任何设备(个人计算机.平板电脑或智能手机)访问Internet,需要DTU或热点.大多数宽带和移动DTU在"4G"或第四代网络系统上运行.虽然互联网连接的许多基本原则与4G D ...
- centos6-增加阿里yum源
1.获取阿里的yum源覆盖本地官方yum源 wget -O /etc/yum.repos.d/CentOS-ali.repo http://mirrors.aliyun.com/repo/Centos ...
- python开发基础(二)运算符以及数据类型之tuple(元组)
# encoding: utf-8 # module builtins # from (built-in) # by generator 1.147 """ Built- ...

