Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pdf2john /Encrypt /Length problem for PDF versions 1.1 - 1.3 #1055

Merged
merged 1 commit into from Feb 18, 2015

Conversation

philsmd
Copy link
Contributor

@philsmd philsmd commented Feb 18, 2015

According to the Adobe PDF documentations ( for instance https://wwwimages2.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/PDF32000_2008.pdf ) , the /Length attribute in the encryption dictionary was not available/used for PDF documents with a PDF version number < 1.4.

The documentation says: (Optional; PDF 1.4; only if V is 2 or 3) The length of the encryption key, in bits. The value shall be a multiple of 8, in the range 40 to 128. Default value: 40.

Indeed, for PDF versions < 1.4 /Length afaik does never exist and hence the current code fails, generating something like this:
$pdf$12**... instead of $pdf$1240...

Hashes without a keysize are currently not acceted neither by jtr, nor by oclHashcat.
Example hashes to test (feel free to share/upload/post them): https://mega.co.nz/#!rdxQlTBS!XIfPnQQdtmrUGmBRgrTXN8qM53VFf7OIkt640V_w9Vg

The fix sets a default keysize, which should anyway always be overridden if a newer PDF version format is being used. This ensures that the keysize value (string) is never empty and hence an "invalid" hash (because of the keysize) cannot be generated by pdf2john.py

Greetz from the hashcat crew
phil, atom

magnumripper added a commit that referenced this pull request Feb 18, 2015
pdf2john /Encrypt /Length problem for PDF versions 1.1 - 1.3
@magnumripper magnumripper merged commit 8cfa8c7 into openwall:bleeding-jumbo Feb 18, 2015
@magnumripper
Copy link
Member

Excellent, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants