BLOG

The text you blacked out is probably still in the PDF

GuyUpdated 16 Sept 20265 min read

You get a contract. You black out a phone number, save it, and email it on.

Anyone who receives that file can very likely still read the number. Not by guessing it. By reading it, in the file you sent them.

This is one of the most common accidents in document handling, and it has caught out law firms, government departments, and newspapers. It keeps happening because every check you can do by looking confirms the redaction worked. The document looks correct because the part you look at is correct.

The first way it goes wrong

You draw a black rectangle over the text.

A PDF isn't a picture of a page. It's a set of instructions for drawing one, and it keeps the text as text so it can be searched and copied. When you draw a rectangle, you add one more instruction to that list. The rectangle goes on top. The words stay underneath, unchanged.

Anyone can select the area, copy it, and paste it somewhere. The black box doesn't come along. The words do.

Most document tools have got better at this. If your tool has a feature actually called redaction, it probably removes the text rather than covering it. The tools that only let you draw shapes, including many free online editors and most image editors, do not.

The second way, which catches careful people

This one happens even when the tool removed the text properly.

PDFs can be saved in two ways. The tool can write out a whole new file, or it can leave the existing file alone and add the changes to the end, along with a note saying which parts have been replaced. The second way is called an incremental save, and it's what most tools do by default because it's fast.

Think of a bound notebook where you can't tear pages out. You want to correct page four, so you write a new page four and bind it in at the back with a note saying "use this one instead". Anyone reading front to back sees your correction. The original page four is still bound in the book.

That's what your redacted PDF is. The tool genuinely removed the phone number. The version of the page that still contains it is sitting earlier in the same file, and the file tells any reader where to find it.

How hard is it to get back

Not hard at all. No specialist software, no password cracking. Someone who knows the format can recover the earlier version of your document in a few seconds.

We built a file to demonstrate it. It shows Call me on [REDACTED] in every PDF reader we tried. It also still contains the phone number, and the original version of the page is recovered with two lines of code. The file is linked at the end of this article if you want to try it yourself.

The point isn't that it's a clever attack. It's that it needs no cleverness.

How to redact a document so it stays redacted

Use a real redaction feature. Look for a tool with a function named redaction or "remove hidden information". Drawing a black shape is not redaction, whatever it looks like on screen.

Save a copy rather than saving. After redacting, choose "Save As" or "Save a copy" instead of "Save". Many tools write a complete new file for that, which leaves the earlier version behind rather than carrying it along. It isn't guaranteed, but it's the single easiest habit to adopt.

For anything genuinely sensitive, flatten it to images. Export the document as images, or print it to a new PDF as images, then send that. It destroys everything underneath, because there's nothing underneath any more. The cost is real: the text is no longer searchable or selectable, the file is usually larger, and screen readers can't read it. For a contract going to a counterparty or a document going public, that's usually a price worth paying.

Remember the parts you can't see. A PDF also carries a title, an author name, and sometimes small preview images of each page, generated before your edit. Tools that offer "remove hidden information" or "sanitize" clear those out. The visible page is not the whole document.

If you want to check a file you've already sent

Open the PDF in a plain text editor, such as Notepad or TextEdit, and search for the text you removed. Most of the file will look like nonsense, which is expected.

If you find your text, it's definitely still in there. If you don't find it, that's reassuring but not conclusive, because PDFs often store text in a compressed form that a plain search won't match.

For anything where being sure matters, redact it again using the steps above and send a fresh copy.

Why this is worth ten minutes of your attention

People redact documents at exactly the moments that matter. Contracts before they go to the other side. Records before they go to a journalist. Scanned letters before they go on a website where anyone can download the file.

The document looks right. It looks right to you, to the person who reviewed it, and to the person you sent it to. The only place it's wrong is inside the file, which is the one place nobody looks.

For technical readers

The demonstration file has one incremental update, so it contains two complete revisions. The first ends at the first %%EOF marker:

pdftotext demo-redacted-but-recoverable.pdf -
# Call me on [REDACTED]

grep -a -o "07700 900123" demo-redacted-but-recoverable.pdf
# 07700 900123
data = open("demo-redacted-but-recoverable.pdf", "rb").read()
open("recovered.pdf", "wb").write(data[: data.find(b"%%EOF") + 6])
pdftotext recovered.pdf -
# Call me on 07700 900123

Counting %%EOF markers tells you how many revisions a file carries. More than one is not evidence of a problem on its own, since signatures and ordinary edits both produce them, but it tells you where to look.

If you're building redaction into a product, the rule is to remove the content and then force a full rewrite rather than an incremental save whenever a redaction has been applied. Incremental saves are the right default the rest of the time. They're fast, and a digital signature depends on them, since rewriting the file would break a signature already applied.

Download the demonstration files: demo-redacted-but-recoverable.pdf and demo-before-redaction.pdf. Both were built by hand from the PDF specification, and every command above was run against them.

Written while building PDF tools into upfling.host, where people upload files and get live links to share them.

Written by Guy
Guy
Founder
Got the files ready? Put them online now.
Free, no account needed