CVE-2021-41641
📋 TL;DR
This vulnerability in Deno's file sandbox allows attackers to bypass directory restrictions via symbolic links. When Deno is run with write permissions, the Deno.symlink method can be exploited to access any directory on the system. This affects all Deno applications running vulnerable versions with write access enabled.
💻 Affected Systems
- Deno
📦 What is this software?
Deno by Deno
⚠️ Risk & Real-World Impact
Worst Case
Complete system compromise allowing attackers to read, modify, or delete any file on the host system, potentially leading to data theft, ransomware deployment, or persistent backdoor installation.
Likely Case
Unauthorized file access and modification within the host filesystem, potentially exposing sensitive configuration files, credentials, or application data.
If Mitigated
Limited impact if proper permission restrictions are in place and applications run with minimal necessary privileges.
🎯 Exploit Status
Exploitation requires the ability to execute Deno code with write permissions. The vulnerability is well-documented with proof-of-concept examples available in public reports.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: Deno 1.14.1 and later
Vendor Advisory: https://github.com/denoland/deno/issues/12152
Restart Required: Yes
Instructions:
1. Update Deno using: deno upgrade --version 1.14.1 or later
2. Restart all Deno applications
3. Verify the update with: deno --version
🔧 Temporary Workarounds
Remove write permissions
allRun Deno applications without --allow-write or other write permissions
Run without: --allow-write flag
Use read-only permissions
allOnly grant read permissions when write access is not required
Use --allow-read instead of --allow-write
🧯 If You Can't Patch
- Run Deno applications with minimal permissions, avoiding --allow-write unless absolutely necessary
- Implement strict input validation and sandboxing for any code that uses Deno.symlink
🔍 How to Verify
Check if Vulnerable:
Check if running Deno version <= 1.14.0 and if applications use --allow-write permissions
Check Version:
deno --version
Verify Fix Applied:
Verify Deno version is 1.14.1 or higher and test symbolic link behavior in sandboxed environment
📡 Detection & Monitoring
Log Indicators:
- Multiple Deno.symlink() calls with suspicious paths
- File access patterns outside expected sandbox directories
Network Indicators:
- Unusual outbound connections following file access attempts
SIEM Query:
process.name:"deno" AND process.args:"--allow-write" AND process.args:"symlink"