Cracking pdf user password with partially known pattern

selwyndd21
Sep 9, 2018 · 2 min read

Last week I attempted to open an old CITIbank statements in 2015 October. I forgot my default password of coursey, and the hint didn’t help.

The hint provides the information:

The default password composed of your C.E. birthday (yyyymmdd) and the last 4 digits of your ATM card number.

Bad things to me that the Taiwan branch of CITIbank swapted old ATM card to new one with debit card function in 2016, and I don’t remember the old card number of course again.


So, question is — how can I open this encrypted pdf with a 12-digit user password, including a known 8-digit birthday date and unknown 4-digit card number?

Brute force password cracker!


I found that Pdfcrack developed in 2009 could do this job. However, this old software could only executed on single thread, and try every possible answer from 000000000000 to 999999999999! That is way too far and time consuming.

A better adapted version of Pdfcrack I also found is pdfcrack-mp-baseopenmp (github page). It added a pattern based brute force cracking with openMP support, which is more useful in my purpose.

I downloaded the git package, deleted the .gitignore, and compiled the program under cygwin with make and gcc (Noting that this compilation will not work under cmd, but cygwin only).

  • Download and decompress the folder
  • Enter cygwin into the folder
  • Make all in the folder
  • execute the pdfcrack with known parameters

Assuming my birthday is 20180729, and I would like to crack the last 4 digits of pdf password with 4 threads of cpu, my command would be:

./pdfcrack.exe -t 4 -e [2][0][1][8][0][7][2][9][1234567890][1234567890][1234567890][1234567890] -f filename.pdf

Brackets enclose possible guesses for specific digit - first 8 digits are known, and possibility is 1. Last 4 digits are unknown, with 10 possibility for each digit (0 to 9).

With my old i3–2310m, I decrypted the password in 5 second. I did have tried the last version of pdfcrack developed in 2009, but it didn’t guess the correct password in 1 day.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade