CVE-2022-36039
Executive Summary
CVE-2022-36039 is an out-of-bounds write vulnerability in Rizin, a UNIX-like reverse engineering framework and command-line toolset, affecting versions 0.4.0 and prior. The flaw is triggered when parsing Dexter (DEX) files — the executable format used by Android applications — and can be exploited via a malicious DEX file opened by a user. Successful exploitation results in arbitrary code execution on the victim's machine with the privileges of the user running Rizin. Given the CVSS base score of 7.8 and the low privilege requirements, this vulnerability poses a significant threat to security analysts, malware researchers, and any users who routinely process untrusted Android binaries. While no public proof-of-concept or in-the-wild exploitation has been confirmed, the unpatched status of affected versions makes this a critical remediation priority.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Technical Analysis
The vulnerability resides in Rizin's DEX file parsing engine. DEX files are the bytecode containers used by Android's Dalvik/ART virtual machines, and they employ a complex binary structure containing header information, string tables, class definitions, method references, and code items. The Rizin binary parser, responsible for dissecting these structures for analysis and disassembly, fails to properly validate size and offset fields when processing malformed DEX files, leading to an out-of-bounds write condition.
Vulnerability Mechanism: The core issue is a lack of bounds checking during memory write operations performed while iterating over DEX file structures. When Rizin 0.4.0 or earlier encounters a crafted DEX file containing manipulated size headers, field counts, or offset values, the parser writes data beyond the bounds of an allocated heap buffer. This out-of-bounds write corrupts adjacent memory, including heap metadata, function pointers, or stack variables, depending on the specific allocation layout.
From the NVD description, the vulnerability class is explicitly "out-of-bounds write when parsing DEX files." The attack vector is local — the user must open a malicious file within Rizin (e.g., via the rizin command-line tool, its graphical frontend(s), or through scripted analysis pipelines). The mechanism does not require network access or authentication, only interaction with the malicious file.
Attack Surface:
- Affected Components: The DEX binary plugin/module within Rizin's core parsing library.
- Attack Vector: Local — the attacker delivers a malicious DEX file to the victim (via email, download, shared drive, or included in a crafted archive).
- Prerequisite: The victim must invoke Rizin (or a tool built on the Rizin library) on the malicious file.
Technical Detail Limitation:
The NVD description does not specify the exact function names, memory allocation sizes, or struct fields involved. The patch is described only as available on the dev branch of the Rizin repository, and no specific commit hash or tag has been provided in the tracked data. Therefore, the exact vulnerable code path cannot be identified beyond the DEX-parsing module.
Exploitation Scenarios
Attack Chain at the Vulnerability-Class Level:
Reconnaissance/Target Identification: The attacker identifies a target — typically a security researcher, malware analyst, or Android app pentester — who routinely analyzes APK/DEX files. The target's usage of Rizin (version ≤ 0.4.0) can be inferred from job postings, public research, or by serving the malicious file through channels the target is likely to access (e.g., a forum thread, a shared malware sample repository, or a phishing email containing a "suspicious APK" for analysis).
Triggering the Flaw: The attacker crafts a DEX file with intentionally corrupted structural metadata. Specifically, the DEX header contains fields such as
data_size,data_off,map_off, and various section counts. By setting these values to inconsistent or oversized values (e.g., declaring a string count of 0xFFFFFFF or a data offset pointing outside the actual file), the attacker forces Rizin's parser to calculate a write destination that falls outside the allocated heap buffer. The user triggers the vulnerability by opening the file with a command such asrizin malicious.dexor by scripting batch analysis over a directory containing the file.Payload/Execution Method: Because the write primitive is out-of-bounds, the attacker's goal is to achieve arbitrary code execution. Typical exploitation of a heap-based out-of-bounds write involves:
- Corrupting adjacent heap objects to overwrite a function pointer.
- Tampering with heap metadata (e.g.,
sizefields of the next chunk) to achieve an arbitrary write primitive on a subsequent free/alloc. - Overwriting the GOT (Global Offset Table) entry or a vtable pointer to redirect execution to shellcode embedded in the DEX file itself (stored in the file's data section).
The attacker would embed shellcode within the DEX file and use the corrupted pointer to redirect control flow to a location desiged by the attacker.
Post-Exploitation Impact: Once code execution is achieved, the attacker gains a foothold on the victim's machine under the user's privileges. This enables:
- Data Exfiltration: Reading sensitive files, extracting credentials from password managers, and stealing proprietary research.
- Lateral Movement: If the analyst's machine is part of a restricted network, the attacker can pivot.
- Persistence: Installing backdoors or scheduled tasks for ongoing access.
- Intelligence-Gathering: Harvesting malware samples and threat intelligence the analyst has access to.
PoC Status: No public proof-of-concept or exploit code has been observed. The attack chain described is inferred from the vulnerability class (out-of-bounds write) and the attack vector (malicious file opened by the user), as per the NVD description. No specific function names, offsets, or exploitation techniques are publicly documented for this CVE.
Impact Assessment
CVSS Analysis (Score: 7.8, High):
- Attack Vector: Local — The attacker must trick the user into opening a file locally; no network exploitation without user interaction.
- Attack Complexity: Low — Crafting a malicious DEX file requires understanding of the DEX format, but exploitation complexity is reduced due to the direct write primitive.
- Privileges Required: None — No authentication or pre-existing access needed.
- User Interaction: Required — The user must open the crafted file in Rizin.
- Confidentiality, Integrity, Availability Impact: High — Successful exploitation yields full code execution, meaning the attacker can read, modify, or destroy any data accessible to the user.
Business Impact:
- Primary Victims: Cybersecurity firms, incident response teams, academic researchers, and mobile app security testers.
- Blast Radius: Compromise of an analyst workstation can cascade — the machine likely holds samples, credentials to internal systems, and access to sensitive client data. If the analyst works for a managed security service provider (MSSP), the blast radius extends to multiple clients.
- Integrity of Analysis: A compromised analysis tool can produce false or weaponized analysis output, leading to incorrect threat intelligence.
Affected Systems: All installations of Rizin version 0.4.0 and earlier. Because Rizin is also used as a library (via rz_core, rz_bin, etc.) in third-party tools like Cutter (GUI frontend), any tool embedding the vulnerable DEX parser is also affected.
Exploitation Status: EPSS score of 0.00365 with a 29.3% percentile indicates low but non-zero probability of exploitation in the wild. As of the latest data, there is no CISA KEV listing, no confirmed exploitation, and no public exploit code. However, the patch being confined to a dev branch means that even users who attempt to update may remain vulnerable if they use released (stable) builds.
Detection Guidance
Detection for this vulnerability is challenging because exploitation is a local, file-based attack. The following rules focus on detecting the delivery and analysis of malicious DEX files targeting Rizin, as well as anomalous behavior post-exploitation.
Sigma Rule
title: Suspicious DEX File Analysis with Rizin
id: 4f7e1c2a-8b6d-4a4e-9d1c-2e5f8a1b3c4d
status: experimental
description: Detects execution of rizin with DEX file arguments, potentially indicating attempts to trigger CVE-2022-36039.
logsource:
category: process_creation
product: linux
detection:
selection:
Image|endswith: '/rizin'
CommandLine|contains:
- '.dex'
- '.apk' # APK files embed DEX
condition: selection
level: medium
falsepositives:
- Legitimate analysis of Android samples by security researchers
- Developers inspecting DEX files during app development
fields:
- CommandLine
- User
- ParentImage
YARA Rule
rule Rizin_CVE_2022_36039_DEX_Anomalies
{
meta:
author = "ValterSec Threat Intel"
description = "Detects DEX files with structural anomalies indicative of out-of-bounds write attempts in Rizin parser"
date = "2025-04-11"
cve = "CVE-2022-36039"
strings:
$dex_magic = "dex\n"
$string_ids_size = { 70 00 00 00 } // plausible large size field in header
$type_ids_size = { 70 00 00 00 } // plausible large type count
condition:
$dex_magic at 0 and (uint32(0x38) > 0xFFFF or uint32(0x58) > 0xFFFF) // oversized section sizes
}
Note: The YARA rule above is simplified and heuristic; real-world malicious DEX files may not contain the exact large-size markers. This serves as a behavioral baseline for triage.
Suricata IDS Rule
Suricata is primarily network-based, but can detect file extraction and local shadowing. This rule detects suspicious DEX file content being sent over the network (e.g., via HTTP download or email attachment), which is the delivery vector.
alert http any any -> any any (msg:"CVE-2022-36039 Potential Malicious DEX Download"; flow:to_client,established; file.data; content:"dex\n"; offset:0; depth:4; classtype:attempted-user; sid:202203601; rev:1;)
Elastic Detection
sequence by process.entity_id with maxspan=5s
[process where event.action == "exec" and process.name == "rizin" and process.args : ("*.dex", "*.apk")]
[file where event.action == "modification" and file.extension : ("dex", "apk") and process.name == "rizin"]
Splunk SPL Query
index=endpoint sourcetype=ProcessRollup2
| where Image ENDSWITH "/rizin" AND CommandLine LIKE "%.dex%" OR Image ENDSWITH "/rizin" AND CommandLine LIKE "%.apk%"
| table _time, User, Image, ParentImage, CommandLine
| sort - _time
Wazuh OSSEC Rule
<group name="rizin,">
<rule id="100501" level="10">
<if_sid>510</if_sid>
<field name="file">.*\.dex$</field>
<description>Rizin (CVE-2022-36039) - DEX file opened with command line tool, potential exploitation.</description>
<group>vulnerability,</group>
</rule>
</group>
Mitigation & Patch Guidance
Patch Confidence: 0/4 — UNPATCHED (no patch evidence from any tracked source)
The challenge with this CVE is the gap between the vendor's advisory that "a patch is available on the dev branch" and the tracked patch sources. No tagged release (e.g., 0.5.0) or official advisory URL has confirmed the inclusion of the fix in a stable version. The following actions are recommended:
1. Immediate Mitigations (Defense-in-Depth):
- Restrict Usage: Immediately restrict usage of Rizin ≤ 0.4.0 to isolated environments (e.g., virtual machines, sandboxes) without network access or access to sensitive data.
- Alternative Tooling: Encourage analysts to use alternative RE frameworks (Ghidra, IDA Pro, radare2 if it doesn't share the same parser) when handling untrusted DEX/APK files.
- File Sanitization: Before analysis, run DEX files through a static sanity checker that validates header structures and section sizes against the file length. Reject files with inconsistencies.
- User Education: Alert analysts to the risk of opening unsolicited APK/DEX files, especially those received via email or downloaded from untrusted sources.
2. Patch/Upgrade Steps:
- Verify Build: Check your Rizin version with
rizin -v. If it is 0.4.0 or lower, it is vulnerable. - Build from
devBranch: If you cannot wait for a stable release, clone the repository and build thedevbranch, which contains the patch:git clone https://github.com/rizinorg/rizin cd rizin git checkout dev meson build && ninja -C build - Monitor for Stable Release: Subscribe to Rizin GitHub releases and the official blog. Upgrade to the first stable release that version numbers above 0.4.0 (e.g., 0.5.0) once it is confirmed to contain the fix.
- Update Dependent Tools: If you use Cutter (the GUI for Rizin), check if its bundled Rizin version is patched; if not, apply the same manual patch.
3. Long-Term Hardening:
- Implement File-Type Filtering: In environments where Rizin is used in automated pipelines (e.g., malware triage), add a pre-processing layer that validates DEX file structure against the Android specification before passing to Rizin.
- Memory Safety Enforcement: Use memory-safety hardening flags (e.g.,
-D_FORTIFY_SOURCE=2) when compiling Rizin from source, and run it under a shadow memory tool during testing to catch future out-of-bounds conditions. - Vulnerability Management: Add Rizin to your organization's software inventory and track upcoming releases for this CVE. Re-assess exposure upon new stable releases.
References
- NVD Entry: https://nvd.nist.gov/vuln/detail/CVE-2022-36039 — The primary NVD record containing the description and CVSS score used in this report.
- Rizin GitHub Repository: https://github.com/rizinorg/rizin — Source of the
devbranch patch; monitor releases for the stable fix. - CVE.org Record (CNA/ADP): https://www.cve.org/CVERecord?id=CVE-2022-36039 — Additional metadata from the CNA (Rizin project) and any future updates.
- Rizin Official Blog: https://rizin.re/blog/ — Announcements of releases and security advisories; check for a formal advisory for this CVE.
- CISA KEV (Not Listed): https://www.cisa.gov/known-exploited-vulnerabilities-catalog — The CVE is not in the KEV list, but this page should be monitored in case of future in-the-wild activity.
Threat Actor Campaigns: No known threat actor campaigns or exploit-in-the-wild evidence is available as of the writing of this report. The EPSS score (0.00365) and the lack of public PoC suggest low current activity, but the low patch availability status raises the risk of future exploitation once the details of the flaw become more broadly known.
What is this? Security researchers use these exact search queries on Shodan.io (a search engine for internet-connected devices) to find vulnerable systems globally. You can copy these dorks to see if your organization's IP space is exposed.