News for hackers. Stuff that matters.
Re:Saving Data: Reducing the Size of App Updates by 65% by vog on Wednesday December 07, 2016 @04:55AM (#13121516)
> Wouldn't it make more sense to work on having the signature work on uncompressed files?

No! That would create an additional security risk, in addition to potential performance issues.

Ideally, unchecked data should only ever hit the signature check and nothing else. Otherwise, it could also attack the decompression, not just through security holes, but also through denial of service (by injecting something that explodes in size on decompression).

This is a general principle! You should neither decompress, nor decrypt, nor unpack/untar, nor parse (XML/JSON/...), nor anything else before the signature check. See also:

"Preauthenticated decryption considered harmful"

http://www.tedunangst.com/flak/post/preauthenticated-decrypt...

However, I agree that it makes sense to have an additional check after decompression. However, that check usually happens in most decompression tools anyway, and usually through fast, lightweight checksums. Because, again, the point here is to detect bugs in the decompressor, not to protect from malicious tampering, which should always happen before complex stuff like decompression.

Re:Saving Data: Reducing the Size of App Updates by 65% by Benjamin_Dobell on Wednesday December 07, 2016 @05:57AM (#13121715)
> Otherwise, it could also attack the decompression, not just through security holes, but also through denial of service (by injecting something that explodes in size on decompression).

> This is a general principle! You should neither decompress, nor decrypt, nor unpack/untar, nor parse (XML/JSON/...), nor anything else before the signature check.

Google have stated that they're going to be decompressing, patching and recompressing data in an attempt to recreate the original data stream - simply to perform a signature check.

So, whilst minimising the attack surface is a great goal in general, your advice is not relevant here. They're already vulnerable to having their decompression, patching and compression software attacked.

Re:Saving Data: Reducing the Size of App Updates by 65% by leni536 on Wednesday December 07, 2016 @09:08AM (#13122579)
Your old apk is already signed. I guess it would make sense to sign the patch too (if they don't do it already).
Re:Saving Data: Reducing the Size of App Updates by 65% by rakoo on Wednesday December 07, 2016 @07:57AM (#13122171)
Yes, but the payload to check here is the diff, not the full APK.

What happens today is that the diff is verified, then applied, then the full APK checksum is verified. So the diff is checked before being applied; whether the checksum is verified at APK level or at file level, we have passed the signature checking.

Re:Saving Data: Reducing the Size of App Updates by 65% by vog on Wednesday December 07, 2016 @08:31AM (#13122346)
But the original question was whether the signature check should happen after applying the patch instead of before, and the answer is clearly "No!". You can and should clearly do both, but if you'd have to decide either-or, always verify first, as early as possible.