Apache Tomcat PreResources and PostResources are web application resource links that let Tomcat expose additional files to an application context. PreResources are searched before the application’s own resources, and PostResources are searched afterwards, which changes how files are resolved at runtime.
How PreResources and PostResources change Tomcat resource resolution
Tomcat evaluates these resource links in a predictable order, so they can alter which file an application sees at runtime. That matters because the same path can resolve to different content depending on whether Tomcat checks the linked resource before or after the webapp’s own files.
PreResources are useful when an operator needs Tomcat to surface shared or externally managed content ahead of the application package, while PostResources provide a fallback layer after the application’s own resources have been checked. The ordering is the security-relevant part: precedence determines whether an app reads the intended file or an injected one.
Why resource precedence matters for application behaviour
Resource ordering can affect static assets, configuration files, templates, and other application-visible content. If a PreResources entry shadows an application file, the application may behave as though its packaged content were replaced. If a PostResources entry is used, the application’s own files still win first, and the linked resource is only consulted when the app does not supply that path.
This makes the feature powerful, but also easy to misuse. A small change in resource order can produce inconsistent behaviour across environments, especially when administrators assume that linked resources are simply additive rather than precedence-bearing.
Security implications of exposing additional files through Tomcat
Because these links extend what the application context can see, they can broaden the attack surface if the mapped files include secrets, administrative material, or writable content. A linked resource that should only supplement content can instead become a path for unexpected disclosure or content substitution if ownership, permissions, and placement are not tightly controlled.
When used deliberately, the feature can also support safer separation of deployment artefacts from shared content. The key control question is not whether Tomcat can load extra resources, but whether the linked files are trustworthy, read-only where appropriate, and isolated from untrusted modification.
Operational patterns and safe use cases
Administrators commonly use this mechanism for externalised content, shared libraries, environment-specific overrides, or content that must live outside the application archive. In those cases, the resource link should be treated as part of the application’s trusted configuration surface, not as a convenience feature to be added casually.
For security-sensitive deployments, the safest pattern is to keep the linked path narrow, document why precedence is needed, and verify that the application still resolves critical files from the intended location. A concise Tomcat hardening reference can help here, especially where resource mapping sits alongside broader server controls like connector settings and file-access restrictions, as outlined in Apache Tomcat Hardening Guide.
Risk and Threat Considerations
PreResources and PostResources create a trust boundary inside the application context, so mistakes can lead to file shadowing, unintended disclosure, or the use of attacker-influenced content. The greatest risk appears when linked resources are writable, come from less trusted locations, or are assumed to be harmless because they sit outside the webapp archive.
Failure mechanism: An application resolves the wrong resource because precedence causes Tomcat to prefer a linked file over the packaged file, or because a linked file is modified after deployment.
Impact: The application may serve altered pages, load unsafe configuration, expose sensitive material, or behave inconsistently in ways that are hard to detect during routine testing.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
NIST SP 800-53 Rev 5 and CIS Controls v8 set the technical controls, while ISO/IEC 27001:2022 defines the regulatory obligations.
| Framework | Control / Reference | Relevance |
|---|---|---|
| NIST SP 800-53 Rev 5 | CM-6 — Configuration Settings | Resource link ordering is a configuration decision that changes runtime file resolution. |
| AC-3 — Access Enforcement | Linked resources can alter which content an application is allowed to access at runtime. | |
| Recommendation — Define and review Tomcat resource mappings as controlled configuration settings. Enforce least-access rules on linked paths and restrict who can change them. | ||
| ISO/IEC 27001:2022 | A.8.9 — Configuration management | Tomcat resource precedence is a controlled runtime configuration that should be governed. |
| Recommendation — Manage resource-link changes through formal configuration control and approval. | ||
| CIS Controls v8 | CIS-4 — Secure Configuration of Enterprise Assets and Software | PreResources and PostResources are software configuration choices that can introduce exposure if misused. |
| Recommendation — Harden Tomcat resource mappings and baseline them in secure configuration standards. | ||
Practitioner Guidance
Why practitioners should care: Treat these links as a deployment control, not just a filesystem convenience. The same mechanism that supports clean content separation can also silently override application assumptions, so ownership of the linked path and the resolution order must be explicit.
What to watch for: Review any use of PreResources first, because it changes default lookup precedence and can mask packaged files. Use PostResources more conservatively when you only need fallback content, and confirm that linked material is read-only or otherwise protected from unexpected change.
Practitioner takeaway: If a resource link can change which file the app sees, it belongs in the same change-control and hardening conversation as other runtime configuration.
Related resources from NHI Mgmt Group
- How should security teams harden Apache Tomcat when management consoles are exposed to the internet?
- How should security teams reduce exposure to CVE-2025-24813 in Apache Tomcat before patching is complete?
- What breaks in practice when Apache Tomcat handles partial PUT paths incorrectly?
- What breaks when Apache Tomcat manager access is left exposed with weak credentials?
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 October 29, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org