Latent wild-pointer/bounds bug in nsZipArchive
- Fixed in 6 days
- Paid in 12 days
- Disclosed after 6 days
Class nsZipArchive (modules\libjar\nsZipArchive.cpp) does not initialize its mCommentPtr and mCommentLen fields unless the archive contains a valid comment. Further, nsZipArchive::GetComment uses mCommentPtr and mCommentLen without checking whether the archive contains a valid comment. Thus, it can return a comment string containing data from memory that it has no right to access, potentially leaking sensitive data from one context into another:
850: bool nsZipArchive::GetComment(nsACString &aComment)
851: {
852: MOZ_WIN_MEM_TRY_BEGIN
853: aComment.Assign(mCommentPtr, mCommentLen);
854: MOZ_WIN_MEM_TRY_CATCH(return false)
855: return true;
856: }
At present, this bug appears to be latent, or nearly so, because GetComment's only caller is StartupCache::LoadArchive (startupcache\StartupCache.cpp), and (as far as I know) the startup cache stream is trusted, so it should contain a valid comment. Presumably there might not be a valid comment if the cache file became corrupted, or if a cache file having a different format were restored from a backup, in which case LoadArchive might be affected:
240: nsresult
241: StartupCache::LoadArchive(enum TelemetrifyAge flag)
242: {
...
253: rv = mArchive->OpenArchive(mFile);
254: if (NS_FAILED(rv) || flag == IGNORE_AGE)
255: return rv;
256:
257: nsCString comment;
258: if (!mArchive->GetComment(comment)) {
259: return rv;
260: }
261:
262: const char *data;
263: size_t len = NS_CStringGetData(comment, &data);
264: PRTime creationStamp;
265: // We might not have a comment if the startup cache file was created
266: // before we started recording creation times in the comment.
267: if (len == sizeof(creationStamp)) {
268: memcpy(&creationStamp, data, len);
...
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 Networking: JAR. Mozilla made it public on 20 October 2015 as CVE-2016-1945.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.