Look for controllers that return strings built from request parameters, path variables, or request URI data, especially when they do not use @ResponseBody. Also review methods that return void, Map, or Model, because Spring may derive the view name implicitly from the request path. If that value reaches a template resolver, the application may be exposed to injection.
What the warning signs look like in a Spring MVC controller
A controller becomes suspicious when it turns request-controlled data into a view name, either explicitly or through Spring’s implicit resolution rules. The main pattern is a response path that looks harmless at code review, but actually lets an attacker steer which template is rendered. That risk is highest when the controller returns a plain string, a model object, or nothing at all, and the result is not written directly to the response body.
The strongest clue is any string concatenation or formatting that combines user input with a view prefix, suffix, or template fragment. Query parameters, path variables, headers, and request URI data are all common inputs to inspect. If that value reaches the view resolver, the application may render an unintended template, expose internal files, or allow template-path manipulation depending on the engine and routing setup.
Implicit view naming is another important warning sign. Methods that return void, Map, or Model can still produce a view, because Spring may derive the view name from the request path. That means the security review has to include routing, handler mappings, and any rewriting or forwarding behavior, not just the return statement in isolation.
Controllers are also more fragile when they mix dynamic routing logic with template selection. A handler that decides which page to show based on a parameter, then forwards to that page using a computed string, creates a broader attack surface than a fixed view name. The pattern is especially concerning when the application assumes the input is “just a page identifier” rather than treating it as untrusted path data.
Where the vulnerability is usually introduced
View name manipulation usually appears when developers use request data as a convenience shortcut for navigation. A controller may map an action to a page by name, append a suffix such as .html or .jsp, or build a partial path from the request URI. That is dangerous because the framework will often treat the final string as a template lookup instruction rather than as harmless text.
Template resolver behavior matters here. If the resolver allows path traversal, unusual prefixes, or broad template resolution rules, a manipulated view name can change what the server tries to load. Even when the application does not reach arbitrary file content, the attacker may still influence business flows, expose internal views, or trigger error conditions that reveal implementation details.
Reviewers should also watch for controller methods that look like response handlers but are actually navigation handlers. In practice, the problem is not limited to a single return type or annotation. The key question is whether user-controlled data can influence the final logical view name after Spring applies its own conventions and any custom resolver configuration.
- Return values built from request parameters, path variables, or request URI fragments.
- Handlers that omit
@ResponseBodywhile still echoing input into a logical page name. - Methods returning
void,Map, orModelwhere Spring infers the view. - Forwarding or redirect logic that computes destinations from untrusted strings.
Risk and Threat Considerations
When an attacker can influence a view name, the impact is usually more than a cosmetic routing issue. At minimum, they may force the application to render an unintended page. In worse cases, they can reach sensitive templates, cause information leakage through error handling, or exploit a template engine and resolver combination that was not designed to process attacker-controlled paths.
Failure mechanism: The controller treats request data as navigation input, and Spring resolves that data into a logical view name after implicit conversion or concatenation. If the resolver accepts the resulting path, the attacker can steer the render target without needing direct code execution.
Impact: The result can be unauthorized template access, disclosure of internal application structure, broken access-control assumptions around “just a page,” and in some configurations, a larger injection or file-resolution problem that expands the blast radius of a simple request.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Agentic AI Top 10 and OWASP Non-Human Identity Top 10 address the attack and risk surface, while CIS Controls v8 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| CIS Controls v8 | CIS 16 — Application Software Security | View name manipulation is an application-input handling flaw in controller logic. |
| CIS 6 — Access Control Management | Manipulated view names can bypass intended page access and expose unauthorized templates. | |
| Recommendation — Validate controller inputs and constrain template resolution paths before rendering. Restrict renderable views to allowlisted destinations and separate user input from navigation logic. | ||
| OWASP Agentic AI Top 10 | A7 — Input and Output Handling | The issue arises when untrusted request data is transformed into an output target. |
| Recommendation — Sanitize request-derived values before they influence routing or rendered output. | ||
| OWASP Non-Human Identity Top 10 | NHI-06 — Secrets and Credential Exposure | Template-path manipulation can expose internal application artifacts or sensitive view resources. |
| Recommendation — Prevent user-controlled paths from reaching resolver logic that can disclose protected resources. | ||
Practitioner Guidance
What to verify: Trace every handler that returns a non-body response and confirm whether the final view name is fixed, derived, or partially influenced by the request. Pay special attention to code paths that look safe because they use a framework default rather than explicit string construction.
Common mistake: Teams often review only the visible return statement and miss the framework’s implicit view inference. A void or Model method can be just as risky as an obvious return "page/" + input; pattern if the request path is allowed to shape the template lookup.
Practitioner takeaway: Treat any controller-to-view decision as an input-validation problem, not a presentation detail, and only trust view names that are fixed or derived from tightly controlled, allowlisted values.
Related resources from NHI Mgmt Group
- Who is accountable if a vulnerable domain controller remains online after disclosure?
- Why do LLMs become more vulnerable to manipulation as sessions get longer?
- Why is a vulnerable SD-WAN controller such a high-value target?
- How should security teams verify whether a vulnerable UniFi controller is actually exploitable before prioritising response?
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on September 18, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org