I wanted to take a look at Brad's malicious spreadsheet, using Excel inside a VM.
But I can not make changes or unhide sheets, as the workbook and the sheets are protected:
And the protection password is not "VelvetSweatshop".
Thus I started to remove this protection.
First of all, the malicious spreadsheet is also encrypted: it has an encryption password and protections passwords. But since the encryption password is VelvetSweatshop, the user doesn't have to provide the password to decrypt the document upon opening.
However, I need to decrypt this document first, so that I can remove the protections. I do this with my tool msoffcrypto-crack.py:
When an Office document is encrypted with a password, the content of the document is cryptographically encrypted, and you need the password to decrypt the document. That's what I just did.
When an Office document is protected with a password, the content of the document is not encrypted. The content remains readable (cleartext). However, flags are set so that Excel will prevent you from altering the document. I explain how you can remove this protection by clearing the flags and passwords in my blog post "Quickpost: oledump.py plugin_biff.py: Remove Sheet Protection From Spreadsheets".
For this malicious spreadsheet, I'm going to take a slightly different route: I'm going to "change" the protection passwords (unknown to me) to passwords known to me.
To achieve this, I need to change some bytes in records that make up the Excel spreadsheet. I'm using my tool oledump.py with plugin plugin_biff to locate these records:
BIFF records PASSWORD contain 2 bytes of data: this is a custom hash of the actual password. When these 2 bytes are 00 00, there is no password.
Here the hashes are 41 CB and 4D 91. I'm going to replace these bytes with AB 94. AB 94 is the hash for password P@ssw0rd. So by replacing these bytes, I "replace" an unknown password by a known password.
I use option -R of plugin_biff to get a complete hexdump of the BIFF records (record-type + record-length + record-data), that I then use with a hexadecimal editor to search for these records in the sample file, and replace the hashes' bytes:
Searching for 1300020041cb:
Replacing 41cb with ab94:
Searching for 130002004d91:
Replacing 4d91 with ab94:
Now I have a malicious spreadsheet, that is still protected (workbook and sheets), but now I know the protection passwords (P@ssw0rd).
Final step: I open this modified malicious spreadsheet with Excel inside a VM, unprotect it with password P@ssw0rd, and inspect the malicious Excel 4 macros:
The Excel 4 macro sheet is hidden, but now I can unhide it because the malicious spreadsheet is no longer protected:
Some closing remarks:
Feb 22nd 2021
|Thread locked Subscribe||
Feb 22nd 2021
1 year ago