Missing status check in CryptoKey::SetSymKey creates potential security bug
- Fixed in 22 days
- Paid in 24 days
- Disclosed after 22 days
CryptoKey::SetSymKey (dom\crypto\CryptoKey.cpp) assigns its argument to a member variable, but the destination isa CryptoBuffer, which isa FallibleTArray, so the assignment can fail if FF is nearly OOM due to some other operation. If it fails, the Javascript program that invoked SetSymKey (such as via crypto.subtle,deriveKey) receives a zero-length key. If it doesn't check the length before using the key for an encryption or signing operation, the resulting ciphertext or signature will be trivially weak.
Details:
--------
(cryptokey.cpp)
297: void CryptoKey::SetSymKey(const CryptoBuffer& aSymKey)
298: {
299: mSymKey = aSymKey;
300: }
(cryptokey.h)
61: class CryptoKey final : public nsISupports,
62: public nsWrapperCache,
63: public nsNSSShutDownObject
64: {
...
196: CryptoBuffer mSymKey;
...
199:};
(cryptobuffer.h)
21: class CryptoBuffer : public FallibleTArray<uint8_t>
...
There is also a similar bug in CryptoKey::ReadStructuredClone line 1128.
There is also a similar bug in ImportKeyTask::SetKeyData (dom\crypto\WebCryptoTask.cpp line 1289, though that one appears to be latent, at least as to the code path that arises from window.crypto.subtle,deriveKey (ImportSymmetricKeyTask::BeforeCrypto gets called after the assignment. It checks whether mKeyData.Length() == 0, and errors out if so). There may, however, be other non-latent paths into SetKeyData.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is known
A medium-severity security bug in DOM: Security. Mozilla made it public on 3 October 2015 as CVE-2015-7200.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.