HIGH 7.8

CVE-2026-8357: LibreOffice Calc Heap Buffer Overflow in Formula Compilation

LibreOffice Calc has a critical flaw in how it processes spreadsheet formulas when opening files. The vulnerability occurs because the application allocates a buffer one element too small to handle extremely long, deeply nested formulas composed of many opening tokens. When such a formula is compiled, it writes past the buffer's boundary, corrupting adjacent memory. This heap buffer overflow can allow attackers to execute arbitrary code simply by convincing a user to open a malicious spreadsheet file.

Source data · NVD / CISA · public domain

CVSS
3.1 · 7.8 HIGH · CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Weaknesses (CWE)
CWE-131, CWE-193, CWE-787
Affected products
0 configuration(s)
Published / Modified
2026-06-15 / 2026-07-23

NVD description (verbatim)

LibreOffice Calc compiles cell formulas when opening a spreadsheet. A heap buffer overflow existed when compiling a very long formula made up of many opening tokens. The array that tracks nesting depth was allocated one element too small for that worst case, so such a formula wrote one element past its end. In fixed versions the array is sized to hold the largest possible nesting.

11 reference(s) · View on NVD →

SEC.co analysis · AI-assisted, reviewed against source

Technical summary

CVE-2026-8357 is a heap buffer overflow in LibreOffice Calc's formula compilation logic. The vulnerability stems from an off-by-one allocation error in the array that tracks operator nesting depth during formula parsing. When a formula contains a number of opening tokens that reaches the theoretical maximum nesting level, the write operation exceeds the allocated buffer by one element. The flaw is classified under CWE-131 (Incorrect Buffer Size Calculation), CWE-193 (Off-by-one Error), and CWE-787 (Out-of-bounds Write). The fix involves resizing the nesting depth tracking array to accommodate the worst-case nesting scenario.

Business impact

This vulnerability poses a significant risk to organizations that use LibreOffice Calc for financial modeling, data analysis, or any spreadsheet-based workflows. Attackers can craft malicious .ods, .xlsx, or other spreadsheet files that trigger the overflow upon opening, potentially achieving code execution with the privileges of the user running LibreOffice. For businesses relying on shared spreadsheet repositories or email-based document exchange, the attack surface is considerable. Depending on user privileges and system configuration, successful exploitation could lead to data theft, lateral movement within networks, or system compromise.

Affected systems

LibreOffice Calc versions prior to the patched release are affected. The vulnerability is triggered during file opening when the formula compilation engine processes unusually long, deeply nested formulas. All platforms running vulnerable LibreOffice Calc builds—including Windows, macOS, and Linux—are susceptible. The vulnerability requires user interaction (opening a file), meaning headless or server-side deployments of Calc are not at risk unless automated processes open untrusted spreadsheets.

Exploitability

The attack requires moderate complexity: an attacker must craft a spreadsheet with a specifically structured formula that triggers maximum nesting depth. However, the barrier to entry is low because the malicious file simply needs to be opened by a victim—no special application features or user configuration is required. The CVSS score of 7.8 (HIGH) reflects this balance: no elevated privileges needed, local attack vector, and complete impact across confidentiality, integrity, and availability if code execution is achieved. The vulnerability is not currently listed on the CISA Known Exploited Vulnerabilities catalog, but the straightforward nature of the trigger makes it a plausible target for future weaponization.

Remediation

Apply the patched version of LibreOffice Calc released after 2026-06-15. Verify the patch version against the official LibreOffice project security advisory. Until patching is possible, implement application whitelisting to restrict Calc execution, use email gateway controls to block suspicious spreadsheet attachments, and educate users to avoid opening spreadsheets from untrusted sources. Consider disabling automatic formula calculation in Calc if your workflows permit.

Patch guidance

Consult the official LibreOffice security advisory for the specific patched version number applicable to your deployment (ESC or stable branch). Patch versions are typically released concurrently across all supported major versions (e.g., 7.x, 8.x, and latest). Test patches in a non-production environment before broad rollout, particularly if your organization uses custom spreadsheet macros or extensions that might be affected by changes to formula compilation.

Detection guidance

Monitor for unexpected Calc process crashes or memory corruption symptoms when users open spreadsheets from external sources. Endpoint Detection and Response (EDR) tools should alert on unusual heap activity or code execution stemming from Calc's process. Network-based detection is limited since the trigger occurs during local file parsing; focus on preventing suspicious spreadsheet files from reaching users via email filtering and content inspection. Log any Calc crashes with attached spreadsheet file names and hashes for forensic correlation.

Why prioritize this

This vulnerability merits immediate attention despite its lack of KEV status. The high CVSS score (7.8), combined with the low bar for triggering the flaw (any file opened by a user), creates substantial organizational risk. Spreadsheets are ubiquitous in enterprise environments, and users routinely open files from email and shared repositories. The straightforward nature of the exploit—embedding a specially crafted formula—makes this an attractive vector for targeted or mass-distribution attacks. Prioritize patching of systems where users receive external spreadsheets or where Calc is used for sensitive financial or engineering calculations.

Risk score, explained

The CVSS 3.1 score of 7.8 reflects a HIGH severity rating driven by: (1) Local attack vector with user interaction (file opening), (2) Low complexity once a malicious file is crafted, (3) No privilege escalation required, (4) Complete impact on confidentiality, integrity, and availability through heap corruption and potential code execution. The score does not assume network propagation; however, via email or file-sharing platforms, the attack surface is effectively broad. The absence of a CISA KEV listing does not diminish the intrinsic risk—it simply indicates no active exploitation has been formally documented at the time of this analysis.

Frequently asked questions

Can this vulnerability be exploited if I disable macros in LibreOffice Calc?

Macro disabling does not prevent exploitation. The vulnerability exists in the formula compilation engine itself, which executes automatically when a file is opened, before any macro execution occurs. Disabling macros mitigates macro-based attacks but is not a mitigation for this flaw.

Does this affect formulas I create myself, or only those in files from others?

The vulnerability is triggered by the mere act of opening a file containing the malicious formula structure. Whether you created the file or received it is irrelevant—if the formula is present and the file is opened in a vulnerable Calc version, the overflow can occur. File origin does not affect exploitability.

What is the difference between CWE-131, CWE-193, and CWE-787 in this context?

CWE-131 identifies the root cause: the buffer was allocated one element too small. CWE-193 describes the specific error type (off-by-one). CWE-787 is the consequence: out-of-bounds write to heap memory. Together, they describe the full lifecycle of the flaw—from allocation error to memory corruption.

If I store spreadsheets only on encrypted, air-gapped systems, am I fully protected?

Encryption and air-gapping prevent network-borne attacks but do not stop exploitation if a user opens an infected file via USB or other offline media. Patching remains necessary; air-gapping reduces attack surface but is not a substitute for fixing the underlying vulnerability.

This analysis is based on CVE-2026-8357 published data as of 2026-07-23. Patch version numbers, affected product editions, and specific remediation steps must be verified against the official LibreOffice project security advisory and vendor guidance. No exploit code or weaponized proof-of-concept is provided. Organizations should validate all patches and detection rules in their own environments before production deployment. SEC.co makes no warranty regarding the accuracy or completeness of this intelligence beyond the scope of publicly available vulnerability metadata. Source: NVD (public-domain), retrieved 2026-07-24. Analysis generated by SEC.co (claude-haiku-4-5).