CVE-2024-40541

9.8 CRITICAL

📋 TL;DR

This SQL injection vulnerability in my-springsecurity-plus allows attackers to execute arbitrary SQL commands via the dataScope parameter in the /api/dept/build endpoint. Attackers can potentially read, modify, or delete database contents. All users running affected versions of my-springsecurity-plus are vulnerable.

💻 Affected Systems

Products:
  • my-springsecurity-plus
Versions: All versions before v2024.07.03
Operating Systems: All platforms running Java applications
Default Config Vulnerable: ⚠️ Yes
Notes: Vulnerability exists in the default configuration when using the /api/dept/build endpoint.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete database compromise leading to data theft, data destruction, or full system takeover via SQL injection to RCE chaining.

🟠

Likely Case

Unauthorized data access, privilege escalation, and potential data exfiltration from the application database.

🟢

If Mitigated

Limited impact with proper input validation, parameterized queries, and database permission restrictions in place.

🌐 Internet-Facing: HIGH
🏢 Internal Only: HIGH

🎯 Exploit Status

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

SQL injection via HTTP parameter manipulation requires authentication but is trivial to exploit once authenticated.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: v2024.07.03

Vendor Advisory: https://gitee.com/witmy/my-springsecurity-plus/issues/IAAH8A

Restart Required: Yes

Instructions:

1. Update my-springsecurity-plus to version v2024.07.03 or later. 2. Restart the application server. 3. Verify the fix by testing the /api/dept/build endpoint.

🔧 Temporary Workarounds

Input Validation Filter

all

Implement input validation to reject malicious dataScope parameter values

Implement Spring Security filter or interceptor to validate dataScope parameter against allowed values

WAF Rule

all

Deploy web application firewall rules to block SQL injection patterns

Configure WAF to block requests containing SQL keywords in dataScope parameter

🧯 If You Can't Patch

  • Disable or restrict access to the /api/dept/build endpoint
  • Implement database user with minimal permissions (read-only if possible)

🔍 How to Verify

Check if Vulnerable:

Test the /api/dept/build endpoint with SQL injection payloads in the dataScope parameter

Check Version:

Check application version in pom.xml or application properties

Verify Fix Applied:

Attempt SQL injection on patched version and verify error responses or blocked requests

📡 Detection & Monitoring

Log Indicators:

  • Unusual SQL errors in application logs
  • Multiple failed login attempts followed by /api/dept/build access

Network Indicators:

  • HTTP requests to /api/dept/build with SQL keywords in parameters
  • Unusual database query patterns

SIEM Query:

source="application.log" AND "dataScope" AND ("UNION" OR "SELECT" OR "INSERT" OR "DELETE")

🔗 References

📤 Share & Export