CVE-2025-61786: Deno's --deny-read check does not prevent permission bypass
3.3
Basic Information
Technical Details
| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| deno | rust | < 2.5.3 | 2.5.3 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability allows bypassing Deno's read permission checks. The PoC demonstrates that when a script is run with --deny-read, it's still possible to get file metadata using file.stat() and file.statSync() on a file handle that was opened with only write permissions.
The root cause is in the underlying native Rust functions (ops) that implement the JavaScript API. The functions op_fs_file_stat_sync and op_fs_file_stat_async in ext/fs/ops.rs were responsible for getting the file statistics. However, as shown in the patch, the original implementations of these functions did not perform any permission checks. They would directly retrieve the file stats for the given file resource ID.
The fix, seen in commit 1ab2268c0bcbf9b0468e0e36963f77f8c31c73ec, introduces a permission check within both functions. It now retrieves the file path associated with the resource and calls check_open with a Read access kind. If the script does not have read permissions for that path, the operation will fail, thus closing the security hole.
Therefore, the vulnerable functions are the original versions of op_fs_file_stat_sync and op_fs_file_stat_async before the security patch was applied. These are the functions that would appear in a runtime profile when the vulnerable Deno.FsFile.prototype.stat or Deno.FsFile.prototype.statSync methods are called.
Vulnerable functions
op_fs_file_stat_syncext/fs/ops.rs
op_fs_file_stat_asyncext/fs/ops.rs