naruto-lgtm opened a new pull request, #1465:
URL: https://github.com/apache/poi/pull/1465

   AgileDecryptor.getDataStream hands out the decrypting stream without 
checking the DataIntegrity HMAC that MS-OFFCRYPTO 2.3.4.14 requires: 
verifyPassword already recovers the HMAC key and value, but the post-validation 
left as a TODO in AgileCipherInputStream was never implemented, so a package 
whose ciphertext was altered after encryption decrypts into silently corrupted 
content where Office rejects the file as damaged. The HMAC is now computed over 
the whole EncryptedPackage stream, StreamSize field included, before any data 
is decrypted, and a mismatch raises EncryptedDocumentException; checking up 
front keeps the guarantee independent of how far a consumer reads or skips, at 
the cost of one extra pass over the encrypted stream. Every agile sample in 
test-data (Office SHA-1 and SHA-512 variants and the fuzzed 
protected_agile.docx) still decrypts unchanged, and the new TestAgileDecryptor 
case flips one ciphertext byte and fails before this change.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to