censor/Censor
1
37
Fork
You've already forked Censor
3

Bug: Data behind censored blocks (sometimes) stored as plain text #123

Closed
opened 2026年03月09日 17:09:45 +01:00 by sstendahl · 2 comments

Hey,

I'm not using Censor for any mission-critical purposes, but I was just playing around with this and I noticed that sometimes the underlying text can be found directly in the PDF binary data as plain text, even when this is not the case in the original PDF.

I can't replicate this consistently, but just toying around with it by blocking data and then running strings myfile.pdf | grep my_string regularly gives me the data I'm looking for. It's probably a bit of effort to go throug the raw strings output, but definitely worth it for forensic purposes or when digging through redacted data. So I thought it can be worth it to file an issue.

I'm not really that familiar with how this censoring actually works (I always recommend to just do it by hand, as PDF's are notoriously hard to edit). Maybe it's inevitable, but I thought I'd file an issue anyway..

Right now when trying to replicate it, I could only find some email adresses when digging with a simple strings command. But earlier, I could also get some more meaty info like my full name and some numbers. I don't want to put too much storage on the servers, so I didn't attach a video. But I did attach some PDF's where I found plain content in the strings, even though some of said strings are blacked. The original PDF (kvitto_simning.pdf) does not contain any content when performing strings.

Hey, I'm not using Censor for any mission-critical purposes, but I was just playing around with this and I noticed that sometimes the underlying text can be found directly in the PDF binary data as plain text, even when this is not the case in the original PDF. I can't replicate this consistently, but just toying around with it by blocking data and then running `strings myfile.pdf | grep my_string` regularly gives me the data I'm looking for. It's probably a bit of effort to go throug the raw strings output, but definitely worth it for forensic purposes or when digging through redacted data. So I thought it can be worth it to file an issue. I'm not really that familiar with how this censoring actually works (I always recommend to just do it by hand, as PDF's are notoriously hard to edit). Maybe it's inevitable, but I thought I'd file an issue anyway.. Right now when trying to replicate it, I could only find some email adresses when digging with a simple `strings` command. But earlier, I could also get some more meaty info like my full name and some numbers. I don't want to put too much storage on the servers, so I didn't attach a video. But I did attach some PDF's where I found plain content in the `strings`, even though some of said strings are blacked. The original PDF (`kvitto_simning.pdf`) does not contain any content when performing `strings`.
mahlzahn added this to the v0.5.0 milestone 2026年03月10日 11:55:40 +01:00

Thanks a lot for reporting and also for the attached PDF files to investigate this issue!

I believe that !113 fixes this issue, to be released with 0.5.0. There was a misconfiguration during saving which was keeping garbage inside the PDF file.

Technical details

I could successfully remove the remaining text entries from the kvitto_simning2.pdf by running following commands in a python console:

import pymupdf
document = pymupdf.Document("kvitto_simning2.pdf")
document.save("kvitto_simning2-garbage1.pdf", garbage=1)

Before: xxd kvitto_simning2.pdf | grep -e Betalning -e Link:

