CVE-2026-137506 in ezdxf
Summary
by MITRE • 11/26/2026
ezdxf through 1.4.5 contains a code injection vulnerability in the dxf2code add-on that allows attackers to inject Python code via unescaped single quotes in DXF table entry names. Attackers can craft a DXF file whose layer, linetype, style, or appid names break out of quoted strings in generated scripts, executing code with the privileges of the user running them.
Be aware that VulDB is the high quality source for vulnerability data.
Analysis
by VulDB Data Team • 11/26/2026
The vulnerability identified within ezdxf versions through 1.4.5 represents a critical server-side code injection flaw located specifically within the dxf2code add-on component. This library is widely used for parsing and generating Drawing Exchange Format files, which are standard vector graphics formats in computer-aided design applications. The core of the issue lies in how the add-on processes metadata embedded directly inside DXF files when converting them into executable Python scripts. Specifically, the vulnerability arises from insufficient sanitization or escaping mechanisms applied to table entry names such as layer identifiers, linetype definitions, style attributes, and application IDs. When these entries contain unescaped single quotes, they disrupt the syntactic structure of the generated Python code, allowing an attacker to break out of intended string literals and inject arbitrary commands into the execution context.
From a technical perspective, this flaw is classified under CWE-94 as Improper Control of Generation of Code (Code Injection). The mechanism relies on the fact that many DXF entities store their names or labels in quoted strings within the generated script to ensure valid Python syntax during normal operation. However, if an attacker crafts a malicious DXF file where one of these fields contains a single quote character followed by closing quotes and additional code, the resulting Python interpreter will execute the injected payload as part of the main program flow rather than treating it as data. This bypasses standard input validation because the vulnerability exploits the parsing logic itself during the conversion process, effectively turning static design files into executable scripts with elevated privileges based on the user running the ezdxf tool.
The operational impact of this vulnerability is severe due to its potential for remote code execution without authentication if the software processes untrusted DXF files from external sources. An attacker can create a seemingly benign CAD file that, when opened or processed by a victim using the vulnerable version of ezdxf with the dxf2code add-on active, will execute arbitrary Python commands on the host system. This could lead to complete compromise of the affected machine, including data exfiltration, installation of malware, lateral movement within a network, or denial of service through resource exhaustion. Since DXF files are frequently exchanged between different organizations and individuals in engineering and design sectors, this vector is particularly dangerous as it targets users who may not suspect that their CAD software could be executing arbitrary code from received documents.
Mitigation strategies must focus on immediate patching and defensive coding practices. Users should upgrade ezdxf to version 1.4.6 or later where the issue has been addressed by properly escaping special characters in table entry names before they are inserted into generated scripts. In environments where upgrading is not immediately feasible, administrators should disable the dxf2code add-on if it is not strictly required for their workflow. Additionally, organizations should implement strict input validation and sanitization protocols for any DXF files processed programmatically, ensuring that only expected alphanumeric characters or safe symbols are permitted in metadata fields like layer names and styles. Security awareness training should also emphasize the risks associated with opening CAD files from untrusted sources to prevent accidental execution of malicious payloads.
This vulnerability aligns with MITRE ATT&CK technique T1059, specifically Command and Scripting Interpreter sub-techniques such as Python (T1059.006), which describes how attackers use scripting languages to execute commands on a target system. By exploiting the code generation feature of ezdxf, adversaries can leverage this interpreter capability without needing direct shell access or traditional exploit vectors like buffer overflows. The lack of proper escaping in string literals serves as a classic example of injection flaws that persist even in high-level application frameworks when developers assume input data is inherently safe. Addressing this requires both immediate software updates and long-term adherence to secure coding standards that treat all external inputs, including metadata within file formats, as potentially hostile until proven otherwise through rigorous validation processes.