2018-07-29

Cracking pdf user password with partially known pattern

Introduction

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 swapt old ATM card to new one with debit card function in 2016, and I don't remember the old card number of course again.

Main Issue

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!

Pdfcrack

I found that pdfcrack developed in early 2010's could do this job.  However, this 10 years ago software could only executed in single thread, and guess the 12-digit password from 000000000000 to 999999999999!  That is way too far and time consuming to me.

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 download the git package, deleted the .gitignore, and compile the program under cygwin with make and gcc (Noting that this compilation will not work under cmd, but cygwin only).

I backup the program on my onedrive: https://1drv.ms/u/s!AuRau9aDs5yjlRkWKoPKpd4Dxpy_
  • Download and decompress the folder
  • Enter cygwin into the folder
  • Make all in the folder
  • execute the pdfcrack with known parameters
For example, My birthday is 20180729, today, 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
This means that guessing the password with 12 digits.  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 poor i3-2310m, I decrypted the password with 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.


Cracking pdf user password with partially known pattern

Introduction Last week I attempted to open an old CITIbank statements in 2015 October.  I forgot my default password of coursey, and the h...