CVE-2023-35951
Executive Summary
CVE-2023-35951 is a critical stack-based buffer overflow vulnerability in the readOFF.cpp component of libigl v2.4.0. The flaw resides in the code responsible for parsing geometric vertices from specially crafted OFF (Object File Format) files. An attacker can trigger arbitrary code execution by providing a malicious .off file, leading to a full compromise of the affected system. The vulnerability has a CVSS score of 7.8 (High) and currently has no known public exploit or patch. The EPSS score is 0.0%, indicating low exploitation activity in the wild, but the risk remains significant for systems that process untrusted OFF files.
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
libigl is a widely used C++ geometry processing library, often integrated into research, simulation, and 3D modeling tools. This vulnerability affects the library's core file parsing functionality, making it a supply chain risk for any application that depends on libigl v2.4.0. Users should verify their dependency trees and consider isolating or sandboxing processes that handle OFF files until a patch is available.
CVSS Breakdown & Threat Level
- Attack Vector (AV): Local (L) – Requires the attacker to deliver a malicious file to the victim.
- Attack Complexity (AC): Low (L) – No special conditions needed beyond opening the file.
- Privileges Required (PR): None (N) – No authentication needed.
- User Interaction (UI): Required (R) – Victim must open the malicious file.
- Scope (S): Unchanged (U) – The vulnerability does not cross trust boundaries.
- Confidentiality (C): High (H) – Arbitrary code execution can leak sensitive data.
- Integrity (I): High (H) – Code execution allows modification of data.
- Availability (A): High (H) – Code execution can crash or corrupt the system.
Threat Level: High. While exploitation requires user interaction, the impact is severe, and the lack of a patch increases the risk for unpatched systems.
Deep Dive & Mechanics
The vulnerability is a classic stack-based buffer overflow in the readOFF.cpp file of libigl v2.4.0. The function responsible for parsing the geometric vertices of an OFF file does not properly validate the size of the input data before copying it into a fixed-size stack buffer. An attacker can craft an OFF file with a vertex count or vertex data that exceeds the buffer capacity, causing the stack to overflow. This overwrites adjacent memory, including the return address, allowing the attacker to redirect execution to arbitrary code.
The OFF file format is a simple text-based format used to describe 3D geometry. The parser reads the number of vertices and then iterates through each vertex's coordinates (x, y, z). The vulnerability likely occurs when the parser reads vertex data into a buffer without checking the actual number of vertices against the buffer size.
Vulnerable vs. Patched Code
Since no official patch is available, the following is a conceptual comparison based on the vulnerability description.
Vulnerable Code (libigl v2.4.0 - readOFF.cpp):
// Vulnerable: No bounds checking on vertex count
void readOFF(const std::string& filename, Eigen::MatrixXd& V, Eigen::MatrixXi& F) {
std::ifstream file(filename);
std::string line;
std::getline(file, line); // Read header
int numVertices, numFaces, numEdges;
file >> numVertices >> numFaces >> numEdges;
V.resize(numVertices, 3);
for (int i = 0; i < numVertices; ++i) {
double x, y, z;
file >> x >> y >> z;
V.row(i) << x, y, z; // Potential overflow if V is not resized properly
}
}
Patched Code (Conceptual):
// Patched: Added bounds checking and safe buffer handling
void readOFF(const std::string& filename, Eigen::MatrixXd& V, Eigen::MatrixXi& F) {
std::ifstream file(filename);
std::string line;
std::getline(file, line);
int numVertices, numFaces, numEdges;
file >> numVertices >> numFaces >> numEdges;
if (numVertices < 0 || numVertices > MAX_VERTICES) {
throw std::runtime_error("Invalid vertex count");
}
V.resize(numVertices, 3);
for (int i = 0; i < numVertices; ++i) {
double x, y, z;
if (!(file >> x >> y >> z)) {
throw std::runtime_error("Invalid vertex data");
}
V.row(i) << x, y, z;
}
}
Exploitation & Lab Setup
Red Team (Exploitation)
Lab Setup:
- Target: Ubuntu 22.04 LTS with libigl v2.4.0 installed.
- Attacker: Kali Linux with Python3 and Metasploit.
- Sample application that loads OFF files using libigl.
Exploitation Steps:
- Craft Malicious OFF File: Create an OFF file with a vertex count that triggers a stack overflow. The payload should overwrite the return address with a ROP chain or shellcode address.
# exploit.py - Generate malicious OFF file import struct # Craft a buffer overflow payload payload = b"A" * 256 # Fill buffer payload += struct.pack("<I", 0xdeadbeef) # Overwrite return address # Write to file with open("malicious.off", "w") as f: f.write("OFF\n") f.write("1000 0 0\n") # Large vertex count for i in range(1000): f.write("1.0 2.0 3.0\n") # Normal vertices f.write(payload.decode('latin-1')) # Append overflow data - Deliver File: Send the malicious OFF file to the victim via email or download.
- Trigger Exploit: Victim opens the file with a vulnerable application.
- Gain Access: The overflow executes shellcode, providing a reverse shell.
Note: This is a conceptual example. Actual exploitation requires precise memory layout analysis.
Blue Team (Defense)
Detection:
- Monitor for processes that crash with stack overflow errors when parsing OFF files.
- Use file integrity monitoring to detect unexpected OFF files.
- Implement application sandboxing to limit the impact of code execution.
Prevention:
- Disable automatic processing of OFF files from untrusted sources.
- Use a Web Application Firewall (WAF) to filter malicious file uploads.
- Apply ASLR and DEP to mitigate exploitation.
Indicators of Compromise (IOCs)
- File Hashes (SHA256):
malicious.off:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
- Network Indicators:
- Outbound connections to attacker-controlled IPs (e.g.,
192.168.1.100:4444).
- Outbound connections to attacker-controlled IPs (e.g.,
- Process Indicators:
- Application crash logs with stack overflow errors.
- Unusual memory access patterns in
readOFF.cpp.
- Registry/File System:
- Presence of
.offfiles in unexpected locations. - Modified
libiglbinaries.
- Presence of
Detection Engineering
YARA Rule
rule CVE_2023_35951_OFF_Overflow {
meta:
description = "Detects malicious OFF files exploiting CVE-2023-35951"
author = "Valters IT"
date = "2025-04-08"
hash = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
strings:
$off_header = "OFF"
$large_vertex = /^[0-9]{4,}\s/ // Vertex count >= 1000
$overflow_data = /[A-Za-z0-9+/]{100,}/ // Base64-like overflow
condition:
$off_header at 0 and $large_vertex and #overflow_data > 0
}
Sigma Rule
title: CVE-2023-35951 OFF File Parsing Exploit
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects potential exploitation of stack buffer overflow in libigl readOFF.cpp
author: Valters IT
logsource:
category: process_creation
product: windows
detection:
selection:
Image|endswith: '\app.exe' # Replace with vulnerable application
CommandLine|contains: '.off'
condition: selection
falsepositives:
- Legitimate OFF file processing
level: high
Suricata Rule
alert tcp $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2023-35951 OFF File Download"; flow:to_server,established; content:"OFF"; depth:3; content:"|0a|"; distance:0; within:1; content:"|0a|"; distance:0; within:1; pcre:"/^[0-9]{4,}\s/"; classtype:attempted-admin; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable processing of OFF files from untrusted sources.
- Isolate applications using libigl v2.4.0 in a sandboxed environment.
- Monitor for any suspicious file activity.
Long-term Fix:
- Apply a patch from the libigl maintainers when available.
- Upgrade to a patched version of libigl (if released).
- Implement input validation and bounds checking in custom parsers.
Compensating Controls:
- Use stack canaries and ASLR to mitigate exploitation.
- Deploy endpoint detection and response (EDR) solutions.
- Conduct regular security audits of third-party libraries.
Valters IT Signature:
This report is generated by Valters IT Cyber Threat Intelligence. For questions, contact threatintel@valtersit.com.
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.
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.