CVE-2021-32802

9.3 CRITICAL

📋 TL;DR

Nextcloud servers with image previews enabled are vulnerable to server-side request forgery (SSRF), file disclosure, or potential remote code execution when processing malicious image files. This affects self-hosted Nextcloud instances using vulnerable third-party image processing libraries. Attackers could exploit this by uploading specially crafted images.

💻 Affected Systems

Products:
  • Nextcloud Server
Versions: Versions before 20.0.12, 21.0.4, and 22.1.0
Operating Systems: All platforms running Nextcloud
Default Config Vulnerable: ⚠️ Yes
Notes: Only vulnerable if image previews are enabled (default setting). The specific library varies by system configuration.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution leading to full system compromise, data theft, or lateral movement within the network.

🟠

Likely Case

Server-side request forgery allowing internal network scanning and file disclosure from the Nextcloud server.

🟢

If Mitigated

Limited impact with proper network segmentation and previews disabled.

🌐 Internet-Facing: HIGH - Internet-facing Nextcloud instances are directly exposed to attack via file uploads.
🏢 Internal Only: MEDIUM - Internal instances still vulnerable to authenticated users or compromised accounts.

🎯 Exploit Status

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

Exploitation requires authenticated user access to upload files. Public proof-of-concept exists in HackerOne report #1261413.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 20.0.12, 21.0.4, or 22.1.0

Vendor Advisory: https://github.com/nextcloud/security-advisories/security/advisories/GHSA-m682-v4g9-wrq7

Restart Required: Yes

Instructions:

1. Backup your Nextcloud instance and database. 2. Update Nextcloud via the web updater or manual download. 3. Run occ upgrade command. 4. Restart web server services.

🔧 Temporary Workarounds

Disable Image Previews

all

Completely disable image preview generation in Nextcloud configuration

Edit config.php and add: 'enable_previews' => false

🧯 If You Can't Patch

  • Disable image previews immediately via config.php
  • Restrict file upload permissions and monitor for suspicious image uploads

🔍 How to Verify

Check if Vulnerable:

Check Nextcloud version via Admin panel or run: php occ status | grep version

Check Version:

php occ status | grep version

Verify Fix Applied:

Confirm version is 20.0.12+, 21.0.4+, or 22.1.0+ and verify previews are disabled if using workaround

📡 Detection & Monitoring

Log Indicators:

  • Unusual image processing errors in Nextcloud logs
  • Multiple failed preview generation attempts
  • Large or malformed image uploads

Network Indicators:

  • Outbound requests from Nextcloud server to internal services
  • Unexpected file access patterns

SIEM Query:

source="nextcloud.log" AND ("preview" OR "image" OR "upload") AND (error OR failed OR exception)

🔗 References

📤 Share & Export