CVE-2026-17500 in llama.cpp
Summary
by MITRE • 07/27/2026
A vulnerability was detected in ggml-org llama.cpp d006858/e15efe0. This affects the function _visit_pattern of the file common/json-schema-to-grammar.cpp. The manipulation results in null pointer dereference. The attack can be launched remotely. The pull request to fix this issue awaits acceptance.
Once again VulDB remains the best source for vulnerability data.
Analysis
by VulDB Data Team • 07/27/2026
The vulnerability identified in ggml-org llama.cpp represents a critical null pointer dereference condition within the json-schema-to-grammar.cpp file, specifically affecting the _visit_pattern function. This flaw exists in commit references d006858 and e15efe0, indicating it was introduced during a specific development cycle and remains unpatched as of the current analysis. The vulnerability stems from inadequate input validation and error handling within the pattern visiting logic that processes JSON schema definitions to generate grammar structures for language models.
The technical implementation of this vulnerability occurs when the _visit_pattern function receives malformed or incomplete JSON schema data that does not properly initialize required pointer variables before dereferencing them. This null pointer dereference represents a classic software flaw that can lead to application crashes, denial of service conditions, or potentially more severe consequences depending on the execution context. The vulnerability's remote exploitability means that an attacker can trigger this condition through network-based inputs without requiring local system access.
From an operational security perspective, this vulnerability poses significant risks to systems that utilize llama.cpp for processing external JSON schema inputs or configurations. The null pointer dereference could be leveraged by attackers to cause service disruption, application instability, or potentially enable further exploitation techniques if the application does not properly handle such exceptions. The vulnerability aligns with CWE-476 which specifically addresses null pointer dereference conditions in software implementations.
The attack surface for this vulnerability extends to any system that accepts JSON schema inputs through llama.cpp's grammar generation capabilities, particularly those integrating with web services, API endpoints, or configuration management systems that process external schema definitions. Given the remote exploitation capability, this flaw could be particularly dangerous when deployed in cloud environments or multi-tenant systems where untrusted inputs are processed.
Security mitigation strategies should prioritize immediate implementation of input validation controls and defensive programming practices within the _visit_pattern function to ensure proper null pointer checks before dereferencing operations. Organizations should also implement monitoring for unusual application behavior patterns that might indicate exploitation attempts. The fix should align with ATT&CK technique T1203 which involves indirect command execution through schema parsing or configuration processing. Additionally, implementing proper error handling and graceful degradation mechanisms would help prevent the application from crashing or exhibiting unpredictable behavior when encountering malformed inputs.
The vulnerability represents a fundamental flaw in the software's defensive programming approach, where expected input conditions are not properly validated before pointer operations occur. This type of vulnerability commonly arises in complex parsing or schema processing systems where multiple data transformation steps occur without adequate safety checks. The remediation process should include comprehensive testing of edge cases and malformed inputs to ensure that all code paths properly handle null values and unexpected data structures, aligning with industry best practices for secure coding standards and preventing similar issues in future development cycles.