Gruyere Learn Web Application Exploits Defenses Top -
Below are the most critical exploits, grouped by the primary layer they target. For each, we describe the exploit mechanism and then the defensive layers (Gruyère slices).
The Concept: This attack aims to access files and directories that are stored outside the web root folder.
| Defense Layer | How It Works | Stops Which Exploits |
|---------------|--------------|----------------------|
| Input Validation (allowlist) | Reject anything not explicitly allowed | SQLi, Command Injection, Path Traversal |
| Output Encoding | Convert < to < etc. | XSS |
| Parameterized Queries | Separate SQL code from data | SQL Injection |
| CSRF Tokens | Unique, unpredictable tokens per request | CSRF |
| SameSite Cookies | Restrict cookie sending to same site | CSRF |
| CSP (Content Security Policy) | Control which scripts can run | XSS (Stored/Reflected) |
| AuthN/AuthZ Checks | Verify identity and permissions | IDOR |
| Allowlist of Outbound IPs | Restrict server-initiated requests | SSRF |
| WAF (Web App Firewall) | Signature & anomaly blocking | Many, but not all (bypassable) | gruyere learn web application exploits defenses top
Gruyere teaches that blacklisting (e.g., blocking <script>) fails because attackers use <img src=x onerror=alert()>).
Gruyere is a deliberately vulnerable web application created by Google engineers. It’s designed as a self-paced, interactive “capture the flag” style tutorial to teach common web vulnerabilities and how to fix them. Below are the most critical exploits, grouped by
| Exploit | Single Most Important Defense |
|---------|-------------------------------|
| XSS | Output encoding (context‑aware) |
| SQLi | Parameterized queries (prepared statements) |
| CSRF | CSRF token (cryptographically random) |
| IDOR | Server‑side authZ check for every object access |
| Path Traversal | Reject ../ and use a fixed base path |
| SSRF | Block requests to internal IP ranges |
| Command Injection | Never call shell; use safe APIs |
Would you like a one-page printable cheat sheet of this, or a curated list of 5 starter labs (with solutions) to begin hacking safely? Gruyere teaches that blacklisting (e
Gruyere allows you to save your state and restore a fresh instance. After you successfully exploit a hole:
Don't just run Gruyere once. Integrate DAST (Dynamic Application Security Testing) tools like OWASP ZAP or Burp Suite into your CI/CD pipeline. Point ZAP at your staging environment; it will automatically try the same exploits you learned on Gruyere.