为什么有些人认为二阶(也称为持久性)XSS 不是真正的 XSS?
Why do some consider 2nd-order (aka persistent) XSS to not be true XSS?
我正在阅读 "The Web Application Hacker's Handbook",它讨论了一阶(又名反射)XSS 和二阶(又名持久)XSS 之间的区别。它提到反射型 XSS 如何利用查询字符串参数的不完整或不存在的清理在用户的 DOM 中执行任意脚本,而不会将任何恶意代码持久化到应用程序的数据库中,以及二阶 XSS 实际上如何持久化恶意代码代码,稍后在用户 DOM 中执行。
我的问题与作者对二阶 XSS 的描述有关(在第 438 页,如果您手边有副本的话)。书中的描述指出:
Attacks against stored XSS vulnerabilities typically involve at least
two requests to the application. In the first, the attacker posts some
crafted data containing malicious code that the application stores. In
the second, a victim views a page containing the attacker’s data, and
the malicious code is executed when the script is executed in the
victim’s browser. For this reason, the vulnerability is also sometimes
called second-order cross-site scripting. (In this instance, “XSS” is
really a misnomer, because the attack has no cross-site element. [emphasis mine] The
name is widely used, however, so we will retain it here.)
在二阶 XSS 中,攻击者仍然注入的恶意代码(大概)仍然是一些指向外部服务器的任意脚本(例如,注入 src 属性为 [ 的 img
标签=11=]).我很困惑为什么作者然后声明此攻击没有跨站点元素。向恶意外部服务器发出请求在我看来像是一个适当的跨站点元素。我错过了什么吗?
对我来说,XSS 中的 'cross-site' 意味着恶意脚本本身是直接从另一个站点发送的。例如,在 url 参数上的反射 XSS 的情况下,恶意网站 A.com 可以通过在易受攻击的参数中攻击受害者网站 B.com 来制作 link B,当用户访问A,点击link,就会执行B上的脚本
所以我认为这不是关于恶意脚本在做什么,而是它来自哪里(以及如何)。
在存储型 XSS 的情况下,脚本通常直接在易受攻击的网站上输入,但情况并非总是如此,这样可以保持原始的 'cross-site' 元素。不过没关系,名字是一样的,因为底层问题和代码中的解决方案是一样的,所以漏洞的名字也是一样的。 :)
不管人们怎么称呼它,重要的是要避免它。 :)
我正在阅读 "The Web Application Hacker's Handbook",它讨论了一阶(又名反射)XSS 和二阶(又名持久)XSS 之间的区别。它提到反射型 XSS 如何利用查询字符串参数的不完整或不存在的清理在用户的 DOM 中执行任意脚本,而不会将任何恶意代码持久化到应用程序的数据库中,以及二阶 XSS 实际上如何持久化恶意代码代码,稍后在用户 DOM 中执行。
我的问题与作者对二阶 XSS 的描述有关(在第 438 页,如果您手边有副本的话)。书中的描述指出:
Attacks against stored XSS vulnerabilities typically involve at least two requests to the application. In the first, the attacker posts some crafted data containing malicious code that the application stores. In the second, a victim views a page containing the attacker’s data, and the malicious code is executed when the script is executed in the victim’s browser. For this reason, the vulnerability is also sometimes called second-order cross-site scripting. (In this instance, “XSS” is really a misnomer, because the attack has no cross-site element. [emphasis mine] The name is widely used, however, so we will retain it here.)
在二阶 XSS 中,攻击者仍然注入的恶意代码(大概)仍然是一些指向外部服务器的任意脚本(例如,注入 src 属性为 [ 的 img
标签=11=]).我很困惑为什么作者然后声明此攻击没有跨站点元素。向恶意外部服务器发出请求在我看来像是一个适当的跨站点元素。我错过了什么吗?
对我来说,XSS 中的 'cross-site' 意味着恶意脚本本身是直接从另一个站点发送的。例如,在 url 参数上的反射 XSS 的情况下,恶意网站 A.com 可以通过在易受攻击的参数中攻击受害者网站 B.com 来制作 link B,当用户访问A,点击link,就会执行B上的脚本
所以我认为这不是关于恶意脚本在做什么,而是它来自哪里(以及如何)。
在存储型 XSS 的情况下,脚本通常直接在易受攻击的网站上输入,但情况并非总是如此,这样可以保持原始的 'cross-site' 元素。不过没关系,名字是一样的,因为底层问题和代码中的解决方案是一样的,所以漏洞的名字也是一样的。 :)
不管人们怎么称呼它,重要的是要避免它。 :)