Murat BekgiPenetration tester
Write-ups

Week 4: A hidden line in a Word file told an AI agent to leak files. Here's how to spot it

PromptArmor showed white 1-point text in a .docx steering Claude Cowork to upload a user's files. A walkthrough on finding invisible text before an agent reads it.

Published
Reading time
3 min
Topic
Weekly
Contents
  1. What people were reading
  2. Walkthrough: finding hidden text in a document before your agent reads it
  3. What this means for anyone running AI agents
  4. Also this week

January 14 to 20. The stories people read most, then a walkthrough you can run to protect your own AI setup.

What people were reading

These got the most upvotes on Hacker News this week. More upvotes means more people read and talked about it.

Not security, but widely shared: ASCII rendering done right, jQuery 4 and a severe solar storm.

Walkthrough: finding hidden text in a document before your agent reads it

Here’s what PromptArmor reported (write-up). An AI agent with access to a folder of private files was given a Word document that looked ordinary. Inside it was text set to 1-point font, white on white, so a person skimming it saw nothing. The agent read the whole thing, including the hidden part, which told it to send a file out of the sandbox. No human was asked to approve it.

I’m not going to show how to build the malicious document. What’s useful, and what you can actually act on, is the other side: spotting hidden text before any tool, human or AI, acts on a file you didn’t write. A Word or PowerPoint file is just a zip of XML, so the hidden formatting is right there to read.

Do this with any document you’re about to feed to an agent or sign off on.

1. Unzip the document. A .docx is a zip archive. Copy it and look inside:

cp suspicious.docx inspect.zip
unzip -o inspect.zip -d inspect/
ls inspect/word/

The text lives in inspect/word/document.xml.

2. See all the text, formatting ignored. This strips the XML tags so you read every word the file contains, visible or not:

python3 -c "import re,sys; print(re.sub(r'<[^>]+>',' ',open('inspect/word/document.xml',encoding='utf-8').read()))" | tr -s ' '

Compare that to what you see when you open the file normally. Extra sentences that weren’t on screen are the warning sign.

3. Hunt the tricks that hide text. Three patterns hide words in Word: a tiny font size, white (or page-colored) text, and text marked “hidden.” Each shows up in the XML:

cd inspect/word
grep -oE '<w:sz w:val="[0-9]+"' document.xml | sort -u   # font sizes, in half-points: "2" = 1pt
grep -o 'w:color="FFFFFF"' document.xml | wc -l           # white text runs
grep -o '<w:vanish/>' document.xml | wc -l                # explicitly hidden text

A font size of 2 (one point), white text on a white page, or any vanish run all deserve a close look. PowerPoint (.pptx) and Excel (.xlsx) unzip the same way; the text is under ppt/slides/ and xl/sharedStrings.xml.

4. Make it a habit, not a chore. Save this as a script and run it on anything from outside before an agent touches it:

#!/usr/bin/env bash
# peek.sh <file.docx>: dump every word a Word file contains
d=$(mktemp -d); cp "$1" "$d/f.zip"; unzip -qo "$d/f.zip" -d "$d"
python3 -c "import re;print(re.sub(r'<[^>]+>',' ',open('$d/word/document.xml',encoding='utf-8').read()))" | tr -s ' '

What this means for anyone running AI agents

The real fix isn’t detection, it’s how you wire the agent up:

  • Don’t give one session both your private files and untrusted documents. Read outside files in a throwaway session first.
  • Require a human yes before the agent sends anything out, every time, with no exceptions for “trusted” domains.
  • Limit what the agent can reach on the network to only what the task needs.

Also this week

Astro and Cloudflare are now one company (Astro). It doesn’t change anything you do today, but it’s worth watching if your stack depends on either.

Android is adding friction to sideloading (Android Authority). Good for stopping scam apps, a headache for people who install APKs on purpose. Know where your org lands before it ships.

Want this every week? Subscribe.