Skip to content

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

Merged
val-ms merged 3 commits intoCisco-Talos:mainfrom
val-ms:CLAM-2197-pdf-garbled-metadata
Jan 22, 2024
Merged

Clam 2197 Fix PDF metadata decryption issues + Add support for checking empty owner password#1141
val-ms merged 3 commits intoCisco-Talos:mainfrom
val-ms:CLAM-2197-pdf-garbled-metadata

Conversation

@val-ms
Copy link
Contributor

@val-ms val-ms commented Jan 15, 2024

  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.
@val-ms val-ms requested review from jimmy-sonny and ragusaa January 15, 2024 00:44
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.
@val-ms val-ms merged commit ebe3c50 into Cisco-Talos:main Jan 22, 2024
@val-ms val-ms 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