Tech • AI • Robotics • Game

ENFR

OWASP ZAP Tutorial for Beginners (Free Hands-On Lab)

5/10
AIKodeKloudNovember 24, 2026 at 03:00 PM7:21
Audio player

⏱ ≈ 3 min read · 7-min video — 4 min saved

TL;DR

A test scan of a small online store uncovered three critical web vulnerabilities—SQL injection, path traversal, and cross-site scripting—showing how untrusted user input can expose hidden data, server files, and browser sessions.

KEY POINTS

Automated scan exposed three major flaws

A security scan using ZAP completed in about 90 seconds and flagged three high-risk issues in the store application: SQL injection, path traversal, and cross-site scripting. The application included a search feature, an invoice download page, and a review form, and each of those functions mapped directly to one of the vulnerabilities.

OpenAPI documentation made the attack surface easy to map

The application published an /openapi.json file listing its available endpoints and expected inputs. Such documentation helps developers integrate with an app, but it also gives attackers a clear map of where to probe. ZAP used that same specification to drive an active scan, automatically sending malicious test inputs to each route.

Active scanning deliberately tried to break the app

Unlike passive scanning, which only observes traffic, active scanning submits payloads designed to trigger failures. In this case, the scanner tried a quotation mark to disrupt database queries, ../ sequences to escape folders, and HTML or script content to test browser rendering. It then analyzed the responses for signs that the application had trusted dangerous input.

Search box leaked a confidential product through SQL injection

The store’s search function accepted a crafted string resembling ' or 1=1 --. That input terminated the original search term, added a condition that is always true, and used the comment marker to suppress the remainder of the database query. As a result, the application revealed a hidden, unreleased product called NextG AI Gateway, marked confidential.

Invoice download endpoint allowed path traversal

The invoice feature was intended to fetch files such as invoice_101.txt, but it failed to restrict the requested path. By repeatedly using ../, an attacker could move up the directory tree and request the server’s /etc/passwd file. That file does not typically contain passwords on modern systems, but it does expose local account information and confirms unauthorized access to the host file system.

Review preview executed attacker-supplied HTML

The reviews page rendered user input directly in a preview. A malicious payload using an image tag with a broken source and an onerror handler triggered a browser alert, demonstrating cross-site scripting. In practice, the same flaw could be used to steal session data or run actions in another user’s browser.

All three flaws came from trusting input without validation

The database, file system, and browser each received raw user input without proper controls. That common pattern is a core cause of many web attacks and aligns closely with risks highlighted by the OWASP Top 10, a widely used industry reference for common application security failures.

Small code changes blocked the attacks

The search flaw was fixed with parameterized queries, ensuring user input is treated as data rather than executable SQL. The file download issue was mitigated with os.path.basename, stripping directory traversal elements from filenames. The review flaw was closed with html.escape, converting special characters into safe text so the browser displays them instead of executing them.

Additional hardening improved the app’s security posture

Developers also disabled an exposed debug page and added the missing security headers flagged during scanning. After the changes, the same three attack attempts no longer succeeded, and a repeat scan reported zero serious problems.

Pipeline integration turned the scan into a deployment gate

The scan was designed to run automatically in a CI/CD pipeline such as GitHub Actions or GitLab CI. A rules file defined which findings should fail the build. When the fixed application was scanned again, ZAP returned an exit code of 0, allowing deployment to proceed only after the critical issues had been eliminated.

CONCLUSION

The case shows how ordinary web features can become high-impact attack paths when applications trust user input by default. Automated scanning and basic defensive coding can prevent those flaws from reaching production.

Ask a question

More from AI