CVE-2018-1285

9.8 CRITICAL

📋 TL;DR

Apache log4net versions before 2.0.10 have XML external entities (XXE) enabled when parsing configuration files, allowing attackers to read arbitrary files, perform server-side request forgery, or cause denial of service. This affects any application using vulnerable log4net versions that accepts attacker-controlled configuration files. The vulnerability is particularly dangerous when applications allow users to upload or specify log4net configuration files.

💻 Affected Systems

Products:
  • Apache log4net
Versions: All versions before 2.0.10
Operating Systems: All operating systems running .NET applications
Default Config Vulnerable: ⚠️ Yes
Notes: Only vulnerable when applications parse log4net configuration files from untrusted sources. Applications using hardcoded or trusted configuration files are not affected.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution, complete system compromise, sensitive data exfiltration, and lateral movement within the network through XXE attacks.

🟠

Likely Case

Arbitrary file read from the server, server-side request forgery to internal systems, and potential denial of service through entity expansion attacks.

🟢

If Mitigated

Limited impact if configuration files are not user-controllable and proper input validation is in place.

🌐 Internet-Facing: HIGH - Applications accepting user-uploaded configuration files or allowing users to specify configuration file paths are directly exploitable.
🏢 Internal Only: MEDIUM - Internal applications could still be vulnerable if they accept configuration from untrusted internal sources.

🎯 Exploit Status

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

Exploitation requires the application to parse attacker-controlled log4net configuration files. XXE attacks are well-documented and easy to implement.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 2.0.10 and later

Vendor Advisory: https://issues.apache.org/jira/browse/LOG4NET-575

Restart Required: Yes

Instructions:

1. Update log4net package to version 2.0.10 or later. 2. For NuGet: Update-Package log4net -Version 2.0.10. 3. Rebuild and redeploy applications. 4. Restart affected services.

🔧 Temporary Workarounds

Disable DTD processing

all

Configure XML parsers to disable DTD processing and external entity resolution

Set XmlResolver property to null in XmlReaderSettings
Set ProhibitDtd = true in XmlTextReader

Restrict configuration sources

all

Ensure log4net configuration files only come from trusted, hardcoded locations

🧯 If You Can't Patch

  • Implement strict input validation to reject any user-supplied configuration files
  • Use application-level firewalls to block outbound connections from affected systems

🔍 How to Verify

Check if Vulnerable:

Check log4net assembly version in application binaries or configuration. Versions below 2.0.10 are vulnerable if they parse external configuration files.

Check Version:

powershell: [System.Reflection.Assembly]::LoadFile('log4net.dll').GetName().Version

Verify Fix Applied:

Verify log4net version is 2.0.10 or higher in deployed applications and test that XXE payloads in configuration files are rejected.

📡 Detection & Monitoring

Log Indicators:

  • Unusual file access patterns from application process
  • Outbound connections to unexpected internal/external systems
  • XML parsing errors with external entity references

Network Indicators:

  • HTTP requests to internal systems from application server
  • DNS requests for unusual domains from application process

SIEM Query:

source='application_logs' AND (message CONTAINS 'file:' OR message CONTAINS 'http:' OR message CONTAINS 'ENTITY')

🔗 References

📤 Share & Export