Lesson plan: Memory and Path Attacks
AP Cybersecurity · Unit 5 Securing Applications and Data · Topic 5.1 Application and Data Vulnerabilities and Attacks · Practice set
At a glance
- Suggested time
- 1 class period (45 min)
- Pacing
- Second of three sets for Topic 5.1. The CED gives Topic 5.1 five class periods; this plan suggests 2 for Injection Attacks, 1 for this set and 2 for Data Vulnerabilities and Risk. The CED does not divide the topic among sets, so that split is this plan's suggestion. This set covers 5.1.B.7 to 5.1.B.10: buffers, buffer overflow, GET requests and directory traversal.
- Before this set
- 🔒 Teacher notes: sign in as a teacher to see this🔒 Teacher notes: open the full plan to see this
- Skills
- 1.A Identify, with and without the support of AI, vulnerabilities, threats, and attack methods, and explain how they generate risk.1.B Determine ways adversaries exploit vulnerabilities to compromise an asset.
The one idea: Both attacks push a program past an edge it never checks. A buffer overflow writes input past the end of the memory set aside for it, over whatever is stored next; a directory traversal adds .. to a request's path until the path climbs out of the folder the server hands out.
Day by day
Day 1 · Past the end of the buffer, above the served folder45 min
- Open (3 min)Ask what happens on a paper form when a name is too long for its boxes, and what a program might do with the same name. Take a few guesses and come back to them at the lesson's The jersey name section.
- Mini-lesson (15 min)Teach Memory and Path Attacks, or assign it the night before. Stop at its three questions and take answers before reading on. In Directory traversal it asks which file the server opens; in Fortinet's VPN, 2019 to 2021, how a fixed device could still leak; in The jersey name, what happens to the data after the 14-character room.
- Do together (4 min)Problem 6 🔒 🔒 Teacher notes: sign in as a teacher to see this🔒 Teacher notes: open the full plan to see this
- On their own (8 min)Problem 1 🔒 what a buffer is · Problem 2 🔒 what a GET request does · Problem 3 🔒 what too much input does to a buffer · Problem 4 🔒 which logged request leaves the served folder.
- In pairs (9 min)Problem 5 🔒 Problem 7 🔒 Problem 8 🔒: one student says where the extra characters landed, in memory past a buffer or in a file path, and the other judges each choice against that. On Problem 7 🔒, the
200at the end of each line is the server's status code for a request it answered. - Discuss (3 min)Problem 8 🔒 🔒 Teacher notes: sign in as a teacher to see this🔒 Teacher notes: open the full plan to see this
- Exit check (3 min)🔒 Teacher notes: sign in as a teacher to see this🔒 Teacher notes: open the full plan to see this
Differentiation
- If students are struggling
- Before Problem 6 🔒, students copy the lesson's climb figure layout: the served folder on the first line, then one piece of the request's path per line, working each piece the way the figure does. They use the same layout on Problem 4 🔒, one request at a time. Give them a two-row card to keep beside them, one row for buffer overflow and one for directory traversal, which they fill in from the lesson in their own words.
- Extension
- Students write a four-line server log like the one in Problem 6 🔒 with one traversal request, name the folder the server hands out, and give four candidate files, each wrong one off by a different count of
... A partner works out which file the request opens. Then ask whyGET /photos/../photos/u10-green.jpgis harmless. - Vocabulary support
- buffer, memory, adjacent memory, overflow, crash, hypertext transfer protocol (HTTP), GET request, URL, file system, directory, path,
..(the folder one level up), root, served directory, directory traversal, virtual private network (VPN), multifactor sign-in.
From the course framework
LO 5.1.B Explain how application attacks exploit vulnerabilities.
- 5.1.B.7 When applications take user input, that input is written to a buffer. A buffer is a designated section of computer memory with a fixed size. If the amount of data the user enters exceeds the size of the buffer, it can overflow into adjacent memory locations and overwrite other parts of the computer's memory.
- 5.1.B.8 A buffer overflow attack feeds more data into memory than was allotted, which can cause a system to crash or to execute code outside the scope of a program's security policy, effectively allowing the adversary to perform unauthorized actions on a computer, such as accessing, modifying, or deleting files.
- 5.1.B.9 The files that run web applications are stored in directories on servers. When users access web applications, their browsers send GET requests using hypertext transfer protocol (HTTP). A GET request accesses a file somewhere in the filesystem of the server.
- 5.1.B.10 In a directory traversal attack, adversaries modify URLs and GET requests to attempt to access sensitive data (e.g., usernames and passwords) on a server's file system.
Framework example: A web server stores a site's images in /var/www/images/. An adversary changes an image request to ../../../etc/passwd. Each .. goes up one directory, so three of them return to the root, and from there the adversary asks for the passwd file, which lists the device's authorized usernames.