CVE-2021-40965

8.8 HIGH

📋 TL;DR

This CSRF vulnerability in TinyFileManager allows attackers to trick authenticated administrators into executing malicious requests, leading to arbitrary file uploads and remote code execution. All versions up to 2.4.6 are affected when an administrator visits a malicious URL while logged in.

💻 Affected Systems

Products:
  • TinyFileManager
Versions: All versions up to and including 2.4.6
Operating Systems: Any OS running TinyFileManager
Default Config Vulnerable: ⚠️ Yes
Notes: Requires administrator to be authenticated and visit attacker-controlled URL.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full system compromise through remote code execution, allowing attackers to install malware, steal data, or pivot to other systems.

🟠

Likely Case

Unauthorized file upload leading to webshell deployment and subsequent command execution on the server.

🟢

If Mitigated

Attack fails due to CSRF protections or administrator not being logged in during malicious URL visit.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

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

Exploit requires social engineering to get administrator to click malicious link while authenticated.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 2.4.7 and later

Vendor Advisory: https://github.com/prasathmani/tinyfilemanager

Restart Required: No

Instructions:

1. Backup current installation. 2. Download latest version from GitHub. 3. Replace files with patched version. 4. Verify functionality.

🔧 Temporary Workarounds

Implement CSRF Tokens

all

Add CSRF protection to file upload and command execution endpoints

Manual code modification required - implement anti-CSRF tokens in forms

Restrict Administrator Access

all

Limit administrator access to trusted networks only

Configure firewall rules to restrict TinyFileManager admin interface

🧯 If You Can't Patch

  • Implement web application firewall with CSRF protection rules
  • Require re-authentication for sensitive actions like file uploads

🔍 How to Verify

Check if Vulnerable:

Check TinyFileManager version in config.php or about page

Check Version:

grep -i 'version' config.php || check web interface about page

Verify Fix Applied:

Verify version is 2.4.7 or higher and test CSRF protection on upload forms

📡 Detection & Monitoring

Log Indicators:

  • Unexpected file uploads via POST requests
  • Command execution attempts in web server logs

Network Indicators:

  • CSRF attack patterns with malicious referrer headers
  • Unexpected file uploads to TinyFileManager

SIEM Query:

source="web_logs" AND (uri="/tinyfilemanager/upload.php" OR uri CONTAINS "tinyfilemanager") AND method="POST" AND NOT user_agent="browser"

🔗 References

📤 Share & Export