CVE-2025-66545
Executive Summary
CVE-2025-66545 is a vulnerability in Nextcloud Groupfolders, an application that provides admin-configured folders shared by everyone in a group or team. The vulnerability allows a user with read-only permission to restore a file from the trash bin. This is a violation of the intended access control, as read-only users should not be able to perform write operations like restoring files. The vulnerability has a low CVSS score of 3.5, indicating a limited impact, but it still represents a security boundary bypass that could lead to data integrity issues.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
This vulnerability is specific to the Nextcloud ecosystem, which is a self-hosted file sync and sharing platform. It is not a package manager (NPM, PyPI, Go, Ruby) vulnerability, but rather a server application vulnerability. The Nextcloud Groupfolders app is typically installed via the Nextcloud app store or manually deployed. Administrators should ensure they are using a patched version of the app.
CVSS Breakdown & Threat Level
- CVSS Score: 3.5 (Low)
- Attack Vector: Network (AV:N)
- Attack Complexity: Low (AC:L)
- Privileges Required: Low (PR:L) - The attacker must have a valid user account with read-only permissions on the group folder.
- User Interaction: None (UI:N)
- Scope: Unchanged (S:U)
- Confidentiality Impact: None (C:N)
- Integrity Impact: Low (I:L) - The attacker can restore a file, potentially overwriting or undoing a deletion.
- Availability Impact: None (A:N)
Threat Level: Low. The vulnerability requires an authenticated user with read-only access. The impact is limited to restoring files from the trash, which does not directly expose sensitive data or allow code execution.
Deep Dive & Mechanics
The Nextcloud Groupfolders app implements access control to ensure that users with read-only permissions cannot modify files. However, the trash bin restoration functionality was not properly protected. When a file is deleted from a group folder, it is moved to the trash bin. The restore operation should be restricted to users with write or delete permissions, but due to a missing permission check, a read-only user can trigger the restore.
The vulnerability exists in the trash bin handling code. The application likely checks permissions for the initial delete operation but fails to re-validate permissions when the restore action is performed. This allows a read-only user to send a restore request, which the server processes without verifying that the user has the necessary write permissions.
Vulnerable vs. Patched Code
The vulnerable code likely lacks a permission check in the restore function. The patched code adds a check to ensure the user has write or delete permissions before allowing the restore.
Vulnerable Code (Conceptual):
// In the restore function
public function restore($fileId) {
$file = $this->trashManager->getFile($fileId);
// Missing permission check
$this->trashManager->restore($file);
}
Patched Code (Conceptual):
// In the restore function
public function restore($fileId) {
$file = $this->trashManager->getFile($fileId);
// Added permission check
if (!$this->groupfoldersManager->hasWritePermission($file->getFolderId(), $this->userId)) {
throw new \Exception('Permission denied');
}
$this->trashManager->restore($file);
}
Exploitation & Lab Setup
Red Team
Prerequisites:
- A Nextcloud instance with Groupfolders app installed (vulnerable version).
- A user account with read-only permissions on a group folder.
- A file that has been deleted from that group folder (exists in the trash bin).
Exploitation Steps:
- Log in as the read-only user.
- Navigate to the trash bin of the group folder.
- Identify a deleted file.
- Send a restore request (e.g., via the Nextcloud WebDAV interface or API).
- The file is restored, bypassing the intended permission restriction.
Example API Request (using curl):
curl -X POST 'https://nextcloud.example.com/ocs/v2.php/apps/groupfolders/trash/restore' \
-H 'OCS-APIRequest: true' \
-H 'Content-Type: application/json' \
-d '{"folderId": 123, "fileId": 456}' \
-u 'readonlyuser:password'
Blue Team
Detection:
- Monitor for restore operations on group folders by users with read-only permissions.
- Look for unusual patterns in trash bin activity, such as a high volume of restore requests from a single user.
- Review logs for permission denied errors that may indicate attempted exploitation.
Prevention:
- Apply the patch immediately.
- Implement additional monitoring on the trash bin restore endpoint.
- Use Web Application Firewall (WAF) rules to block suspicious restore requests.
Indicators of Compromise (IOCs)
- Log Entries: Successful restore operations by users with read-only permissions.
- API Calls: POST requests to
/ocs/v2.php/apps/groupfolders/trash/restorefrom unexpected users. - File Changes: Files that were previously deleted reappearing in the group folder without a corresponding delete or upload event.
Detection Engineering
YARA Rule
rule Detect_CVE_2025_66545_Exploit {
meta:
description = "Detects attempts to exploit CVE-2025-66545 in Nextcloud Groupfolders"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-66545"
strings:
$s1 = "groupfolders/trash/restore" ascii wide nocase
$s2 = "restore" ascii wide nocase
condition:
all of them
}
Sigma Rule
title: Nextcloud Groupfolders Trash Restore by Read-Only User
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects a restore operation on a group folder trash bin by a user with read-only permissions.
author: Valters IT
date: 2025-04-10
references:
- https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2025-66545
logsource:
category: application
product: nextcloud
detection:
selection:
event: "restore"
permission: "read-only"
condition: selection
falsepositives:
- Legitimate restore by a user whose permissions were recently changed.
level: medium
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (
msg:"CVE-2025-66545 Nextcloud Groupfolders Trash Restore Exploit";
flow:to_server,established;
content:"POST";
http_method;
content:"/ocs/v2.php/apps/groupfolders/trash/restore";
http_uri;
classtype:attempted-user;
sid:1000001;
rev:1;
)
Remediation & Mitigation
Immediate Actions:
- Patch: Upgrade Nextcloud Groupfolders to version 14.0.11, 15.3.12, 16.0.15, 17.0.14, 18.1.8, 19.1.8, or 20.1.2 (or later).
- Verify: After patching, test that read-only users can no longer restore files from the trash bin.
- Audit: Review logs for any signs of exploitation.
Long-Term Mitigations:
- Implement the principle of least privilege for all users.
- Regularly review and audit user permissions.
- Enable detailed logging for all file operations.
- Consider using a Web Application Firewall (WAF) to monitor and block suspicious API calls.
Workarounds (if patching is not immediately possible):
- Disable the trash bin for group folders.
- Manually remove the restore permission from read-only users in the database (not recommended).
Valters IT
Securing Digital Frontiers