Saturday, February 22, 2014

This is gold!

This is gold! The bug that was fixed with the recent iOS release. Apparently OSX is still vulnerable, but the fog of war is strong on this one.

static OSStatus
SSLVerifySignedServerKeyExchange(SSLContext *ctx, bool isRsa, SSLBuffer signedParams,
                                 uint8_t *signature, UInt16 signatureLen)
{
OSStatus        err;
...

if ((err = SSLHashSHA1.update(&hashCtx, &serverRandom)) != 0)
goto fail;
if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0)
goto fail;
goto fail;
if ((err = SSLHashSHA1.final(&hashCtx, &hashOut)) != 0)
goto fail;
...

fail:
SSLFreeBuffer(&signedHashes);
SSLFreeBuffer(&hashCtx);
return err;
}

Source Adam Langley's https://www.imperialviolet.org/2014/02/22/applebug.html

The real problem was this other piece of code I found in their code base
if (0) { goto fail; buyCovertyLicense(); }
#gotofail  
https://www.imperialviolet.org/2014/02/22/applebug.html