-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpractice.php
More file actions
79 lines (69 loc) · 2.82 KB
/
Copy pathpractice.php
File metadata and controls
79 lines (69 loc) · 2.82 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
<?php
echo "<h1>PHP Wrapper LFI Practice</h1>";
echo "<p>Practice using different PHP wrappers to retrieve flags.</p>";
// Flag 1: php://input (POST input)
echo "<h2>Flag 1: Use php://input</h2>";
echo "<p>Hint: Use the php://input wrapper to read from POST input stream.</p>";
echo "<form method='POST' action=''>";
echo "<label for='flag1'>Enter Flag 1:</label>";
echo "<input type='text' id='flag1' name='flag1' required><br><br>";
echo "<input type='submit' value='Submit'>";
echo "</form>";
if (isset($_POST['flag1']) && $_POST['flag1'] === 'CorrectFlag1') {
echo "<p>Correct! You've retrieved Flag 1.</p>";
} else {
echo "<p>Incorrect! Try again for Flag 1.</p>";
}
// Flag 2: php://filter (base64 encode/decode)
echo "<h2>Flag 2: Use php://filter</h2>";
echo "<p>Hint: Use php://filter with base64 encoding/decoding to access the file content.</p>";
echo "<form method='POST' action=''>";
echo "<label for='flag2'>Enter Flag 2:</label>";
echo "<input type='text' id='flag2' name='flag2' required><br><br>";
echo "<input type='submit' value='Submit'>";
echo "</form>";
if (isset($_POST['flag2']) && $_POST['flag2'] === 'CorrectFlag2') {
echo "<p>Correct! You've retrieved Flag 2.</p>";
} else {
echo "<p>Incorrect! Try again for Flag 2.</p>";
}
// Flag 3: php://memory
echo "<h2>Flag 3: Use php://memory</h2>";
echo "<p>Hint: Use php://memory to access a text stored in memory.</p>";
echo "<form method='POST' action=''>";
echo "<label for='flag3'>Enter Flag 3:</label>";
echo "<input type='text' id='flag3' name='flag3' required><br><br>";
echo "<input type='submit' value='Submit'>";
echo "</form>";
if (isset($_POST['flag3']) && $_POST['flag3'] === 'CorrectFlag3') {
echo "<p>Correct! You've retrieved Flag 3.</p>";
} else {
echo "<p>Incorrect! Try again for Flag 3.</p>";
}
// Flag 4: php://device
echo "<h2>Flag 4: Use php://device</h2>";
echo "<p>Hint: Use php://device to access a system device or file.</p>";
echo "<form method='POST' action=''>";
echo "<label for='flag4'>Enter Flag 4:</label>";
echo "<input type='text' id='flag4' name='flag4' required><br><br>";
echo "<input type='submit' value='Submit'>";
echo "</form>";
if (isset($_POST['flag4']) && $_POST['flag4'] === 'CorrectFlag4') {
echo "<p>Correct! You've retrieved Flag 4.</p>";
} else {
echo "<p>Incorrect! Try again for Flag 4.</p>";
}
// Flag 5: php://stdin
echo "<h2>Flag 5: Use php://stdin</h2>";
echo "<p>Hint: Use php://stdin to read input from a file.</p>";
echo "<form method='POST' action=''>";
echo "<label for='flag5'>Enter Flag 5:</label>";
echo "<input type='text' id='flag5' name='flag5' required><br><br>";
echo "<input type='submit' value='Submit'>";
echo "</form>";
if (isset($_POST['flag5']) && $_POST['flag5'] === 'CorrectFlag5') {
echo "<p>Correct! You've retrieved Flag 5.</p>";
} else {
echo "<p>Incorrect! Try again for Flag 5.</p>";
}
?>