Courses3 levels
Level 1 · Foundations11 courses
Level 2 · Core5 courses
Level 3 · Advanced5 courses
Labs8 topics
Library Practice exams AI Range Pricing Start free

Practice library / Web attacks

Workbook · Hard · 8 hoursFree account

Advanced Web Attacks & Exploitation

Advanced techniques: request smuggling, deserialization, prototype pollution, and more.

  • source-code-review
  • request-smuggling
  • deserialization
  • prototype-pollution
  • rce
On this page 6 sections
  1. ·About This Workbook
  2. ·Chapter 1 — Source-Driven Testing
  3. Locked: Chapter 2 — Advanced Injection & Deserialization
  4. Locked: Chapter 3 — Auth Bypass to RCE
  5. Locked: Chapter 4 — Reporting Complex Chains
  6. Locked: Where to go next

Before you start

Advanced web attacks start in source code, not in the browser. This track covers the reading method, the dangerous sinks and the chains that turn one small flaw into remote code execution. It walks through HTTP request smuggling, insecure deserialization, server-side template injection, prototype pollution and second-order injection, with white-box review as the central skill. The common thread is a chain: an auth bypass opens an admin page, a sink on that page runs a command, and the web user writes to disk. Each chapter pairs an idea with a lab and ends with a short report on a real finding. The method matters more than the exploit of the week.

What You'll Learn

  • Review application source with a repeatable source-to-sink method
  • Match a sink or a trust boundary to the lab that teaches the attack
  • Explain how request smuggling, deserialization and template injection arise
  • Describe how one bug becomes a chain from authentication bypass to RCE
  • Write a chain report with reproduction steps, impact and a fix for each link
  • Name the control or log line that stops or detects each link

About This Workbook

This workbook is the map for the advanced web track. It does not repeat the labs. It gives the method, the order and the questions. The labs give the commands.

In the first track, Web Attacks with Kali, you test an application from the outside. Here you also have the source code. That changes the work: you read first and send requests second. A request that you send must test a claim that you already made from the code.

Authorised scope only. Run every technique in this track against a lab VM that you build and control, or a public practice target (DVWA, hack.me, hackmyvm, picoCTF). Never test an application without written permission. The track teaches how to find and fix these flaws. It contains no exploit for a named product or version.

Prerequisites

  • Finish Web Attacks with Kali. It teaches the black-box method that this track builds on.
  • Know how to read PHP and Python at a basic level. You do not need to write either.

How to use the track

The track has four chapters. Each chapter has a short explanation, a route through the labs and questions with answers.

ChapterLabs for the practiceTime
1. Source-driven testingWhite-Box Web Exploitation (steps 1 and 2)1.5 hours
2. Advanced injection and deserializationInsecure Deserialization, SSTI2.5 hours
3. Auth bypass to RCEWhite-Box Web Exploitation, HTTP Request Smuggling2.5 hours
4. Reporting complex chainsYour own notes from chapters 1 to 31.5 hours

Some labs in this track are still marked as outlines. If a lab is an outline, read the chapter, answer the questions and return to the lab when it is finished.

Chapter 1 — Source-Driven Testing

Objectives

  • Map an unfamiliar code base in 15 minutes
  • Trace tainted input from a request to a dangerous sink
  • Rank the findings by how close the input is to the sink

Explanation

A source is a place where attacker data enters the code: a query parameter, a header, a cookie, a body field, an uploaded file name. A sink is a function that does something dangerous with data: it runs a command, builds a query, renders a template or restores an object. A taint is the path between the two. A bug exists when tainted data reaches a sink with no check or with a wrong check.

Do the work in this order:

  1. Map the code. Find the entry points (routes and controllers), the configuration and the authentication code. Read these before anything else.
  2. List the sinks. Search for the dangerous functions of the language.
  3. Trace backwards. For each sink, follow its input back to a source. Stop when you reach a check that really blocks the input.
  4. Test last. Write one claim per sink ("this parameter reaches shell_exec without escaping"). Then send one request that proves or disproves it.

Most sink searches are a single grep. This search lists common PHP sinks in a lab application:

cd /var/www/html && grep -rnE 'shell_exec|system\(|passthru|exec\(|unserialize\(|eval\(' --include=*.php .
./app/controllers/ToolsController.php:42:    $out = shell_exec("ping -c 1 " . $_GET['host']);
./app/lib/Session.php:18:    $data = unserialize(base64_decode($_COOKIE['prefs']));

Both lines are findings to trace. In line 42 the source ($_GET['host']) is joined to the sink with no check. In line 18 a cookie, which the user controls, goes into unserialize. For Python code, search for pickle.loads, yaml.load(, subprocess with shell=True, eval( and render_template_string.

Rank findings by distance. A sink that is one function call from a source is a better first test than a sink that is five layers deep.

Worked example

You receive a small PHP application and the two lines above.

  1. Open ToolsController.php around line 42 and look for a check on host above the sink. There is none.
  2. Check the route table to see who can reach ToolsController. If the route needs an administrator, this flaw is a second step, not a first step. Chapter 3 returns to this point.
  3. Write the claim: "An administrator can run a shell command through host."
  4. Repeat for line 18 in Session.php. The cookie is set before login, so any visitor can reach it.

The second finding ranks higher, because it needs no account.

Practice

Do steps 1 and 2 of White-Box Web Exploitation. Stop before you send any request to the application.

Question 1. Why do you read the authentication code before you search for sinks?

Answer

It tells you which sinks an anonymous visitor can reach. A sink behind an administrator check has a lower first-step risk. A weak check, such as a hardcoded header or a debug flag, can remove that protection and make the sink reachable.

Question 2. A function calls escapeshellarg() on a value and then passes it to shell_exec. Is it a finding?

Answer

Not by itself. escapeshellarg() is a real check. Confirm that the escaped value is the same variable that reaches the sink, and that it is used inside a quoted argument. Note it as "checked" and move on.

Question 3. You find unserialize() on a value that comes from a database column. What do you ask next?

Answer

Who can write to that column? If a user can write to it, even through another feature, the database is a source (a second-order flow). The input is stored first and used later.

Sign in to continue

4 more sections are for signed-in members. It is free: sign in with Google.

Related