CVE-2022-36041
Executive Summary
CVE-2022-36041 is an out-of-bounds (OOB) write vulnerability in Rizin, a UNIX-like reverse engineering framework and command-line toolset, specifically within the Mach-O binary parsing plugin. Versions 0.4.0 and prior are affected; a user opening a maliciously crafted Mach-O file can trigger the flaw, potentially allowing an attacker to achieve arbitrary code execution on the victim's machine. The vulnerability carries a CVSS score of 7.8 (High) and primarily impacts security analysts, malware researchers, and anyone using Rizin to inspect untrusted binary files, with exploitation occurring locally upon opening a malicious file.
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 the Mach-O binary parsing plugin of Rizin. Mach-O (Mach Object) is the native executable format used by macOS and iOS operating systems. The parsing plugin is responsible for reading and interpreting the structure of Mach-O files, including their load commands, section headers, and symbol tables.
The flaw is characterized as an out-of-bounds write condition. When Rizin parses a specially crafted Mach-O file, the parsing logic computes a memory write destination based on values embedded in the file's header or metadata structures. Because the parser fails to validate that the computed write location falls within the bounds of the allocated buffer, the write operation can exceed the buffer's boundary, corrupting adjacent memory.
The CNA title specifies: "Rizin Out-of-bounds Write vulnerability in Mach-O binary plugin." The NVD description states: "Versions 0.4.0 and prior are vulnerable to an out-of-bounds write when parsing Mach-O files."
The attack surface is local and file-based: a victim must open a malicious Mach-O file using Rizin's analysis tools (e.g., rizin executable or r2). The parsing occurs automatically when the file is loaded for analysis, meaning no additional user interaction beyond opening the file is required. The root cause is a missing bounds check in the parser's write logic — a classic CWE-787 (Out-of-bounds Write) flaw.
The NVD description does not specify the exact function, loop condition, or data structure where the OOB write occurs. The upstream patch is referenced as commit 7323e64d68ecccfb0ed3ee480f704384c38676b2, which likely adds boundary validation to the vulnerable write path. However, patch confidence from tracked sources is 0/4, indicating that no major distribution or advisory has formally confirmed the patch as of this report — treat the fix as unverified.
Exploitation Scenarios
Attack Chain — Inferred from Vulnerability Class:
Step 1 — Reconnaissance/Target Identification: The attacker targets individuals or organizations that use Rizin for binary analysis — primarily reverse engineers, malware analysts, security researchers, and CTF participants. The attacker crafts a malicious Mach-O file designed to trigger the OOB write. Delivery vectors include email attachments, malicious GitHub repositories, or hosting the file on forums/blogs frequented by the target audience.
Step 2 — Triggering the Flaw: The victim opens the malicious Mach-O file in Rizin (version 0.4.0 or earlier). The Rizin command-line interface or its programmatic API (e.g., via the rz-bin tool) invokes the Mach-O parser. The parser reads the crafted header/metadata, computes a write offset derived from attacker-controlled values in the file, and performs a write operation without validating the destination address is within the allocated buffer. The write occurs during the initial file load/analysis phase.
Step 3 — Payload/Execution Method: The OOB write is leveraged to corrupt adjacent heap memory structures. A typical exploitation approach for this vulnerability class: (a) heap grooming to place a function pointer or heap metadata adjacent to the overflow location, (b) overwriting the pointer with an attacker-controlled address, (c) redirecting execution flow when the corrupted pointer is subsequently dereferenced during Rizin's normal analysis workflow, and (d) executing attacker-supplied shellcode or ROP chain. No public PoC exists; this chain is inferred from the CWE-787 class and typical exploitation techniques.
Step 4 — Post-Exploitation Impact: Upon successful code execution, the attacker gains code execution with the privileges of the user running Rizin — typically the local user account. In a research/analyst environment, this could mean access to source code, credentials stored on the system, or lateral movement if the victim has elevated network access. In a sandboxed or CI/CD analysis environment, the attacker could escalate to the sandbox host if isolation is weak.
Note: No public PoC or exploit code is available. The attack chain above is inferred from the out-of-bounds write vulnerability class and standard exploitation techniques for local file parsers.
Impact Assessment
The CVSS score of 7.8 (High) reflects the severity: the attack vector is Local (AV:L), attack complexity is Low (AC:L), no privileges are required (PR:N), but user interaction is required (UI:R) — the victim must open the malicious file. Confidentiality, Integrity, and Availability impacts are all rated High (C:H/I:H/A:H), indicating full system compromise is possible.
Business Impact:
- Compromise of analysis workstations — A reverse engineer's machine contains highly sensitive data: proprietary code, threat intelligence, zero-day research, client binaries, and credentials. Successful exploitation hands all of this to an attacker.
- Supply-chain risk — Rizin is used in automated malware analysis pipelines and CI/CD workflows. A compromise in such an environment can lead to persistent backdoors in analysis infrastructure.
- Trust erosion — Organizations relying on Rizin for security research may face reputational damage if a compromise traces back to this vulnerability.
- Affected audience — Security analysts, malware reverse engineers, academic researchers, and any DevOps pipelines that invoke Rizin tools for binary triage.
Blast Radius: Local, single-machine compromise per triggered file. However, in shared analysis environments with mounted network shares or shared VM snapshots, the malicious file could be opened by multiple analysts, amplifying impact.
Detection Guidance
Sigma Rule
title: Rizin Mach-O Out-of-Bounds Write Exploitation Attempt
id: 3f2c9b6e-8d4a-4e10-b7e1-5a8f2c1d9e4a
status: experimental
description: Detects suspicious crash patterns or abnormal memory access in Rizin processes that may indicate exploitation of CVE-2022-36041.
references:
- https://nvd.nist.gov/vuln/detail/CVE-2022-36041
tags:
- attack.t1203
- cve.2022-36041
logsource:
category: process_creation
product: windows
definition: Requires Sysmon or equivalent process creation logging across endpoints.
detection:
selection_rizin:
Image|endswith:
- 'rizin.exe'
- 'r2.exe'
- 'rz-bin.exe'
selection_crash:
- CommandLine|contains: 'segfault'
- CommandLine|contains: 'segmentation fault'
- CommandLine|contains: 'abort'
condition: selection_rizin and selection_crash
falsepositives:
- Legitimate Rizin crashes due to malformed files (non-malicious)
level: medium
YARA Rule
rule CVE_2022_36041_Rizin_MachO_OOB {
meta:
author = "ValtersIt Threat Intel"
description = "Detects Mach-O files crafted to trigger OOB write in Rizin <= 0.4.0"
cve = "CVE-2022-36041"
date = "2025-04-11"
strings:
// Mach-O magic bytes for 64-bit and 32-bit files
$macho_64 = { CF FA ED FE }
$macho_32 = { CE FA ED FE }
// Patterns of suspicious load command sizes or entry points
$susp_lc = { ?? ?? ?? ?? 00 00 00 01 } // LC_SEGMENT with crafted size flags
$susp_cmd = { 00 00 00 00 00 00 00 00 } // NUL-filled cmd/segment fields
condition:
uint32(0) == $macho_64 or uint32(0) == $macho_32
and any of ($susp_*)
and filesize < 10MB
}
Suricata IDS Rule
alert http any any -> any any (
msg:"CVE-2022-36041 - Rizin Mach-O Parser OOB Write - Potential Malicious File Transfer";
flow:to_client;
file.data;
content:"|CF FA ED FE|"; filestore; // Mach-O 64-bit magic
content:"|CE FA ED FE|"; filestore; // Mach-O 32-bit magic
metadata: cve CVE-2022-36041;
metadata: attack_target Client_Endpoint;
metadata: tag C2, Malware_Artifact;
classtype:attempted-user;
sid: 202536041;
rev: 1;
)
Note: Network detection is challenging as Rizin operates locally on files. This rule aims to detect transfer of Mach-O binaries over HTTP, which is a common initial delivery vector.
Elastic Detection
// Detect Rizin process crashes or abnormal terminations
sequence by host.name, process.pid with maxspan=10s
[ process where process.name : ("rizin", "r2", "rz-bin") and event.type == "start" ]
[ process where process.name : ("rizin", "r2", "rz-bin") and event.type == "end" and
process.exit_code == 139 ] // SIGSEGV (segmentation fault)
// Detect file creation events for Mach-O binaries with unusual structure on analyst machines
file where event.action == "creation" and
file.extension in ("bin", "dylib", "macho") and
file.size > 10240 and
process.name : ("browser", "outlook", "wget", "curl")
Splunk SPL Query
index=endpoint sourcetype=process
("rizin" OR "rz-bin" OR "r2")
| stats count by _time, host, user, process.executable, process.command_line
| where count > 0
| table _time, host, user, process.executable, process.command_line
| appendcols [ search index=endpoint sourcetype=process "rizin"
| eval crash_signal = if(process.exit_code == 139 or process.exit_code == 134, "YES", "NO")
| table _time, host, process.executable, process.command_line, crash_signal ]
| search crash_signal = "YES"
index=endpoint sourcetype=filesystem
(file_path="*.macho" OR file_path="*.dylib")
| stats count by _time, host, user, file_path, file_size
| where file_size > 10240
Wazuh OSSEC Rule
<group name="rizin,">
<rule id="100361" level="10">
<if_sid>571</if_sid>
<match>Segmentation fault|Segfault|ABORT|core dumped</match>
<description>CVE-2022-36041 - Possible Rizin Mach-O parser OOB write exploitation (crash signal)</description>
<group>rizin,vulnerability,attempted-exploitation,</group>
<mitre>
<id>T1203</id>
</mitre>
</rule>
<rule id="100362" level="8">
<if_sid>100361</if_sid>
<program_name>^rizin$|^rz-|^r2$</program_name>
<description>CVE-2022-36041 - Rizin process crash detected (rizin/r2/rz-bin)</description>
<group>rizin,vulnerability,attempted-exploitation,</group>
<mitre>
<id>T1203</id>
</mitre>
</rule>
</group>
Mitigation & Patch Guidance
Patch Confidence: 0/4 — UNPATCHED. No patch evidence from any tracked source. The NVD description references commit 7323e64d68ecccfb0ed3ee480f704384c38676b2 as containing a fix, but this has not been verified across distribution channels; the vendor has not released an official advisory confirming the patch.
Immediate Mitigations (Days 0-7):
- Restrict file intake — Disable Rizin's automatic analysis of Mach-O files from untrusted sources. Use a sandboxed VM or isolated environment (e.g., a dedicated malware triage VM with no network access) when analyzing any binary files.
- Manual file inspection — Before feeding a Mach-O file to Rizin, validate it with other tools (e.g.,
file,otool,codesign) or run Rizin with stderr redirected to capture any abnormal termination. - Upgrade or rebuild — If the patch is confirmed via upstream, rebuild from source with commit
7323e64d68ecccfb0ed3ee480f704384c38676b2applied. Until then, do not install new versions that include this commit without verification. - Least privilege — Run Rizin under a non-privileged service account with restricted filesystem and network access to limit post-exploitation impact.
Patch/Upgrade Steps (When Available):
- Monitor the official Rizin GitHub repository and release channels for a patched release (likely 0.4.1+ or a commit containing the referenced hash).
- Verify the commit integrity and build from source if a binary release is not immediately available.
- Test the patched build in a staging environment before deploying to analyst workstations.
Long-Term Hardening:
- Automated patch management — Integrate Rizin into your organization's vulnerability management program; ensure patch verification includes testing the Mach-O parser against a corpus of known-good and malicious binaries.
- Impose file restrictions — Use file-type allowlisting on analyst endpoints to prevent downloads of executable/binary formats from non-whitelisted domains.
- Memory corruption defenses — Ensure ASLR, DEP/NX, and FORTIFY_SOURCE are enabled on analyst workstations. Consider running Rizin under a hardened sandbox (e.g., gVisor, Firejail, or AppArmor) as a defense-in-depth measure.
References
- NVD Entry: https://nvd.nist.gov/vuln/detail/CVE-2022-36041 — Official record with description and CVSS score.
- Rizin GitHub Repository: https://github.com/rizinorg/rizin — Source code; commit
7323e64d68ecccfb0ed3ee480f704384c38676b2referenced as patch. - Rizin Blog/Advisory: https://blog.rizin.org — Monitor for official vendor advisory (none published as of this report).
- CISA KEV: https://www.cisa.gov/known-exploited-vulnerabilities-catalog — CVE-2022-36041 is NOT listed (confirmed, no known exploitation in the wild as of this report).
- MITRE ATT&CK: https://attack.mitre.org/techniques/T1203/ — Technique mapping for client-side code execution via file parsing.
Threat-Actor Campaigns: No known threat-actor campaigns or exploit-in-the-wild activity has been identified or publicly reported for CVE-2022-36041 as of this report. EPSS score (0.00364, 29.2% percentile) indicates low probability of exploitation in the wild within the next 30 days, but this may change if a public PoC emerges.
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.