0000fb30: 3336 2054 6d5b 284c 696e 6b29 3233 2e30 36 Tm[(Link)23.0
0000fba0: 2054 6d5b 2842 6574 616c 6e69 6e67 3a29 Tm[(Betalning:)
00010c70: 2e30 3237 3737 3820 5464 5b28 4c69 6e6b .027778 Td[(Link
00010dc0: 3428 4c69 6e6b 2932 343c 4636 3730 3639 4(Link)24<F67069
00034f70: 3738 2054 645b 284c 696e 6b29 3234 3c46 78 Td[(Link)24<F

After: xxd kvitto_simning2-garbage1.pdf | grep -e Betalning -e Link:

00030db0: 5464 5b28 4c69 6e6b 2932 343c 4636 3730 Td[(Link)24<F670
00030ef0: 3238 312e 3030 3030 3728 4c69 6e6b 2932 281.00007(Link)2

The remaining findings are from the two times Linköping in the footer of the page.

Thanks a lot for reporting and also for the attached PDF files to investigate this issue! I believe that !113 fixes this issue, to be released with [0.5.0](https://codeberg.org/censor/Censor/milestone/35532). There was a misconfiguration during saving which was keeping garbage inside the PDF file. <details><summary>Technical details</summary> I could successfully remove the remaining text entries from the [kvitto_simning2.pdf](https://codeberg.org/attachments/220e9787-3a09-4229-a568-9fa9f62b0051) by running following commands in a python console: ```python import pymupdf document = pymupdf.Document("kvitto_simning2.pdf") document.save("kvitto_simning2-garbage1.pdf", garbage=1) ``` Before: `xxd kvitto_simning2.pdf | grep -e Betalning -e Link`: ``` 0000fb30: 3336 2054 6d5b 284c 696e 6b29 3233 2e30 36 Tm[(Link)23.0 0000fba0: 2054 6d5b 2842 6574 616c 6e69 6e67 3a29 Tm[(Betalning:) 00010c70: 2e30 3237 3737 3820 5464 5b28 4c69 6e6b .027778 Td[(Link 00010dc0: 3428 4c69 6e6b 2932 343c 4636 3730 3639 4(Link)24<F67069 00034f70: 3738 2054 645b 284c 696e 6b29 3234 3c46 78 Td[(Link)24<F ``` After: `xxd kvitto_simning2-garbage1.pdf | grep -e Betalning -e Link`: ``` 00030db0: 5464 5b28 4c69 6e6b 2932 343c 4636 3730 Td[(Link)24<F670 00030ef0: 3238 312e 3030 3030 3728 4c69 6e6b 2932 281.00007(Link)2 ``` The remaining findings are from the two times Linköping in the footer of the page. </details>

Thanks! I just looked a bit more into my redacted files, and none of the data was actually saved in the PDF objects. Or at least, I couldn't find Betalning: when trying to extract strings with mutool. It only appeared when grepping through strings (or xxd for that matter). So I indeed don't think it was left in the PDF objects themselves. Combined with the fact that this is pretty non-deterministic, an issue with garbage collection sounds pretty plausible to me. Thanks for the quick reaction.

A bit off-topic but this is a really nice app in general by the way. If anything, I'm missing a visual button for undo/redo, and for new document. Simply because these are not directly discoverable. But I saw Censor was in GNOME Circle review, so I think the people there are pretty good at knowing what is needed UI-wise. Good luck with that process, it can take a while (see our process here) but it's a worthful journey (see e.g. Graphs install numbers when joining Circle) and I think Censor belongs there. It's a powerful tool, and I'm not really aware of any other applications that do this easily without hassle!

Thanks! I just looked a bit more into my redacted files, and none of the data was actually saved in the PDF objects. Or at least, I couldn't find `Betalning:` when trying to extract strings with `mutool`. It only appeared when grepping through `strings` (or `xxd` for that matter). So I indeed don't think it was left in the PDF objects themselves. Combined with the fact that this is pretty non-deterministic, an issue with garbage collection sounds pretty plausible to me. Thanks for the quick reaction. A bit off-topic but this is a really nice app in general by the way. If anything, I'm missing a visual button for undo/redo, and for new document. Simply because these are not directly discoverable. But I saw Censor was in GNOME Circle review, so I think the people there are pretty good at knowing what is needed UI-wise. Good luck with that process, it can take a while (see [our process](https://gitlab.gnome.org/Teams/Circle/-/issues/185) here) but it's a worthful journey (see e.g. Graphs [install numbers](/attachments/35248e5f-0c6f-40c1-a5ad-5d7d28ddbd55) when joining Circle) and I think Censor belongs there. It's a powerful tool, and I'm not really aware of any other applications that do this easily without hassle!
166 KiB
Sign in to join this conversation.
No Branch/Tag specified
main
v0.7.3
v0.7.2
v0.7.1
v0.7.0
v0.6.0
v0.5.0
v0.4.0
v0.3.0
v0.2.0
v0.1.0
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
censor/Censor#123
Reference in a new issue
censor/Censor
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?