CVE-2022-31086

8.8 HIGH

📋 TL;DR

LDAP Account Manager versions before 8.0 contain a vulnerability where incorrect regular expressions allow uploading PHP scripts to the config/templates/pdf directory. This could lead to remote code execution if that directory is accessible to remote users, though this is not the default configuration. Organizations running vulnerable LAM versions with web-accessible template directories are affected.

💻 Affected Systems

Products:
  • LDAP Account Manager (LAM)
Versions: All versions prior to 8.0
Operating Systems: All platforms running LAM
Default Config Vulnerable: ✅ No
Notes: Only vulnerable if config/templates/pdf directory is accessible to remote users, which is not the default configuration.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution with full system compromise, allowing attackers to execute arbitrary commands, steal data, or pivot to other systems.

🟠

Likely Case

Limited impact since the vulnerable directory is not web-accessible by default; exploitation requires specific misconfigurations.

🟢

If Mitigated

No impact if running patched version or if directory access controls prevent remote access to config/templates/pdf.

🌐 Internet-Facing: MEDIUM - While not default, misconfigured internet-facing instances could be exploited for RCE.
🏢 Internal Only: LOW - Internal instances with proper access controls have minimal risk.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ✅ No
Complexity: MEDIUM

Exploitation requires ability to upload files and web access to the vulnerable directory.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 8.0

Vendor Advisory: https://github.com/LDAPAccountManager/lam/security/advisories/GHSA-q9pc-x84w-982x

Restart Required: Yes

Instructions:

1. Backup current LAM configuration and data. 2. Download LAM version 8.0 or later from official sources. 3. Replace existing installation with new version. 4. Restart web server service. 5. Verify functionality.

🔧 Temporary Workarounds

Restrict directory access

all

Ensure config/templates/pdf directory is not accessible via web server

# For Apache: Add to .htaccess or virtual host config
<Directory "/path/to/lam/config/templates/pdf">
    Require all denied
</Directory>
# For Nginx: Add to server block
location /lam/config/templates/pdf {
    deny all;
    return 403;
}

🧯 If You Can't Patch

  • Implement strict access controls to prevent web access to config/templates/pdf directory
  • Monitor file upload functionality and audit directory permissions regularly

🔍 How to Verify

Check if Vulnerable:

Check LAM version via web interface or by examining installed files; versions below 8.0 are vulnerable if config/templates/pdf is web-accessible.

Check Version:

# Check LAM version via web interface or config file
grep 'lamVersion' /path/to/lam/config/lam.conf

Verify Fix Applied:

Confirm LAM version is 8.0 or higher and test that PHP files cannot be uploaded to config/templates/pdf directory.

📡 Detection & Monitoring

Log Indicators:

  • File upload attempts to config/templates/pdf directory
  • PHP file execution from unusual locations
  • Web server access logs showing requests to /lam/config/templates/pdf/

Network Indicators:

  • HTTP POST requests with file uploads to LAM endpoints
  • Unexpected outbound connections from web server

SIEM Query:

source="web_server_logs" AND (uri="/lam/config/templates/pdf/*" OR uri="*/upload*" AND referer="*lam*")

🔗 References

📤 Share & Export