CVE-2021-42013

9.8 CRITICAL

📋 TL;DR

CVE-2021-42013 is a critical path traversal vulnerability in Apache HTTP Server that allows attackers to access files outside configured directories. If CGI scripts are enabled for aliased paths, this can lead to remote code execution. Only Apache versions 2.4.49 and 2.4.50 are affected.

💻 Affected Systems

Products:
  • Apache HTTP Server
Versions: 2.4.49 and 2.4.50 only
Operating Systems: All operating systems running affected Apache versions
Default Config Vulnerable: ⚠️ Yes
Notes: Vulnerability requires specific path traversal patterns and depends on directory configuration. CGI script execution amplifies risk.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution with full system compromise if CGI is enabled and files outside aliased directories are not properly restricted.

🟠

Likely Case

Unauthorized file access and potential information disclosure from sensitive files.

🟢

If Mitigated

Limited impact if 'require all denied' is properly configured for all directories.

🌐 Internet-Facing: HIGH - Web servers are directly exposed and exploit is unauthenticated.
🏢 Internal Only: MEDIUM - Internal attackers could still exploit but requires network access.

🎯 Exploit Status

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

Multiple public exploit scripts and proof-of-concepts are available. Attack requires specific URL patterns but is straightforward to execute.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Apache HTTP Server 2.4.51

Vendor Advisory: https://httpd.apache.org/security/vulnerabilities_24.html

Restart Required: Yes

Instructions:

1. Download Apache 2.4.51 or later from official Apache website. 2. Stop Apache service. 3. Backup configuration files. 4. Install new version. 5. Restart Apache service.

🔧 Temporary Workarounds

Disable CGI for aliased paths

all

Prevent remote code execution by disabling CGI script execution for vulnerable path configurations.

# In Apache configuration, ensure: Options -ExecCGI
# Or specifically: <Directory "/path/to/aliased">
    Options -ExecCGI
</Directory>

Implement strict directory permissions

all

Ensure all directories outside aliased paths have 'require all denied' configuration.

# In Apache configuration:
<Directory "/">
    Require all denied
</Directory>
# Then explicitly allow only necessary directories

🧯 If You Can't Patch

  • Immediately upgrade to Apache 2.4.51 or later - this is the only complete fix.
  • If upgrade is impossible, implement WAF rules to block path traversal patterns and restrict CGI execution.

🔍 How to Verify

Check if Vulnerable:

Check Apache version with 'httpd -v' or 'apache2 -v'. If version is 2.4.49 or 2.4.50, system is vulnerable.

Check Version:

httpd -v (or apache2 -v on some systems)

Verify Fix Applied:

After patching, verify version shows 2.4.51 or later. Test with known exploit patterns to confirm they are blocked.

📡 Detection & Monitoring

Log Indicators:

  • URL requests containing '..' or encoded path traversal patterns like '%2e%2e'
  • Access to files outside expected document root
  • CGI script execution from unexpected paths

Network Indicators:

  • HTTP requests with path traversal patterns to Apache servers
  • Unusual file access patterns from single source

SIEM Query:

source="apache_access" AND (uri="*..*" OR uri="*%2e%2e*" OR uri="*%252e%252e*")

🔗 References

📤 Share & Export