Race condition when flushing input stream leads to permission prompt bypass
Deno is a JavaScript, TypeScript, and WebAssembly runtime with secure defaults. By using ANSI escape sequences and a race between `libc::tcflush(0, libc::TCIFLUSH)` and reading standard input, it's possible to manipulate the permission prompt and force it to allow an unsafe action regardless of the user input. Some ANSI escape sequences act as a info request to the master terminal emulator and the terminal emulator sends back the reply in the PTY channel. standard streams also use this channel to send and get data. For example the `\033[6n` sequence requests the current cursor position. These sequences allow us to append data to the standard input of Deno. This vulnerability allows an attacker to bypass Deno permission policy. This vulnerability is fixed in 1.42.2.
Problem Types
| Type | CWE ID | Description |
|---|
| CWE | CWE-78 | CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') |
| CWE | CWE-362 | CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition') |
Type: CWE
Description: CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Type: CWE
Description: CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')
Metrics
| Version | Base score | Base severity | Vector |
|---|
| 3.1 | 7.7 | HIGH | CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N |
Version: 3.1
Base score: 7.7
Base severity: HIGH
Vector: CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N