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

Clam 2197 Fix PDF metadata decryption issues + Add support for checking empty owner password #1141

Merged

Conversation

micahsnyder
Copy link
Contributor

  1. Fix PDF metadata decryption issues.
    The encrypted metadata may be stored in a <>-block containing hex bytes (not raw binary).
    Strip off the <> and decode the hex to binary before attempting to decrypt it.

  2. PDF: Add support for checking empty owner password.
    Specifically for algorithm 6 (/R 6). I have not attempted the same for older algorithms.
    Use the O and OE strings to test if an empty owner password will decrypt the file.

    The primary difference with checking the user password is the U-string is also concatenated when making the hashes to verify the key.

The encrypted metadata may be stored in a <> block containing hex bytes.

Strip off the <> and decode the hex to binary.
Specifically for algorithm 6 (/R 6).

Use the O and OE strings to test if an empty owner password will decrypt the file.
Store temp files with obj id and gen id so analysts know which is which.

Don't dump decoded objects immediately. They'll get dumped later at the
end of pdf_extract_obj().

At the end of PDF object extraction, we don't need to find out the
"dumpid" (aka the object index in our list of pdf objects).
It isn't actually used! So I removed the unused parameter.
@micahsnyder micahsnyder merged commit ebe3c50 into Cisco-Talos:main Jan 22, 2024
23 of 24 checks passed
@micahsnyder micahsnyder deleted the CLAM-2197-pdf-garbled-metadata branch January 22, 2024 16:35
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.

2 participants