You have authorized access to a web application (source code, server configuration, HTTP traffic, or a combination) and need to assess the quality of its defensive security controls — not to find specific exploit payloads, but to evaluate whether the defenses themselves are sound.
This skill applies when:
The foundational insight from Stuttard and Pinto: Virtually all web applications use the same categories of defense mechanisms. The security difference between applications is not which mechanisms are present, but how well they are implemented. Assessing defensive quality requires understanding what the correct implementation looks like and systematically testing against that standard — not waiting to discover exploitable output.
Four assessment domains, each targeting a different layer of defense:
Authorized testing only. This skill is for security professionals with explicit written authorization to assess the target application and server.
Why: the four domains are largely independent; time-limited engagements may need to prioritize. Input validation and error handling are highest-value in most web app assessments.
Why: white-box analysis of source code enables detection of input handling class (whitelist vs blacklist) directly. Black-box testing relies on behavioral response analysis. Server configuration audit requires direct access to httpd.conf, web.xml, IIS config, or equivalent.
Why: detecting inter-tier trust abuse requires knowing whether components run on separate hosts, whether a shared database exists, and whether shared hosting or cloud infrastructure is involved.
Look for: Server:, X-Powered-By:, X-AspNet-Version:, X-Generator: headers that reveal technology stack and version; presence of Strict-Transport-Security, Content-Security-Policy, X-Frame-Options
If unavailable: note that header analysis requires HTTP access
Look for: HTTP 500 responses, SQL error text in responses, stack trace output, debug console output embedded in HTML
If unavailable: proceed with source code analysis of exception handling logic
Look for: web.config, httpd.conf, nginx.conf, web.xml, php.ini, .htaccess, appsettings.json
If unavailable: defer to behavioral testing for configuration weaknesses
ACTION: For each category of user-supplied input the application processes, determine which of the five input handling approaches is being applied. The five approaches are:
WHY: The choice of approach has a direct bearing on how easily the defense can be bypassed. Blacklists are systematically bypassable through encoding, case variation, comment insertion, and null byte injection — a blacklist of SELECT can be bypassed with SeLeCt, SELECT/**/, or %00SELECT. Whitelisting is the strongest defense where feasible. Safe data handling (parameterized queries) eliminates entire vulnerability classes regardless of input content. Understanding which approach is in use for each input type reveals which inputs are inadequately defended and why.
AGENT: EXECUTES — Grep source code for input validation logic, regex patterns, filtering functions, and database query construction. Identify the approach applied to each input category.
For each identified input category, document:
Red flags:
exec(), system(), shell_exec(), subprocess.call(shell=True) receiving user-controlled valuesreplace() on attack strings (stripping, not blocking) rather than rejectionACTION: Map all trust boundaries in the application — points where data crosses from one component to another where the receiving component applies different security assumptions. Common trust boundaries: browser-to-server, server-to-database, server-to-SOAP/REST back-end service, server-to-OS command execution, server-to-email sending (SMTP), server-to-LDAP, server-to-cache layer. For each boundary, verify that input validation appropriate to the receiving component's vulnerabilities is applied at that boundary.
WHY: The simple picture of input validation — clean at the perimeter, trust internally — is fundamentally inadequate. Consider a login flow: the application receives the username, validates basic character set (step 1), performs a SQL query to check credentials (step 2), passes account data to a SOAP service to retrieve profile (step 3), renders the account page in HTML (step 4). Each step is a trust boundary. SQL injection defenses must be applied before step 2. XML metacharacter encoding must be applied before step 3. HTML encoding must be applied before step 4. Perimeter validation alone cannot protect all boundaries simultaneously, because conflicting encoding requirements make a single pass impossible: HTML-encoding prevents XSS but does not prevent SQL injection; SQL escaping does not prevent SMTP header injection.
AGENT: EXECUTES — Trace the data flow of key user inputs through the application. For each processing stage, verify that the appropriate validation or encoding for the receiving component is applied immediately before that component receives the data.
Boundary-specific validation requirements to check:
| Boundary | Required Defense |
|---|---|
| --- | --- |
| Server → SQL database | Parameterized queries or stored procedures (not escaping alone) |
| Server → HTML output | HTML entity encoding of all user data in output |
| Server → SOAP/XML service | XML metacharacter encoding of user data before XML construction |
| Server → OS command | Avoid passing user data to OS commands; if unavoidable, use exec array form, not shell string |
| Server → email (SMTP) | Strip or reject CR/LF in any field used in SMTP headers |
| Server → file system path | Canonicalize path, validate against allowed base directory, reject traversal sequences |
| Server → LDAP | Escape LDAP special characters; prefer LDAP API calls over raw filter construction |
Finding: Any trust boundary where validation appropriate to the receiving component is absent or insufficient constitutes a boundary validation gap.
ACTION: Identify all input validation logic that performs multiple sequential operations on user input (for example: strip , then strip javascript:, then output). Also identify all points where the application decodes or canonicalizes user input. Verify that the ordering rule is satisfied: decode/canonicalize first, then validate, never re-encode after validation.
Test for these specific failure patterns:
is stripped once, the input ipt> will produce after one pass../ then ..\ — the input ..../ after first pass becomes ../, bypassing the second check%27 (URL-encoded apostrophe) at the application but then URL-decoding the value before passing it to the database — the decoded ' reaches the databaseWHY: Multistep validation introduces ordering dependencies that attackers can exploit. An application that strips a blocked expression once can be fed a nested version that reconstitutes itself after stripping. An application that applies filters before canonicalization can be fed encoded versions of blocked characters. The safe ordering is: perform all decoding and canonicalization first, so that validation sees the final processed form of the input, not an intermediate form that subsequent processing will transform further.
AGENT: EXECUTES — Read input validation functions for iterative or sequential sanitization logic. Check whether canonicalization (URL decoding, HTML decoding, Unicode normalization) is applied before or after filter checks.
Test with (black-box):
ipt>alert(1) ipt> (tests non-recursive stripping)%2527 → after first URL decode → %27 → after second → ' (tests validate-before-decode ordering)%3cscript%3e for where only literal form is blockedACTION: Systematically probe the application to trigger error conditions and analyze what information is returned. For each functional area, submit: values of the wrong type, values of unexpected length, missing required parameters, values that reference nonexistent resources, and known attack strings for the technologies in use (SQL single-quote for database errors, ../../ for path traversal, ${7*7} for template injection).
For each error response, check for disclosure of:
WHY: Verbose error messages give an attacker a detailed map of the application's internals at no cost. A stack trace identifies the exact framework version (enabling known-CVE attacks), the database technology (enabling SQL injection tuning), the file system layout (enabling path traversal), and which component generated the error (enabling targeted exploitation). A database error message containing the partial SQL query allows an attacker to reconstruct the full query and craft a precise injection. This information gathering step is a standard part of every targeted attack, not a vulnerability in isolation — but it dramatically accelerates every other attack that follows.
AGENT: EXECUTES (response analysis and source code review of exception handling) — HANDOFF TO HUMAN for interactive error triggering via proxy.
In source code, look for:
DEBUG=True, customErrors mode="Off", display_errors=On)phpinfo() pages or equivalent diagnostic endpoints left accessibleScan raw HTTP responses for error keywords: error, exception, illegal, invalid, fail, stack, access, directory, file, not found, varchar, ODBC, SQL, SELECT — matches in responses that are not expected to contain these words indicate information disclosure.
ACTION: Examine the following disclosure surfaces in the live application:
HTTP response headers:
Server: header — reveals web server product and versionX-Powered-By: — reveals framework, language, versionX-AspNet-Version:, X-Generator:, X-Runtime: — framework specificsHTML source of all application pages:
Sensitive data published to authorized users:
WHY: Server banners enable automated and manual fingerprinting of the exact product version, directly mapping to the CVE database. Developers frequently leave HTML comments containing information gathered during development — database schema notes, access control bypass hints, environment variable names, or even temporary hardcoded credentials. Pre-populating password fields means the existing password is transmitted in cleartext to the browser on every page load, even if the user never interacts with it — it is visible in the page source and in any browser extension or corporate proxy that logs traffic.
AGENT: EXECUTES — Read all page source files and response captures. Grep for comment markers (. Finding: test payment card data embedded in production HTML comment.
customErrors mode="On" in web.config with generic error page redirect; suppress Server: header via URLScan/IIS Lockdown; remove all HTML comments from production deployment pipeline.Output: 5 information disclosure findings (1 Critical for session key exposure, 2 High for stack trace + SQL error, 2 Medium for version banners and payment card in comment).
This skill is licensed under CC-BY-SA-4.0.
Source: BookForge — The Web Application Hacker's Handbook: Finding and Exploiting Security Flaws by Dafydd Stuttard, Marcus Pinto.
This skill is standalone. Browse more BookForge skills: bookforge-skills
共 1 个版本
暂无安全检测报告