-
Notifications
You must be signed in to change notification settings - Fork 19
/
EnDeUser.xml
639 lines (607 loc) · 18.3 KB
/
EnDeUser.xml
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
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
<?xml version="1.0"?>
<!--
#? NAME
#? EnDeUser.xml - menu for user defined nested functions
#?
#? SYNOPSIS
#? EnDeGUI.js expects EnDeUser.xml to contain user-defined functions.
#?
#? USAGE
#? Copy this file to the ./usr/ directory and make your changes there.
#?
#? ** please add you own functions below **
#?
#? DESCRIPTION
#? List of function for Functions window.
#?
#? Each <attack /> scope describes one menu entry as follows:
#?
#? <label> - a unique label, used to group functions in SELECT menu
#? <name> - descriptive name used in SELECT->OPTION menu
#? <code> - code to be added to Functions textarea
#? <desc> - descriptive text used in SELECT->OPTION's title= attribute
#?
#? LIMITATIONS
#? Examples herein are used as is. In particular EnDeGUI dos not honor the
#? "[] value" checkbox in the Functions window for the texts herein.
#?
# HACKER's INFO
# All code examples rely on existance of $() function, which must be:
# function $(id) { return document.getElementById(id); }
#?
#? SEE ALSO
#? EnDeUser.js
#? EnDeText.js
#? EnDeGUI.js
#?
#? VERSION
#? @(#) EnDeUser.xml 4.5 20/12/14 11:45:30
#?
#? AUTHOR
#? 10-10-08 Achim Hoffmann, mailto: EnDe (at) my (dash) stp (dot) net
# =============================================================================
-->
<xss>
<attack>
<label>Encoding User Functions ..</label>
<name>base64/hex</name>
<desc>first base64 encode text, then hex encode each character</desc>
<code><![CDATA[
EnDe.EN.dispatch(
"hex2",
"lazy",
true,
""+EnDe.EN.dispatch("base64","lazy",false,$('EnDeDOM.EN.text').value,'','',''),
'',
'',
''
)
]]></code>
</attack>
<attack>
<label>Encoding User Functions ..</label>
<name>base64/URL encode</name>
<desc>first base64 encode text, then URL encode</desc>
<code><![CDATA[
EnDe.EN.dispatch(
"urlCHR",
"lazy",
false,
""+EnDe.EN.dispatch("base64","lazy",false,$('EnDeDOM.EN.text').value,'','',''),
'',
'',
''
)
]]></code>
</attack>
<attack>
<label>Encoding User Functions ..</label>
<name>double URL/URL encode</name>
<desc>first URL-encode text, then URL encode again (for mixed double encoding)</desc>
<code><![CDATA[
EnDe.EN.dispatch(
'urlCHR',
'lazy',
false,
''+EnDe.EN.dispatch('urlCHR','lazy',false,$('EnDeDOM.EN.text').value,'','',''),
'',
'',
''
)
]]></code>
</attack>
<attack>
<label>Encoding User Functions ..</label>
<name>tripple URL/URL encode</name>
<desc>URL-encode text three times (for mixed tripple encoding)</desc>
<code><![CDATA[
EnDe.EN.dispatch(
'urlCHR',
'lazy',
false,
''+EnDe.EN.dispatch('urlCHR','lazy',false,
''+EnDe.EN.dispatch('urlCHR','lazy',false,$('EnDeDOM.EN.text').value,'','',''),
'','',''),
'',
'',
''
)
]]></code>
</attack>
<attack>
<label>Encoding User Functions ..</label>
<name>octal/URL encode</name>
<desc>first encode octal values then URL-encode text, then </desc>
<code><![CDATA[
EnDe.EN.dispatch(
"urlCHR",
"lazy",
false,
""+EnDe.EN.dispatch(
"oct3",
"lazy",
false,
$('EnDeDOM.EN.text').value,
$('EnDeDOM.API.prefix').value,
$('EnDeDOM.API.suffix').value,
$('EnDeDOM.API.delimiter').value
),
$('EnDeDOM.API.prefix').value,
$('EnDeDOM.API.suffix').value,
$('EnDeDOM.API.delimiter').value
)
]]></code>
</attack>
<attack>
<label>Encoding User Functions ..</label>
<name>MySQL/char</name>
<desc>first decimal encode text, then enclose with MySQL char() function</desc>
<code><![CDATA[
EnDe.EN.dispatch("dez2","lazy",true,$('EnDeDOM.EN.text').value,'','',',').replace(/^/,'char(').replace(/$/,')')
]]></code>
</attack>
<attack>
<label>Encoding User Functions ..</label>
<name>Oracle/CHR</name>
<desc>first decimal encode text, then enclose with Oracle CHR() function</desc>
<code><![CDATA[
EnDe.EN.dispatch("dez2","lazy",true,$('EnDeDOM.EN.text').value,'','',',').replace(/^/,'CHR(').replace(/$/,')')
]]></code>
</attack>
<attack>
<label>Encoding User Functions ..</label>
<name>MySQL/Oracle CONCAT</name>
<desc>concat characters of strings with CONCAT() function</desc>
<code><![CDATA[
EnDe.EN.dispatch("copy","lazy",true,$('EnDeDOM.EN.text').value,"","","").split('').join("','").replace(/(.*)/,"CONCAT('$1')")
]]></code>
</attack>
<attack>
<label>Encoding User Functions ..</label>
<name>Oracle ||</name>
<desc>concat characters of strings with Oracle || function</desc>
<!-- same as En-/Decoding->Straight Character in "User Api Options", but more complicated ;-) -->
<code><![CDATA[
EnDe.EN.dispatch("copy","lazy",true,$('EnDeDOM.EN.text').value,"","","").split('').join("'||'").replace(/(.*)/,"'$1'")
]]></code>
</attack>
<attack>
<label>Encoding User Functions ..</label>
<name>MSQL +</name>
<desc>concat characters of strings with MSQL + function</desc>
<!-- same as En-/Decoding->Straight Character in "User Api Options", but more complicated ;-) -->
<code><![CDATA[
EnDe.EN.dispatch("copy","lazy",true,$('EnDeDOM.EN.text').value,"","","").split('').join("'+'").replace(/(.*)/,"'$1'")
]]></code>
</attack>
<attack>
<label>Encoding User Functions ..</label>
<name>APEX-style encode</name>
<desc>first URL-encode each paramter, then join them with : </desc>
<code><![CDATA[
EnDe.EN.dispatch(
"urlCHR",
"lazy",
$('EnDeDOM.API.uppercase').checked,
$('EnDeDOM.EN.text').value
.replace(/\t/g, '@@MASK_TAB@@') /* prevent TABs to be URL-encoded */
.replace(/\/\*\s*EnDe-Separator__do_not_remove_this_line.*\*\//g, '@@MASK_BAR@@') /* prevent colons to be URL-encoded */
.replace(/^ /mg,'') /* remove leading spaces */
.replace(/\n/g, '') /* remove NL */
,
"",
"",
""
)
.replace(/[!/='#+*~;.:]/g,function(a){return "%"+a.charCodeAt(0).toString(16)}) /* URL-encode all non-letters */
.replace(/@@MASK_TAB@@/g, '=') /* insert masked = */
.replace(/@@MASK_BAR@@/g, ':') /* insert masked | */
.replace(/@/g, '%40') /* finnaly URL-encode @ */
]]></code>
</attack>
<attack>
<label>Encoding User Functions ..</label>
<name>DWR-style encode</name>
<desc>first URL-encode each paramter, then join them with = </desc>
<code><![CDATA[
$('EnDeDOM.EN.text').value
.replace(/\t/g, '@@MASK_TAB@@') /* prevent TABs to be URL-encoded */
.replace(/[!/='#+*~;.]/g,function(a){return "%"+a.charCodeAt(0).toString(16)}) /* URL-encode all non-letters */
.replace(/@@MASK_TAB@@/g, '=') /* insert masked = */
]]></code>
</attack>
<attack>
<label>Encoding User Functions ..</label>
<name>GWT-style encode</name>
<desc>first URL-encode each paramter, then join them with | </desc>
<code><![CDATA[
EnDe.EN.dispatch(
"urlCHR",
"lazy",
$('EnDeDOM.API.uppercase').checked,
$('EnDeDOM.EN.text').value
.replace(/\t/g, '@@MASK_TAB@@') /* prevent TABs to be URL-encoded */
.replace(/\/\*\s*EnDe-Separator__do_not_remove_this_line.*\*\//g, '@@MASK_BAR@@') /* prevent BARs to be URL-encoded */
.replace(/^ /mg,'') /* remove leading spaces */
.replace(/\n/g, '') /* remove NL */
,
"",
"",
""
)
.replace(/[!/='#+*~,;:]/g,function(a){return "%"+a.charCodeAt(0).toString(16)}) /* URL-encode all non-letters */
.replace(/@@MASK_TAB@@/g, '=') /* insert masked = */
.replace(/@@MASK_BAR@@/g, '|') /* insert masked | */
.replace(/@/g, '%40') /* finnaly URL-encode @ */
]]></code>
</attack>
<!--
/* more restrictive: */
.replace(/[!/()='#+*~,;.:-]/g,function(a){return "%"+a.charCodeAt(0).toString(16)}) /* URL-encode all non-letters */
-->
<attack>
<label>Encoding User Functions ..</label>
<name>JWT-style encode (JSON Web Toolkit)</name>
<desc>first base64-encode each paramter, then join them with . </desc>
<code><![CDATA[
var sig = $('EnDeDOM.EN.text').value.split('\nEnDe-Separator__do_not_remove_this_line\n')[2];
/* only base64 encode signature if it was base64 encoded */
var is64=($('EnDeDOM.EN.text').value.split('\nEnDe-Separator__do_not_remove_this_line\n')[3].match(/=true/)!==null) ? true : false;
$('EnDeDOM.EN.text').value.split('\nEnDe-Separator__do_not_remove_this_line\n')[0],
EnDe.EN.dispatch(
"base64",
"lazy",
$('EnDeDOM.API.uppercase').checked,
$('EnDeDOM.EN.text').value.split('\nEnDe-Separator__do_not_remove_this_line\n')[0],
"","","").replace(/=/mg,'') + '.' +
EnDe.EN.dispatch(
"base64",
"lazy",
$('EnDeDOM.API.uppercase').checked,
$('EnDeDOM.EN.text').value.split('\nEnDe-Separator__do_not_remove_this_line\n')[1],
"","","").replace(/=/mg,'') + '.' +
((is64===false) ? sig : EnDe.EN.dispatch("base64","lazy",$('EnDeDOM.API.uppercase').checked,sig,"","","").replace(/=/mg,''));
]]></code>
<!-- above is a lazy approach because: -->
<!-- * JWT's base64 encoding may miss padding characters, need to be removed -->
<!-- * JWT's base64 encoded signature uses "Base64 SAP (-_ instead of +/) -->
<!-- * JWT's base64 encoded signature needs a salt (not yet implemented) -->
</attack>
<attack>
<label>Encoding User Functions ..</label>
<name>JSON-decoded Base64</name>
<desc>remove literal \r and \n then replace any \x by X</desc>
<code><![CDATA[
/* for JSON, BASE64 data contains literal \r \n and \/
* converts to BASE64 with literal \r \n and \/
*/
$('EnDeDOM.EN.text').value.replace(/\//g, '\\/').replace(/\r/g, '\\r').replace(/\n/g, '\\n')
]]></code>
</attack>
<attack>
<label>Decoding User Functions ..</label>
<name>hex/base64</name>
<desc>first decode hex charactersm then decode base64</desc>
<code><![CDATA[
EnDe.DE.dispatch(
"base64",
"lazy",
true,
""+EnDe.DE.dispatch("hexCHR","lazy",false,$('EnDeDOM.DE.text').value,'','',''),
'',
'',
''
)
]]></code>
</attack>
<attack>
<label>Decoding User Functions ..</label>
<name>URL/base64 decode</name>
<desc>first URL-decode text, then base64 decode</desc>
<code><![CDATA[
EnDe.DE.dispatch(
"base64",
"lazy",
false,
""+EnDe.DE.dispatch("urlCHR","lazy",false,$('EnDeDOM.DE.text').value,'','',''),
'',
'',
''
)
]]></code>
</attack>
<attack>
<label>Decoding User Functions ..</label>
<name>double URL/URL decode</name>
<desc>first URL-decode text, then URL decode again (for mixed double encoding)</desc>
<code><![CDATA[
EnDe.DE.dispatch(
'urlCHR',
'lazy',
false,
''+EnDe.DE.dispatch('urlCHR','lazy',false,$('EnDeDOM.DE.text').value,'','',''),
'',
'',
''
)
]]></code>
</attack>
<attack>
<label>Decoding User Functions ..</label>
<name>tripple URL/URL decode</name>
<desc>URL-decode text three times (for mixed tripple encoding)</desc>
<code><![CDATA[
EnDe.DE.dispatch(
'urlCHR',
'lazy',
false,
''+EnDe.DE.dispatch('urlCHR','lazy',false,
''+EnDe.DE.dispatch('urlCHR','lazy',false,$('EnDeDOM.DE.text').value,'','',''),
'','',''),
'',
'',
''
)
]]></code>
</attack>
<attack>
<label>Decoding User Functions ..</label>
<name>double \xHH/URL decode</name>
<desc>first replace \x by %, then URL-decode text, then URL decode again (for mixed double encoding)</desc>
<code><![CDATA[
EnDe.DE.dispatch(
'urlCHR',
'lazy',
false,
''+EnDe.DE.dispatch('urlCHR','lazy',false,
$('EnDeDOM.DE.text').value.replace(/\\x/g,'%'),'','',''),
'',
'',
''
)
]]></code>
</attack>
<attack>
<label>Decoding User Functions ..</label>
<name>URL/octal decode</name>
<desc>first URL-decode text, then decode octal values</desc>
<code><![CDATA[
EnDe.DE.dispatch(
"oct3",
"lazy",
false,
""+EnDe.DE.dispatch(
"urlCHR",
"lazy",
false,
$('EnDeDOM.DE.text').value,
$('EnDeDOM.API.prefix').value,
$('EnDeDOM.API.suffix').value,
$('EnDeDOM.API.delimiter').value
),
$('EnDeDOM.API.prefix').value,
$('EnDeDOM.API.suffix').value,
$('EnDeDOM.API.delimiter').value
)
]]></code>
</attack>
<attack>
<label>Decoding User Functions ..</label>
<name>fuzzy decoding</name>
<desc>try to decode obfuscated text</desc>
<code><![CDATA[
EnDe.DE.dispatch(
"fuzURLsq",
"lazy",
false,
""+EnDe.DE.dispatch(
"fuzHEXsq",
"lazy",
false,
""+EnDe.DE.dispatch(
"fuzOCTsq",
"lazy",
false,
$('EnDeDOM.DE.text').value.replace(/[\n\r]/g,''),
$('EnDeDOM.API.prefix').value,
$('EnDeDOM.API.suffix').value,
$('EnDeDOM.API.delimiter').value
),
$('EnDeDOM.API.prefix').value,
$('EnDeDOM.API.suffix').value,
$('EnDeDOM.API.delimiter').value
),
$('EnDeDOM.API.prefix').value,
$('EnDeDOM.API.suffix').value,
$('EnDeDOM.API.delimiter').value
)
]]></code>
</attack>
<attack>
<!-- // ToDo: not yet working! -->
<label>Decoding User Functions ..</label>
<name>fuzzy decoding evaluated</name>
<desc>try to decode obfuscated text and then use JavaScript's eval()</desc>
<code><![CDATA[
EnDe.DE.dispatch(
"JSeval",
"lazy",
false,
""+EnDe.DE.dispatch(
"fuzURLsq",
"lazy",
false,
""+EnDe.DE.dispatch(
"fuzHEXsq",
"lazy",
false,
""+EnDe.DE.dispatch(
"fuzOCTsq",
"lazy",
false,
$('EnDeDOM.DE.text').value.replace(/[\n\r]/g,''),
$('EnDeDOM.API.prefix').value,
$('EnDeDOM.API.suffix').value,
$('EnDeDOM.API.delimiter').value
),
$('EnDeDOM.API.prefix').value,
$('EnDeDOM.API.suffix').value,
$('EnDeDOM.API.delimiter').value
),
$('EnDeDOM.API.prefix').value,
$('EnDeDOM.API.suffix').value,
$('EnDeDOM.API.delimiter').value
),
'',
'',
''
)
]]></code>
</attack>
<attack>
<label>Decoding User Functions ..</label>
<name>APEX-style decode, full split</name>
<desc>split parameters on :, then URL-decode text</desc>
<code><![CDATA[
EnDe.DE.dispatch(
"urlCHR",
"lazy",
false,
$('EnDeDOM.DE.text').value
.replace(/[\r\n]/g,'') /* \r and \n are removed to avoid problems C&Ped texts */
.replace(/=/g,'\t') /* replace = by TAB */
.replace(/[:]/g,'\n/* EnDe-Separator__do_not_remove_this_line: : */\n'), /* replace separator by unique comment */
'',
'',
''
)
]]></code>
</attack>
<attack>
<label>Decoding User Functions ..</label>
<name>DWR-style decode, full split</name>
<desc>split parameters on =, then URL-decode text</desc>
<code><![CDATA[
EnDe.DE.dispatch(
"urlCHR",
"lazy",
false,
$('EnDeDOM.DE.text').value
.replace(/^([^=]*)/mg, function(a){return a+'\t';}), /* replace first = by TAB */
'',
'',
''
)
]]></code>
</attack>
<attack>
<label>Decoding User Functions ..</label>
<name>GWT-style decode, lazy (with XML)</name>
<desc>first URL-decode text but leave | as %7C, then pretty print XML</desc>
<!-- leaving | encoded is usefull if string should be split
on | later for GWT parsing -->
<code><![CDATA[
EnDe.Form.dispatch(
"XMLFormat",
"lazy",
""+EnDe.DE.dispatch(
"urlCHR",
"lazy",
false,
$('EnDeDOM.DE.text').value.replace(/[\r\n]/g,''), /* \r and \n are removed to allow C&P */
'',
'',
''
).replace(/[|]/g,'%7C'),
true,
5
)
]]></code>
</attack>
<attack>
<label>Decoding User Functions ..</label>
<name>GWT-style decode, full (with XML)</name>
<desc>first URL-decode text, then pretty print XML</desc>
<code><![CDATA[
EnDe.Form.dispatch(
"XMLFormat",
"lazy",
""+EnDe.DE.dispatch(
"urlCHR",
"lazy",
false,
$('EnDeDOM.DE.text').value.replace(/[\r\n]/g,''), /* \r and \n are removed to allow C&P */
'',
'',
''
),
true,
2 /* not used */
)
]]></code>
</attack>
<attack>
<label>Decoding User Functions ..</label>
<name>GWT-style decode, full split (with XML)</name>
<desc>split parameters on |, then URL-decode text and pretty print XML</desc>
<code><![CDATA[
EnDe.Form.dispatch(
"XMLFormat",
"lazy",
""+EnDe.DE.dispatch(
"urlCHR",
"lazy",
false,
$('EnDeDOM.DE.text').value
.replace(/[\r\n]/g,'') /* \r and \n are removed to avoid problems C&Ped texts */
.replace(/=/g,'\t') /* replace = by TAB */
.replace(/[|]/g,'\n/* EnDe-Separator__do_not_remove_this_line: | */\n'), /* replace separator by unique comment */
'',
'',
''
),
true,
2 /* not used */
)
]]></code>
<!-- above is a lazy approach and expects no TAB and NL within each URL-decoded parameter -->
</attack>
<attack>
<label>Decoding User Functions ..</label>
<name>JWT-style decode (JSON Web Toolkit)</name>
<desc>split parameters on ., then base64-decode text</desc>
<code><![CDATA[
var encsig = $('EnDeDOM.DE.text').value.split('.')[2];
var decsig = EnDe.DE.dispatch("base64","lazy",false,encsig,"","","");
EnDe.DE.dispatch("base64","lazy",false,$('EnDeDOM.DE.text').value.split('.')[0],"","","") +
'\nEnDe-Separator__do_not_remove_this_line\n' +
EnDe.DE.dispatch("base64","lazy",false,$('EnDeDOM.DE.text').value.split('.')[1],"","","") +
'\nEnDe-Separator__do_not_remove_this_line\n' +
decsig +
'\nEnDe-Separator__do_not_remove_this_line\n' +
'EnDe-JWT-signature-is-base64=' + (encsig!=decsig);
/* remember if signature is base64 encoded */
]]></code>
<!-- above is a lazy approach because: -->
<!-- * JWT's base64 encoding may miss padding characters -->
<!-- * JWT's base64 encoded signature uses "Base64 SAP (-_ instead of +/) -->
</attack>
<attack>
<label>Decoding User Functions ..</label>
<name>JSON-encoded Base64</name>
<desc>remove literal \r and \n then replace any \x by X</desc>
<code><![CDATA[
/* for JSON, BASE64 data contains literal \r \n and \/
* converts back to real BASE64
*/
EnDe.Text.dispatch(
EnDe.Text.dispatch(
EnDe.Text.dispatch(
EnDe.Text.dispatch($('EnDeDOM.DE.text').value,'txtDELbsn',0),
'txtDELbsr',0),
'txtREPbsany',0),
'txtDELnl',0
)
]]></code>
</attack>
</xss>