CVE-2021-38599

7.5 HIGH

📋 TL;DR

WAL-G backup tool versions before 1.1 silently ignore encryption keys when using official binary releases, uploading backups in cleartext instead of encrypting them. This affects users who rely on WAL-G for database backups and expect encryption to protect sensitive data. The vulnerability violates the Principle of Least Surprise as users assume encryption is active when configured.

💻 Affected Systems

Products:
  • WAL-G
Versions: All versions before 1.1
Operating Systems: All
Default Config Vulnerable: ✅ No
Notes: Only affects non-libsodium builds (official binary releases). Custom builds with libsodium are not vulnerable. Vulnerability only manifests when encryption is configured but silently fails.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Sensitive database backups containing PII, financial data, or credentials are uploaded to cloud storage in cleartext, potentially exposing them to unauthorized access or data breaches.

🟠

Likely Case

Backups intended to be encrypted are stored unencrypted, creating data exposure risks if storage systems are compromised or accessed by unauthorized parties.

🟢

If Mitigated

If proper access controls exist on backup storage and monitoring detects cleartext uploads, impact is limited to potential data exposure rather than direct exploitation.

🌐 Internet-Facing: MEDIUM
🏢 Internal Only: HIGH

🎯 Exploit Status

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

No active exploitation required - vulnerability causes automatic cleartext uploads when encryption is configured but using vulnerable binaries. Attackers would need access to backup storage to benefit.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 1.1 and later

Vendor Advisory: https://github.com/wal-g/wal-g/commit/cadf598e1c2a345915a21a44518c5a4d5401e2e3

Restart Required: No

Instructions:

1. Upgrade WAL-G to version 1.1 or later. 2. Replace existing binary with patched version. 3. Verify encryption is working by testing backup creation and checking encrypted output.

🔧 Temporary Workarounds

Build with libsodium

all

Compile WAL-G from source with libsodium support instead of using official binaries

go build -tags libsodium -o wal-g main/pg/main.go

Use external encryption

linux

Encrypt backups before WAL-G upload using external tools like gpg or openssl

tar czf - /data | gpg --encrypt --recipient backup@example.com | wal-g backup-push /dev/stdin

🧯 If You Can't Patch

  • Audit all existing backups in storage to identify any cleartext data and secure/delete them
  • Implement strict access controls on backup storage systems and enable logging/monitoring for unauthorized access attempts

🔍 How to Verify

Check if Vulnerable:

Check WAL-G version with 'wal-g --version'. If version is below 1.1 and using official binary, system is vulnerable when encryption is configured.

Check Version:

wal-g --version

Verify Fix Applied:

Create test backup with encryption configured, then attempt to restore without decryption key. If restoration fails, encryption is working.

📡 Detection & Monitoring

Log Indicators:

  • Backup operations completing without encryption-related log entries
  • Unexpectedly fast backup completion times (encryption adds overhead)

Network Indicators:

  • Backup uploads to cloud storage without encrypted traffic patterns
  • Cleartext database content in network captures

SIEM Query:

source="wal-g" AND (NOT "encrypt" OR NOT "libsodium") AND action="backup-push"

🔗 References

📤 Share & Export