CVE-2021-31816

7.5 HIGH

📋 TL;DR

CVE-2021-31816 is a cleartext storage vulnerability in Octopus Server where database passwords are written to log files in plaintext during initial configuration with external SQL databases. This affects Octopus Server administrators who configure external SQL databases, potentially exposing database credentials to anyone with access to log files.

💻 Affected Systems

Products:
  • Octopus Server
Versions: All versions before 2021.2.3150
Operating Systems: Windows, Linux
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects configurations using external SQL databases (not built-in SQLite). Vulnerability occurs during initial configuration phase.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Attackers gain database credentials, leading to full database compromise, data exfiltration, privilege escalation, or lateral movement to other systems.

🟠

Likely Case

Internal users or attackers with log file access obtain database credentials, potentially compromising the Octopus database and associated systems.

🟢

If Mitigated

With proper access controls and log file protection, risk is limited to authorized administrators only.

🌐 Internet-Facing: MEDIUM - If log files are exposed via web interfaces or misconfigured permissions, internet attackers could access credentials.
🏢 Internal Only: HIGH - Internal users with log file access can easily extract credentials, especially in shared environments.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: LIKELY
Unauthenticated Exploit: ✅ No
Complexity: LOW

Exploitation requires access to OctopusServer.txt log file. No authentication needed once file access is obtained.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 2021.2.3150 and later

Vendor Advisory: https://advisories.octopus.com/adv/2021-05---Cleartext-Storage-of-Sensitive-Information-(CVE-2021-31816).2121793537.html

Restart Required: Yes

Instructions:

1. Download Octopus Server 2021.2.3150 or later from Octopus Deploy website. 2. Run the installer. 3. Follow upgrade prompts. 4. Restart Octopus Server service.

🔧 Temporary Workarounds

Secure log file permissions

all

Restrict access to OctopusServer.txt log file to only necessary administrators

Windows: icacls "C:\Octopus\Logs\OctopusServer.txt" /inheritance:r /grant:r "Administrators:(R)"
Linux: chmod 600 /path/to/OctopusServer.txt

Remove sensitive log entries

all

Manually search and remove password entries from existing log files

Find password patterns: grep -i 'password\|pwd' OctopusServer.txt
Remove lines: sed -i '/password/d' OctopusServer.txt

🧯 If You Can't Patch

  • Rotate database passwords immediately after confirming log files don't contain credentials
  • Implement strict access controls on Octopus log directory and files

🔍 How to Verify

Check if Vulnerable:

Check OctopusServer.txt log files for plaintext database password entries, particularly around initial configuration timestamps

Check Version:

Octopus.Server.exe show-configuration --format=json | grep Version

Verify Fix Applied:

Verify Octopus Server version is 2021.2.3150 or later, and check that new configurations don't write passwords to logs

📡 Detection & Monitoring

Log Indicators:

  • Plaintext database connection strings in OctopusServer.txt
  • Password entries in log files during configuration

Network Indicators:

  • Unauthorized database connection attempts using credentials from logs

SIEM Query:

source="OctopusServer.txt" AND ("password=" OR "pwd=" OR "DatabasePassword")

🔗 References

📤 Share & Export