Skip to content
Wednesday, October 21, 2026AboutContactRSS
7 Apache Struts Mistakes That Leave Your Server Open to Attack
Vulnerabilities

7 Apache Struts Mistakes That Leave Your Server Open to Attack

Misconfigured parsers and outdated libraries allow attackers to execute arbitrary code on your server without needing valid credentials.

Quick answer

You likely expose your application to remote code execution by running outdated Struts versions, ignoring XML parser settings, or failing to validate file uploads. Fix these 6 common mistakes immediately by updating dependencies, disabling unsafe parsers, and enforcing strict input validation.

Mistake 1: Running Unpatched Struts Versions

You leave your server vulnerable by continuing to use older versions of the Apache Struts framework after security patches are released. Attackers scan for specific version strings in HTTP responses to identify targets that lack recent fixes. This exposure allows them to exploit known flaws in the framework’s core components.

Why it hurts:

Remote code execution becomes possible when an attacker sends a crafted request to an unpatched server. The framework processes the input incorrectly, allowing the attacker to run commands on the host operating system. This gives the attacker full control over the server environment.

The fix:

Update your Struts library to the latest stable release immediately. Automate this process using dependency management tools that check for new versions regularly. Test your application thoroughly after each update to ensure compatibility. Monitor the CISA Known Exploited Vulnerabilities catalog for urgent alerts regarding your specific version.

Infographic: 7 Apache Struts Mistakes That Leave Your Server Open to Attack. Outdated Struts versions contain known flaws that allow remote code execution. Default XML parsers can process external entities that leak internal files. File upload components often lack proper validation, enabling shell
Infographic: 7 Apache Struts Mistakes That Leave Your Server Open to Attack. Free to share with a link to NetSec Observer.

Mistake 2: Leaving Default XML Parsers Enabled

You permit the framework to use default XML parsers that support external entities. These parsers are designed to fetch and include external resources defined within the XML document. An attacker can craft an XML payload that references internal files or external servers.

Why it hurts:

This configuration enables Server-Side Request Forgery attacks. The server acts as a proxy, fetching sensitive data from internal networks that should not be accessible from the internet. It can also lead to Denial of Service attacks by forcing the server to process massive external files.

The fix:

Disable external entity processing in your XML parser configuration. Explicitly set the parser to reject any attempt to resolve external entities or DTDs. Verify that your application does not rely on legacy features that require these entities. This restriction prevents the server from fetching unauthorized resources.

Mistake 3: Ignoring File Upload Validation

You accept file uploads without verifying the file type or content. Many Struts applications allow users to upload documents, images, or configuration files. Attackers rename malicious scripts to look like benign files and upload them to your server.

Why it hurts:

If the server executes the uploaded file, the attacker gains a foothold on your system. This often leads to a web shell, which provides persistent access even if you change passwords. The attacker can then pivot to other systems within your network.

The fix:

Validate file uploads on the server side by checking the magic bytes of the file, not just the extension. Store uploaded files outside the web root directory to prevent direct execution. Use a whitelist approach to allow only specific, necessary file types. Combine this with external attack surface scanning to detect exposed upload endpoints.

Mistake 4: Using Weak Content Type Handling

You trust the Content-Type header provided by the client to determine how to process incoming data. The framework may use this header to decide which parser to apply to the request body. An attacker can spoof this header to bypass security filters.

Why it hurts:

This misconfiguration allows attackers to send malicious payloads disguised as harmless data types. The framework processes the payload using the wrong parser, bypassing input validation rules. This can lead to injection attacks that compromise the application logic.

The fix:

Inspect the actual content of the request rather than relying solely on the Content-Type header. Implement strict parsing rules that validate the structure of the data regardless of the declared type. Ensure that your framework configuration enforces these checks automatically. This reduces the risk of parser confusion attacks.

Mistake 5: Failing to Restrict OGNL Access

