sudo nano /var/www/html/SC201.htm
Paste in this code,
as shown below.
<html>
<body>
<form action="SC201.php">
Name: <input name="name"><p>
<input type="submit" value="Submit">
</form>
</body>
</html>
Save the file with Ctrl+X, Y, Enter.
sudo nano /var/www/html/SC201.php
Paste in this code,
as shown below.
<?php
if (!isset($_REQUEST['name'])) {
die("<h2>Error: No name specified!</h2>");
}
$name = $_REQUEST['name'];
print("Hello, $name!");
?>
Save the file with Ctrl+X, Y, Enter.
http://35.222.29.122/SC201.htmEnter your name into the form, as shown below, and click the Submit button. The next page should say Hello to you by name, as shown below. In a Web browser, open this page:
https://samlols.samsclass.info/SC/SC201.htmEnter the URL to your PHP page in the form for flag SC 201.1, as shown below, and click the Submit button.
Flag SC 201.1: Hello (5 pts)
The flag appears, as shown below.
http://35.222.29.122/SC201.htmEnter this name into the form:
<script>alert(1)</script>as shown below, and click the Submit button. The next page shows a pop-up box, as shown below.
This demonstrates a Cross-Site Scripting vulnerability--the user's name can be abused to inject script into the page.
< >I recommend using the str_replace function. Test your script on your own HTML form.
When it's working, run the test in the box below to get the flag.
Flag SC 201.2: Removing Characters (10 pts)
In a Web browser, open this page:
https://samlols.samsclass.info/SC/SC201.htmEnter the URL to your PHP page in the form for flag SC 201.2 and submit the form. If your code is correct, the flag will appear.
< >with these HTML-encoded versions:
< >When it's working, run the test in the box below to get the flag.
Flag SC 201.3: Encoding Characters (10 pts)
In a Web browser, open this page:
https://samlols.samsclass.info/SC/SC201.htmEnter the URL to your PHP page in the form for flag SC 201.3 and submit the form. If your code is correct, the flag will appear.
Posted 3-10-24