File tree 6 files changed +1932
-0
lines changed
6 files changed +1932
-0
lines changed Original file line number Diff line number Diff line change
1
+ <!DOCTYPE HTML>
2
+ <html>
3
+ <head>
4
+ <title>Vulnerable Website</title>
5
+ <head>
6
+
7
+ <?php
8
+
9
+ $ uploaddir = 'uploads/ ' ;
10
+ if (isset ($ _FILES ['file ' ])) {
11
+ $ file = $ _FILES ['file ' ];
12
+ $ filename = $ file ['name ' ];
13
+
14
+ $ dest = $ uploaddir . $ _POST ['path ' ] . $ filename ;
15
+ $ contents = file_get_contents ($ file ['tmp_name ' ]);
16
+ if (file_put_contents ($ dest , $ contents ))
17
+ echo "Upload successful, view your file here : <a href='/uploads/ " . $ filename . "'> $ filename.</a> " ;
18
+ else
19
+ echo "<h3 style='color:red'>Permission Denied : You can't write in this folder.</h3> " ;
20
+ }
21
+
22
+ ?>
23
+
24
+ <body>
25
+ <h1>Upload a file</h1>
26
+ <p>Upload a file at the path of your choice</p>
27
+
28
+ <form method="POST" enctype='multipart/form-data' action='.'>
29
+ <label>Path : </label>
30
+ <input type="text" name="path" placeholder="scenario_1/uploads/" style='width:800px'/>
31
+
32
+ <br/>
33
+
34
+ <input type="hidden" name="MAX_FILE_SIZE" value="2000000" />
35
+ <label>File : </label>
36
+ <input type="file" name="file"/>
37
+
38
+ <br/>
39
+ <input type="submit" value="Upload">
40
+ </form>
41
+
42
+ <a href="/scenario_1/override_me.php">override_me</a>
43
+ </body>
44
+ </html>
45
+
Original file line number Diff line number Diff line change
1
+ <?php
2
+ phpinfo ();
3
+ ?>
Original file line number Diff line number Diff line change
1
+ # Ignore everything in this directory
2
+ *
3
+ # Except this file
4
+ ! .gitignore
5
+
Original file line number Diff line number Diff line change
1
+ <?php
2
+ echo "Try to override me " ;
3
+ ?>
You can’t perform that action at this time.
0 commit comments