-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding another path traversal level, changing some names, and startin…
…g in on simplifying refactors
- Loading branch information
Showing
14 changed files
with
152 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
You have learned Linux and HTTP. | ||
Now, let's put these together! | ||
|
||
Web content is served up via the internet by _web servers_, and like everything else, these web servers, and the pages that they serve up, contain vulnerabilities! | ||
In this module, you will wrap yourself in the mysteries of the web, exploring various types of vulnerabilities that can occur. | ||
As you work through this module, keep in mind, these aren't theoretical curiosities: these are common, critical vulnerabilities that occur _all the time_. | ||
|
||
Now, dive in, and hack! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
This level will explore the intersection of Linux path resolution, when done naively, and unexpected web requests from an attacker. | ||
We've implemented a simple web server for you --- it will serve up files from /challenge/files over HTTP. | ||
Can you trick it into giving you the flag? | ||
|
||
The webserver program is `/challenge/server`. | ||
You can run it just like any other challenge, then talk to it over HTTP (using a different terminal or a web browser). | ||
We recommend reading through its code to understand what it is doing and to find the weakness! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Welcome to Web Security! |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/opt/pwn.college/python | ||
|
||
import flask | ||
import os | ||
|
||
app = flask.Flask(__name__) | ||
|
||
@app.route("/", methods=["GET", "POST"]) | ||
@app.route("/<path:path>", methods=["GET", "POST"]) | ||
def challenge(path="index.html"): | ||
requested_path = app.root_path + "/files/" + path | ||
real_path = os.path.realpath(requested_path) | ||
|
||
try: | ||
return open(requested_path).read() | ||
except PermissionError: | ||
flask.abort(403, real_path) | ||
except FileNotFoundError: | ||
flask.abort(404, real_path) | ||
except Exception as e: | ||
flask.abort(500, real_path + ":" + str(e)) | ||
|
||
app.secret_key = open("/flag").read().strip() | ||
app.run("challenge.localhost", int(os.environ.get("HTTP_PORT", 80))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: Web Security | ||
challenges: | ||
- id: level-1 | ||
name: Path Traversal 1 | ||
- id: path-traversal-2 | ||
name: Path Traversal 2 | ||
- id: level-2 | ||
name: CMDi | ||
description: Exploit a command injection vulnerability | ||
- id: level-3 | ||
name: Authentication Bypass | ||
description: Exploit an authentication bypass vulnerability | ||
- id: level-4 | ||
name: SQLi 1 | ||
description: Exploit a structured query language injection vulnerability to login | ||
- id: level-5 | ||
name: SQLi 2 | ||
description: Exploit a structured query language injection vulnerability to leak data | ||
- id: level-6 | ||
name: SQLi 3 | ||
description: Exploit a structured query language injection vulnerability with an unknown database structure | ||
- id: level-7 | ||
name: SQLi 4 | ||
description: Exploit a structured query language injection vulnerability to blindly leak data | ||
- id: level-8 | ||
name: XSS 1 | ||
description: Exploit a cross site scripting vulnerability | ||
- id: level-9 | ||
name: XSS 2 | ||
description: Exploit a cross site scripting vulnerability with more complicated context | ||
- id: level-10 | ||
name: XSS 3 | ||
description: Exploit a cross site scripting vulnerability to cause a user action | ||
- id: level-11 | ||
name: SSRF 1 | ||
description: Exploit a cross site request forgery vulnerability | ||
- id: level-12 | ||
name: SSRF 2 | ||
description: Exploit a cross site request forgery vulnerability where the request must POST | ||
- id: level-13 | ||
name: SSRF 3 | ||
description: Exploit a cross site scripting vulnerability to exfiltrate user session data | ||
- id: level-14 | ||
name: SSRF 4 | ||
description: Exploit a cross site scripting vulnerability to exfiltrate user data | ||
- id: level-15 | ||
name: Web Pwn | ||
description: Exploit a (memory corruption) stack injection vulnerability | ||
resources: | ||
- name: "Web Security: Introduction" | ||
type: lecture | ||
video: AKTYVWCi6ss | ||
playlist: PL-ymxv0nOtqrvXLSALV5SQ5v3oyKY4DWg | ||
slides: 1ATO_U0aUlk2LRhlnIwdqTkDfu-lWRb5xoLDv0NQLPs8 | ||
- name: "Web Security: Structured Query Language" | ||
type: lecture | ||
video: 433mRGcpHeA | ||
playlist: PL-ymxv0nOtqrvXLSALV5SQ5v3oyKY4DWg | ||
slides: 1KpvjoFnlC9HcUJbkg-_VASf2JETMwEZjpzO0uGSoCo4 | ||
- name: "Web Security: Injection" | ||
type: lecture | ||
video: sdStLx3_Q0M | ||
playlist: PL-ymxv0nOtqrvXLSALV5SQ5v3oyKY4DWg | ||
slides: 1rP8IIc_6B8Z7KpqBGxkneIzAjURRQ-YlkJV-_4dF-SM | ||
- name: "Web Security: Same-Origin Policy" | ||
type: lecture | ||
video: b1NOCHm4t_s | ||
playlist: PL-ymxv0nOtqrvXLSALV5SQ5v3oyKY4DWg | ||
slides: 1KkiR8B_9xQilW_yq6W9FZ6xBN78V0S1aH1XvQfufYIk | ||
- name: "Tooling Documentation" | ||
type: markdown | ||
content: | | ||
- [python -m http.server](https://docs.python.org/library/http.server.html) | ||
- [JavaScript Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Great job on the last level! | ||
This level tries to stop you from traversing the path. | ||
Can you still traverse it? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
You can observe a lot just by watching. | ||
-- Yogi Berra |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Haste makes waste. | ||
-- John Heywood |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
TV is chewing gum for the eyes. | ||
-- Frank Lloyd Wright |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
You rascal! We've secured this server. You'll have to content yourself with | ||
<a href="fortunes/fortune-1.txt">a</a> | ||
<a href="fortunes/fortune-2.txt">few</a> | ||
<a href="fortunes/fortune-3.txt">fortunes</a>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/opt/pwn.college/python | ||
|
||
import flask | ||
import os | ||
|
||
app = flask.Flask(__name__) | ||
|
||
@app.route("/", methods=["GET", "POST"]) | ||
@app.route("/<path:path>", methods=["GET", "POST"]) | ||
def challenge(path="index.html"): | ||
requested_path = app.root_path + "/files/" + path.strip("/.") | ||
real_path = os.path.realpath(requested_path) | ||
|
||
try: | ||
return open(requested_path).read() | ||
except PermissionError: | ||
flask.abort(403, real_path) | ||
except FileNotFoundError: | ||
flask.abort(404, real_path) | ||
except Exception as e: | ||
flask.abort(500, real_path + ":" + str(e)) | ||
|
||
app.secret_key = open("/flag").read().strip() | ||
app.run("challenge.localhost", int(os.environ.get("HTTP_PORT", 80))) |