CVE-2020-36404

7.8 HIGH

📋 TL;DR

CVE-2020-36404 is a memory corruption vulnerability in Keystone Engine's SmallVectorImpl destructor that can lead to arbitrary code execution or denial of service. This affects applications using Keystone Engine 0.9.2 for assembly/disassembly functionality. Attackers could exploit this by providing malicious input to trigger the invalid free operation.

💻 Affected Systems

Products:
  • Keystone Engine
Versions: Version 0.9.2 specifically
Operating Systems: All platforms where Keystone Engine runs (Linux, Windows, macOS, etc.)
Default Config Vulnerable: ⚠️ Yes
Notes: Any application linking against Keystone Engine 0.9.2 is vulnerable when processing assembly code.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution leading to complete system compromise, data theft, or persistent backdoor installation.

🟠

Likely Case

Application crash (denial of service) when processing specially crafted assembly code.

🟢

If Mitigated

Limited impact if application runs with minimal privileges and proper sandboxing/isolation.

🌐 Internet-Facing: MEDIUM - Exploitation requires the application to process untrusted assembly code, which may occur in web-based disassembly tools or API endpoints.
🏢 Internal Only: LOW - Most internal uses involve trusted code analysis rather than processing untrusted input.

🎯 Exploit Status

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

The OSS-Fuzz issue includes a proof-of-concept triggering the vulnerability. Exploitation requires understanding of heap manipulation techniques.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Versions after 0.9.2 (0.9.3 and later)

Vendor Advisory: https://github.com/keystone-engine/keystone/releases

Restart Required: Yes

Instructions:

1. Check current Keystone Engine version. 2. Update to version 0.9.3 or later via package manager or source compilation. 3. Rebuild any applications using Keystone Engine. 4. Restart affected services.

🔧 Temporary Workarounds

Input Validation

all

Implement strict input validation for assembly code processed by Keystone Engine

Memory Sanitizers

linux

Compile with address sanitizer (ASAN) to detect memory corruption attempts

gcc -fsanitize=address -o program program.c

🧯 If You Can't Patch

  • Isolate Keystone Engine processes in containers or sandboxes with minimal privileges
  • Implement network segmentation to limit exposure of vulnerable applications

🔍 How to Verify

Check if Vulnerable:

Check if Keystone Engine version is 0.9.2 using package manager or by checking library version

Check Version:

keystone --version 2>/dev/null || dpkg -l | grep keystone || rpm -qa | grep keystone

Verify Fix Applied:

Verify Keystone Engine version is 0.9.3 or later and test with known problematic inputs

📡 Detection & Monitoring

Log Indicators:

  • Application crashes with segmentation faults
  • Memory corruption errors in system logs
  • Unexpected process termination

Network Indicators:

  • Unusual network traffic to/from applications using Keystone Engine

SIEM Query:

process_name:"keystone" AND (event_type:crash OR error_message:"segmentation fault")

🔗 References

📤 Share & Export