Info leak in GMP Process involving ClearKeyUtils::DecryptAES
Categories
(Core :: Audio/Video: GMP, defect, P2)
Tracking
()
People
(Reporter: oskarlindberg348, Assigned: aosmond)
References
Details
(Keywords: csectype-disclosure, reporter-external, sec-moderate, Whiteboard: [client-bounty-form])
Attachments
(1 obsolete file)
By providing an arbitrary size of the key and selective encrypted data, we can cause a OOBR to be used to decrypt the buffer,
which is then provided back to the content process.
I'll go ahead and copy the writeup here for your convenience:
Info leak via buffer decryption
I'll describe a infoleak via aes decryption, the basic idea is that the key size is not checked correctly,
and passed to internal cryptographic libraries via weak pointer, it is assumed to be of length 0x10.
hence encrypting a buffer with uninitialized data which is retrived to the attacker.
Key is supplied via updating an existing session.
RecvUpdateSession -> UpdateSession-> ... -> ClearKeySessionManager::UpdateSession
a session needs to be first created with the fitting keyId using ClearKeySessionManager::CreateSession
Then key-pairs of keyid and keys (base64) are parsed via a json parser (attacker specified).
And the new key is being set via mDecryptionManager->InitKey
The key length after the json parsing is not being validated.
In the case of ClearKeyUtils::DecryptCbcs mode, we validate the key length and bail out:
...
if (aKey.size() != CENC_KEY_LEN || aIV.size() != CENC_KEY_LEN) {
CK_LOGE("Key and IV size should be 16!");
return false;
}
...
However for the case of ClearKeyUtils::DecryptAES, only the IV is being padded to 0x10.
AES decryption does seem to pad the IV to CENC_KEY_LEN
inside of ClearKeyUtils::DecryptAES there is a assert which validates the key length.
(however assert is only valid in debug builds).
and a key item is being created with the assumption of a valid length:
...
SECItem keyItem = {siBuffer, (unsigned char*)aKey.data(), CENC_KEY_LEN};
...
The key is then imported using the keyItem into the crypto library and used for decryption.
The decrypted buffer is decrypted with an uninitalized data (after the first provided n bytes).
Shortcoming
I know it might sound a bit funny trying to leak the uninitailized of the key part from a "ciphertext".
but remembering there is no limit on the key length,
we can specify any number of bytes between 1 <= n <= 15 which only the remaining bytes of 0x10-n will remain uninitialized,
hence, if we spray interesting data/objects, and then starting from n=15 onto n=1, we can leak the entire data,
with each time, trying to break a single byte of aes (256 attempts at most, much less on average if we have a model of the data we are trying to break - pointer for example).
Viability
This is available on all platforms using the ChromiumCdmChild actor, on windows its also possible via Video Encoding/Decoding.
I'm also fairly convinced this is possible to use via javascript only.
As we can (and i tried for many hours) intercept the license server provided data, and send our own short key (shaka for example has filters we can install to intercept requests/responses).
Fix suggestion
assert the length of the key for aes as well.
Reproducing
I did some steps to go on and get into the decrypt phased with a partial key, however i did not go all the way as to bring back the data to the javascript and attempt decryption.
Threat level
As this is an info leak under some constraints into a partially sandboxed process, the threat isn't high, however this can be used with combination of other vulns to further exploit a SBE, so i do belive this is a security concern.
Updated•1 year ago
|
Updated•1 year ago
|
Comment 2•1 year ago
|
||
Comment on attachment 9507431 [details]
Writeup.md
I'll mark the attachment obsolete to avoid confusion: it's now also comment 1 and much more readable there than in raw markdown.
Comment 3•1 year ago
|
||
Does anyone host a non-test clearkey server? The attacker could, but then wouldn't the key they recover be the one they put in their own server?
Updated•1 year ago
|
Comment 4•1 year ago
|
||
I misunderstood what clearkey was (based on the name, I thought it was more like the "null cipher" in old SSL versions). It looks like there are some servers that use it.
Andreas: can you take a look?
Comment 5•1 year ago
|
||
I don't know clearkey any more than the one-time crash fix I did before. Deferring to Jim on who knows this best.
Updated•1 year ago
|
Updated•1 year ago
|
| Assignee | ||
Updated•1 year ago
|
Updated•1 year ago
|
Updated•9 months ago
|
| Assignee | ||
Comment 6•7 months ago
|
||
Looks like this ended up getting fixed in bug 2014824.
(In reply to Andrew Osmond [:aosmond] (he/him) from comment #6)
Looks like this ended up getting fixed in bug 2014824.
*** This bug has been marked as a duplicate of bug 2014824 ***
can i get access to 2014824 please?
Updated•7 months ago
|
Comment 8•7 months ago
|
||
Updated•7 months ago
|
Updated•7 months ago
|
Comment 9•7 months ago
|
||
Although we closed as a dupe, it was still reported first and well outside our collision window so it is still eligible for the bug bounty.
Updated•1 month ago
|
Description
•