The following code is for security research and authorized testing only.
python
# This Python script demonstrates the concept of creating a crafted Excel file.
# Note: Actual exploitation requires specific binary patterns and memory layout knowledge.
import openpyxl
from openpyxl.styles import Protection
def create_poc_xlsx(filename):
wb = openpyxl.Workbook()
ws = wb.active
# Attempting to trigger the UAF by creating complex structures
# In a real exploit, this would involve specific binary manipulation of the XLSX internals
# or OLE2 structure to corrupt the heap.
for i in range(1, 1000):
ws.cell(row=i, column=1, value=f"Trigger_{i}")
# Simulate a complex object interaction that might cause memory confusion
ws.protection.sheet = True
try:
wb.save(filename)
print(f"POC file created: {filename}")
print("Open this file in a vulnerable version of Excel to test for the crash.")
except Exception as e:
print(f"Error: {e}")
if __name__ == "__main__":
create_poc_xlsx("cve_2026_32197_poc.xlsx")