CVE-2021-42139

9.8 CRITICAL

📋 TL;DR

CVE-2021-42139 is a critical code injection vulnerability in Deno Standard Modules that allows remote code execution when processing untrusted YAML files. Attackers can execute arbitrary code on affected systems by crafting malicious YAML content. This affects any application using vulnerable Deno Standard Modules versions to parse YAML files from untrusted sources.

💻 Affected Systems

Products:
  • Deno Standard Modules
Versions: All versions before 0.107.0
Operating Systems: All platforms running Deno
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects applications using the vulnerable YAML parsing functionality from Deno Standard Modules. Applications not using YAML parsing or using alternative YAML libraries are not affected.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete system compromise with remote code execution, allowing attackers to install malware, exfiltrate data, or pivot to other systems.

🟠

Likely Case

Remote code execution leading to data theft, service disruption, or lateral movement within the network.

🟢

If Mitigated

Limited impact if proper input validation and sandboxing are implemented, potentially reduced to denial of service.

🌐 Internet-Facing: HIGH - Applications accepting YAML input from external sources are directly exploitable over the network.
🏢 Internal Only: MEDIUM - Internal applications processing YAML from untrusted internal sources remain vulnerable but with reduced attack surface.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires the application to parse attacker-controlled YAML content. The vulnerability is well-documented with public proof-of-concept available.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 0.107.0

Vendor Advisory: https://github.com/denoland/deno_std/releases/tag/0.107.0

Restart Required: No

Instructions:

1. Update Deno Standard Modules to version 0.107.0 or later. 2. Update package dependencies: 'deno cache --reload' or equivalent. 3. Rebuild and redeploy affected applications.

🔧 Temporary Workarounds

Disable YAML parsing

all

Remove or disable YAML parsing functionality in affected applications

Remove 'import { parse } from "https://deno.land/std@<0.107.0/encoding/yaml.ts";' from code

Use alternative YAML library

all

Replace vulnerable YAML parser with a secure alternative like js-yaml

npm install js-yaml
import yaml from 'js-yaml';

🧯 If You Can't Patch

  • Implement strict input validation and sanitization for all YAML input
  • Run Deno applications with minimal permissions using --allow-* flags to limit damage

🔍 How to Verify

Check if Vulnerable:

Check if your application imports YAML parsing from Deno Standard Modules versions before 0.107.0

Check Version:

deno --version | grep std

Verify Fix Applied:

Verify that Deno Standard Modules version is 0.107.0 or later and no vulnerable imports remain

📡 Detection & Monitoring

Log Indicators:

  • Unexpected process execution from YAML parsing context
  • Errors in YAML parsing with suspicious content
  • Unusual network connections from Deno processes

Network Indicators:

  • Outbound connections from applications that should only parse YAML
  • Traffic to unexpected destinations following YAML processing

SIEM Query:

process.name: "deno" AND process.cmdline: *yaml* AND (process.cmdline: *eval* OR process.cmdline: *exec*)

🔗 References

📤 Share & Export