Microsofts CBC4k block mode
During the development of my AIP attack tool I came accross Microsofts mode of operation for symmetric encryption algorithms in AIP. They are named ‘ECB’, ‘CBC4k No Padding’, ‘CBC4k With Padding’ and ‘CBC512 no Padding’ (1). Previously I had the problem that I never saw the usage of CBC4k modes in any AD RMS, Azure RMS or AIP protected Word file. During a bachelor thesis of one of my students I took a closer look at ptxt files. Which are normal text documents protected with the help of RMS (2) (3). When I tried to decrypt this files with my tool, I saw that these files where protected with the help of ‘CBC4k With Padding’, so after searching through the internet for a while, I realized Microsoft never documented the implementation of these special CBC modes of operation.
CBC4k
In order to understand how this mode works, I started API Monitor and analyzed the IPCNotepad program. I found an IV in the called BCryptDecrypt() function, which popped out of nowhere. It took me more time then it would have been necessary, but finally I found the solution:
iv = AES_ECB_ENC{key}(‘00000000000000000000000000000000’)
plaintext = AES_CBC_DEC{key,iv}(ciphertext)
or as Python 3 code:
|
|
You will probably recognize this padding scheme because it is the padding known from PKCS #7 and also used in TLS. It was attacked in 2002 by Serge Vaudeney