Bug 1221808 (CVE-2024-27933)

Summary: VUL-0: CVE-2024-27933: deno: use of raw file descriptors in `op_node_ipc_pipe()` leads to premature close of arbitrary file descriptors and permission prompt bypass
Product: [openSUSE] openSUSE Distribution Reporter: SMASH SMASH <smash_bz>
Component: SecurityAssignee: Adam Majer <amajer>
Status: RESOLVED FIXED QA Contact: Security Team bot <security-team>
Severity: Normal    
Priority: P5 - None CC: andrea.mattiazzo
Version: Leap 15.6   
Target Milestone: ---   
Hardware: Other   
OS: Other   
URL: https://smash.suse.de/issue/398499/
Whiteboard:
Found By: Security Response Team Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description SMASH SMASH 2024-03-21 11:02:02 UTC
Deno is a JavaScript, TypeScript, and WebAssembly runtime. In version 1.39.0, use of raw file descriptors in `op_node_ipc_pipe()` leads to premature close of arbitrary file descriptors, allowing standard input to be re-opened as a different resource resulting in permission prompt bypass. Node child_process IPC relies on the JS side to pass the raw IPC file descriptor to `op_node_ipc_pipe()`, which returns a `IpcJsonStreamResource` ID associated with the file descriptor. On closing the resource, the raw file descriptor is closed together.

Use of raw file descriptors in `op_node_ipc_pipe()` leads to premature close of arbitrary file descriptors. This allow standard input (fd 0) to be closed and re-opened for a different resource, which allows a silent permission prompt bypass. This is exploitable by an attacker controlling the code executed inside a Deno runtime to obtain arbitrary code execution on the host machine regardless of permissions.

This bug is known to be exploitable. There is a working exploit that achieves arbitrary code execution by bypassing prompts from zero permissions, additionally abusing the fact that Cache API lacks filesystem permission checks. The attack can be conducted silently as stderr can also be closed, suppressing all prompt outputs.

Version 1.39.1 fixes the bug.

References:
http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2024-27933
https://github.com/denoland/deno/blob/v1.39.0/runtime/permissions/prompter.rs#L99
https://github.com/denoland/deno/security/advisories/GHSA-6q4w-9x56-rmwq
https://www.cve.org/CVERecord?id=CVE-2024-27933
https://github.com/denoland/deno/blob/v1.39.0/runtime/permissions/prompter.rs#L214
https://github.com/denoland/deno/blob/v1.39.0/runtime/permissions/prompter.rs#L220
https://github.com/denoland/deno/blob/v1.39.0/runtime/permissions/prompter.rs#L225
https://github.com/denoland/deno/blob/v1.39.0/runtime/permissions/prompter.rs#L241
https://github.com/denoland/deno/blob/v1.39.0/runtime/permissions/prompter.rs#L256
https://github.com/denoland/deno/blob/v1.39.0/runtime/permissions/prompter.rs#L265

Patch:
https://github.com/denoland/deno/commit/55fac9f5ead6d30996400e8597c969b675c5a22b
https://github.com/denoland/deno/commit/5a91a065b882215dde209baf626247e54c21a392
Comment 1 Andrea Mattiazzo 2024-03-21 11:02:26 UTC
Closing since it is already fixed