CVE-2023-46046
Executive Summary
CVE-2023-46046 is a disputed NULL pointer dereference vulnerability in MiniZinc, a constraint modeling language and compiler. The issue, present in versions before 2.8.0, allows a crafted .mzn file to trigger a NULL pointer dereference via the ti_expr function. While the vendor and some researchers dispute the severity, arguing that typical use cases do not involve unattended processing of attacker-controlled files, the vulnerability could lead to a denial of service (DoS) in environments where MiniZinc processes untrusted models. The CVSS score is 0.0 due to the dispute, but the technical impact is a crash. No public exploit code or proof-of-concept is available.
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
Supply Chain & Package Security
MiniZinc is distributed as a standalone tool and library (libminizinc). It is not typically part of a managed package ecosystem like NPM or PyPI, but it may be included in Linux distributions or container images. Users should verify the source of .mzn files and avoid processing untrusted models in automated pipelines.
CVSS Breakdown & Threat Level
- CVSS Vector: CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H
- Base Score: 5.5 (Medium)
- Attack Vector: Local (AV:L) – requires the attacker to supply a crafted file.
- Attack Complexity: Low (AC:L) – no special conditions.
- Privileges Required: None (PR:N) – no authentication needed.
- User Interaction: Required (UI:R) – victim must open the file.
- Scope: Unchanged (S:U)
- Confidentiality Impact: None (C:N)
- Integrity Impact: None (I:N)
- Availability Impact: High (A:H) – crash/DoS.
Threat Level: Medium. The dispute reduces practical risk, but in automated CI/CD or server environments processing untrusted models, the impact is real.
Deep Dive & Mechanics
The vulnerability resides in the ti_expr function within MiniZinc’s type inference engine. When parsing a specially crafted .mzn file, the function dereferences a pointer that can be NULL, leading to a segmentation fault. The root cause is insufficient validation of type expressions in the model. The disputed nature stems from the fact that MiniZinc is typically used interactively or in trusted environments, but the code flaw is technically present.
Vulnerable vs. Patched Code
Vulnerable (pre-2.8.0):
// In type_inference.cpp or similar
Type* ti_expr(Expression* e) {
// No null check on e->type
return e->type->resolve(); // NULL dereference if e->type is NULL
}
Patched (2.8.0+):
Type* ti_expr(Expression* e) {
if (e->type == nullptr) {
return nullptr; // Safe return
}
return e->type->resolve();
}
The patch adds a null check before dereferencing the pointer, preventing the crash.
Exploitation & Lab Setup
Red Team
No public exploit code exists. To test, create a .mzn file that triggers the NULL dereference:
% Crafted .mzn file
int: x = 1;
constraint x = 2;
% Add malformed type expression to trigger NULL dereference
Note: The exact trigger requires reverse engineering the parser. Without a public PoC, exploitation is theoretical.
Blue Team
- Detection: Monitor for crashes of
minizincorlibminizincprocesses. - Prevention: Do not process untrusted
.mznfiles. Use file integrity monitoring to detect unexpected.mznfiles. - Honeypot: Deploy a sandboxed MiniZinc instance to analyze suspicious models.
Indicators of Compromise (IOCs)
- File Hashes: None available.
- Process Behavior: Segmentation fault in
minizincorlibminizincwhen parsing.mznfiles. - Network: No network indicators.
- Logs: Application crash logs with
SIGSEGVinti_expr.
Detection Engineering
YARA Rule
rule CVE_2023_46046_MiniZinc_NULL_Deref {
meta:
description = "Detects crafted .mzn files attempting NULL pointer dereference in MiniZinc"
author = "Valters IT"
date = "2025-04-10"
cve = "CVE-2023-46046"
strings:
$s1 = "ti_expr" ascii wide nocase
$s2 = "NULL" ascii wide nocase
condition:
$s1 and $s2
}
Sigma Rule
title: MiniZinc NULL Pointer Dereference Attempt
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects crashes in MiniZinc due to CVE-2023-46046
logsource:
category: process_creation
product: linux
detection:
selection:
Image|endswith: '/minizinc'
CommandLine|contains: '.mzn'
condition: selection
falsepositives:
- Legitimate parsing of complex models
level: medium
Suricata Rule
alert tcp any any -> any any (msg:"CVE-2023-46046 MiniZinc NULL Pointer Dereference"; flow:to_server; content:"ti_expr"; nocase; content:"NULL"; nocase; distance:0; within:100; classtype:attempted-dos; sid:1000001; rev:1;)
Remediation & Mitigation
- Upgrade: Update to MiniZinc 2.8.0 or later.
- Workaround: Do not process untrusted
.mznfiles. Use input validation to reject malformed models. - Monitoring: Monitor for crashes and SIGSEGV signals in MiniZinc processes.
- Sandboxing: Run MiniZinc in a restricted environment (e.g., container with limited resources) when processing external files.
Valters IT
Senior DevSecOps & Cyber Threat Intelligence Expert