You allow Object-Graph Navigation Language expressions to access unrestricted properties in your application. OGNL is a powerful expression language used by Struts for dynamic data binding. If not properly restricted, it can expose internal objects and methods.

Why it hurts:

Attackers can craft OGNL expressions that traverse the object graph to access sensitive data. This can reveal configuration details, database credentials, or session information. It may also allow the execution of arbitrary methods on server-side objects.

The fix:

Restrict OGNL access to only the properties required by your application. Use allowlists to define which classes and methods can be accessed. Disable unnecessary features that expose internal objects to the expression evaluator. Regularly audit your configuration to ensure these restrictions remain in place.

Mistake 6: Neglecting Input Validation Rules

You rely on the framework’s default input validation without adding custom checks for your specific use cases. Default rules may not cover all edge cases or unique data formats your application expects. Attackers exploit these gaps to send malformed data.

Why it hurts:

Invalid input can cause the application to behave unpredictably. It may crash, leak error messages, or bypass security controls. This instability can be leveraged to discover vulnerabilities or disrupt service availability.

The fix:

Implement comprehensive input validation for all user-supplied data. Define strict rules for length, format, and allowed characters. Test your validation logic with various attack vectors to ensure it catches malicious input. Refer to guides on SQL injection to understand how invalid input can compromise databases.

Mistake 7: Overlooking Dependency Updates

You update the Struts framework but neglect to update its underlying dependencies. Struts relies on numerous third-party libraries that may have their own vulnerabilities. Outdated dependencies can introduce security holes even if the main framework is patched.

Why it hurts:

An attacker exploits a vulnerability in a dependency library to compromise your application. This bypasses the security improvements made in the main framework. The attack surface expands as more dependencies are added without regular review.

The fix:

Regularly audit and update all third-party dependencies in your project. Use tools that automatically detect outdated libraries and suggest replacements. Ensure that your build process fails if any dependency is known to be vulnerable. This holistic approach ensures that your entire stack remains secure.

MistakeFix
Running Unpatched Struts VersionsUpdate to the latest stable release and automate checks.
Leaving Default XML Parsers EnabledDisable external entity processing in parser configuration.
Ignoring File Upload ValidationValidate file content and store uploads outside the web root.
Using Weak Content Type HandlingInspect actual content rather than trusting client headers.
Failing to Restrict OGNL AccessUse allowlists to restrict accessible properties and methods.
Neglecting Input Validation RulesImplement custom validation for all user-supplied data.
Overlooking Dependency UpdatesAudit and update all third-party libraries regularly.

Key takeaways

  • Outdated Struts versions contain known flaws that allow remote code execution.
  • Default XML parsers can process external entities that leak internal files.
  • File upload components often lack proper validation, enabling shell uploads.
Bottom line

Apache Struts vulnerabilities often stem from misconfigurations and outdated components rather than just framework flaws. Update your dependencies, disable unsafe parsers, and enforce strict input validation to reduce your risk.

Frequently asked questions

How do I know if my Struts version is vulnerable?

Check the version against the official Apache Struts security advisories and the CISA Known Exploited Vulnerabilities catalog.

Can I fix Struts vulnerabilities without updating the framework?

Temporary mitigation may involve disabling specific features, but updating to the latest version is the only reliable fix.

What is the most common Struts attack vector?

Remote code execution via malformed requests that exploit parsing flaws in older versions is the most common vector.

How often should I update Struts dependencies?

Update immediately when security patches are released and regularly for maintenance updates to catch new vulnerabilities.

How this guide was produced: written by the NetSec Observer editorial team with AI assistance, checked against the public references listed below, and reviewed when the facts change. See our editorial policy or report an error.

Further reading

  1. CVE Program
  2. OWASP Top Ten
  3. FIRST: Common Vulnerability Scoring System

Related stories

CISA adds five exploited flaws to KEV catalog with 2026 compliance deadline

The Cybersecurity and Infrastructure Security Agency added five vulnerabilities to its catalog, setting a 2026 deadline for remediation across multiple vendors.