XLSX Security and Privacy: Hidden Data to Check
Review active content, parser risks and hidden metadata before opening or sharing XLSX files.
Hidden Data in the XLSX ZIP Wrapper
An XLSX file is a ZIP archive of XML and media assets. This structure allows data to persist in parts of the archive that never appear in the spreadsheet grid. The Microsoft Open Specifications for Office Open XML define every element that can carry data—including elements that remain fully extractable yet invisible to the user viewing cells. Before opening an XLSX from an untrusted source or sharing one externally, inspect these hidden surfaces.
Active Content Embedded in the Archive
VBA Binaries (xl/vbaProject.bin)
A file with an .xlsx extension that contains a vbaProject.bin inside the ZIP is technically an XLSM (macro-enabled workbook). Many applications open a renamed file without warning. The binary resides at xl/vbaProject.bin and can contain obfuscated code, keyloggers, or downloaders even if no macro executes automatically.
Validation: List the ZIP contents and check for the binary.
unzip -l file.xlsx | grep -i vbaProject
Also check for any .bin file under xl/media/. Presence of either means the file carries executable code.
External References in Formulas and Defined Names
Part 1, Section 15.2 of the specification permits workbooks to link to external workbooks, web queries, or embedded OLE objects. These references can hide in cell formulas, defined names, or chart data sources and trigger network requests on open.
Validation: After extracting the archive, inspect the external links relationship files and search for references.
grep -r "externalReference" xl/
cat xl/externalLinks/_rels/externalLink1.xml.rels
A single external link can point to a malicious server or initiate data exfiltration when the workbook loads.
DDE Commands in Cell Strings
Older XLSX files may embed Dynamic Data Exchange commands inside cell strings or defined names. These instruct Excel to execute arbitrary system commands.
Validation: Search extracted XML for DDE or shell command indicators.
grep -r "\!DDE\|\!SHELL" xl/
If either string appears, treat the file as executable code.
Metadata Leaking Author, Path, and Timestamps
docProps/core.xml and docProps/app.xml
These files persist even after all cell content is deleted. core.xml records the creator, last-modified-by, and revision number. app.xml stores the application version, total editing time in minutes, and the last-saved and last-printed timestamps.
A file shared anonymously can expose the original author's username, the organization's internal naming convention, or the exact edit duration.
Validation: Extract and read both files directly.
unzip -p file.xlsx docProps/core.xml
unzip -p file.xlsx docProps/app.xml
They are plaintext XML and require no special tools.
Thumbnail Screenshot (docProps/thumbnail.wmf)
The Windows Metafile thumbnail captures a screenshot of the workbook as it appeared at the last save. This leaks visual data including chart contents, hidden sheets that were visible at save time, or data previews.
Validation: Check for the file and render it if present.
unzip -l file.xlsx | grep thumbnail
Convert with wmf2svg or open in a vector viewer to see exactly what the author last saw.
XML Parser Attack Surfaces
External Entity Injection in Shared Strings
XLSX stores cell text in xl/sharedStrings.xml. A malicious file can embed an external entity reference that, when resolved by a vulnerable parser, exfiltrates data over HTTP or reads from the local file system. Part 1, Section 4.1 of the specification warns that parsers must ignore DOCTYPE declarations and external entities.
Validation: Scan the shared strings and styles files for entity declarations.
grep -r "<!ENTITY\|<!DOCTYPE" xl/sharedStrings.xml xl/styles.xml
If either declaration appears, the file targets parser behavior.
Billion Laughs Entity Expansion
A small XLSX can define nested entities that expand exponentially, exhausting memory and causing denial of service.
Validation: Check for entity definitions nested beyond three levels in any XML file inside the archive. More than three levels is a practical threshold for suspicion.
Hidden Rows, Zero-Width Columns, and Conditional Logic
Zero-Width Columns and Hidden Rows
Excel permits columns set to width 0 and rows marked hidden="1". Data in these cells is invisible in the grid but remains fully present in the worksheet XML.
Validation: Inspect each sheet for hidden structural elements.
grep -E 'width="0"|hidden="1"' xl/worksheets/sheet*.xml
The cell values for those references remain in the same file and are extractable.
Conditional Formatting with External Formulas
A cell can appear empty while carrying a conditional formatting rule that evaluates a formula referencing external data. These rules live in xl/styles.xml or under <conditionalFormatting> elements in the worksheet XML.
Validation: Search all XML for conditional formatting rules.
grep -r "<cfRule" xl/
If the formula attribute contains a cell reference or external link, the file embeds executable logic, not static data.
Hard Limits and Structural Constraints
The specification defines boundaries that affect security scanning:
- Shared string entries are indexed; the
<sst>element carries acountattribute. A mismatch betweencountand actual<si>child elements indicates tampering. - Column width
0is valid per the schema but columns withhidden="1"andwidth="0"simultaneously are redundant and suspicious. - External link relationships in
xl/_rels/workbook.xml.relsmust reference validTargetURIs. ATargetMode="External"attribute combined with an executable protocol handler (e.g.,ms-excel:) is a red flag.
Sanitization Steps
- Extract and strip: Unzip the archive. Remove
docProps/,xl/vbaProject.bin, andxl/externalLinks/entirely. Rezip without compression. - Remove hidden rows and columns: Edit
xl/worksheets/sheet*.xmlto delete<row hidden="1".../>entries and reset any<col>elements wherewidth="0". - Delete conditional formatting: Remove all
<conditionalFormatting>blocks fromxl/worksheets/sheet*.xmlandxl/styles.xml. - Clear shared strings: If only structure is needed, replace
xl/sharedStrings.xmlwith<sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"/>. - Validate with a strict parser: Run the sanitized file through a parser that rejects external entities, such as Python's
defusedxmlwithlxmlin safe mode.
A sanitized XLSX should contain only [Content_Types].xml, _rels/, xl/workbook.xml, xl/_rels/, xl/worksheets/, xl/styles.xml, and xl/sharedStrings.xml (if needed). Anything beyond this set is either active content or hidden data.
Reference for xlsx security privacy hidden data checklist
Microsoft Open Specifications for Office Open XML: MS-XLSX