CVE-2025-5878

7.3 HIGH

📋 TL;DR

This vulnerability in ESAPI esapi-java-legacy allows SQL injection attacks through the Encoder.encodeForSQL interface due to improper neutralization of special elements. It affects applications using this library for SQL injection defense, potentially enabling attackers to execute arbitrary SQL commands remotely. The vulnerability is particularly concerning because an exploit has been publicly disclosed.

💻 Affected Systems

Products:
  • ESAPI esapi-java-legacy
Versions: All versions before 2.7.0.0
Operating Systems: All operating systems running Java applications using ESAPI
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects applications using the Encoder.encodeForSQL interface for SQL injection defense.

⚠️ Manual Verification Required

This CVE does not have specific version information in our database, so automatic vulnerability detection cannot determine if your system is affected.

Why? The CVE database entry doesn't specify which versions are vulnerable (no version ranges provided by the vendor/NVD).

🔒 Custom verification scripts are available for registered users. Sign up free to download automated test scripts.

Recommended Actions:
  1. Review the CVE details at NVD
  2. Check vendor security advisories for your specific version
  3. Test if the vulnerability is exploitable in your environment
  4. Consider updating to the latest version as a precaution

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full database compromise including data theft, data manipulation, or complete system takeover through SQL injection leading to remote code execution.

🟠

Likely Case

SQL injection allowing unauthorized data access, data modification, or privilege escalation in affected applications.

🟢

If Mitigated

Limited impact if proper input validation and parameterized queries are already in place alongside ESAPI.

🌐 Internet-Facing: HIGH - Attack can be initiated remotely and public exploit exists.
🏢 Internal Only: MEDIUM - Internal attackers could exploit this vulnerability if they have network access to affected systems.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploit has been publicly disclosed and the vulnerability is in a security library designed to prevent SQL injection.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 2.7.0.0

Vendor Advisory: https://github.com/ESAPI/esapi-java-legacy/blob/develop/documentation/ESAPI-security-bulletin13.pdf

Restart Required: Yes

Instructions:

1. Upgrade ESAPI esapi-java-legacy to version 2.7.0.0 or later. 2. Update dependencies in your project configuration (Maven pom.xml, Gradle build.gradle, etc.). 3. Rebuild and redeploy your application. 4. Restart application servers.

🔧 Temporary Workarounds

Disable Encoder.encodeForSQL usage

all

Stop using the vulnerable Encoder.encodeForSQL interface and switch to parameterized queries or other SQL injection prevention methods.

Code modification required - replace Encoder.encodeForSQL calls with prepared statements or other secure alternatives

🧯 If You Can't Patch

  • Implement strict input validation and use parameterized queries instead of relying on ESAPI's encodeForSQL
  • Deploy web application firewall (WAF) with SQL injection protection rules

🔍 How to Verify

Check if Vulnerable:

Check if your application uses ESAPI esapi-java-legacy version below 2.7.0.0 and calls Encoder.encodeForSQL method.

Check Version:

Check Maven/Gradle dependencies or examine ESAPI jar file version

Verify Fix Applied:

Verify ESAPI version is 2.7.0.0 or higher and that the application no longer uses Encoder.encodeForSQL or uses it with proper warnings.

📡 Detection & Monitoring

Log Indicators:

  • Unusual SQL error messages in application logs
  • Multiple failed SQL query attempts
  • Warnings about deprecated Encoder.encodeForSQL usage

Network Indicators:

  • Unusual database connection patterns
  • SQL injection payloads in HTTP requests

SIEM Query:

source="application_logs" AND ("SQL error" OR "encodeForSQL" OR "SQLException")

🔗 References

📤 Share & Export