Skip to content
Business logic Advisory Advanced CVE-2026-87549

Incomplete cleanup in Downloads (CVE-2026-87549)

A sparse intermediate download file is not truncated when a parallel download is resumed from stale database metadata, so bytes written at a high offset can remain past the logical end of the file. Safe Browsing would then only hash the benign prefix while the finished file keeps an attacker-controlled suffix on disk.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 4 months

Project Fortify, an experimental security project, has identified the following potential security issue. If you're a feature owner CC-ed on this bug, please do your best to review these reports. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.

Overview: A potential vulnerability in Chrome's download manager allows trailing on-disk payload bytes to escape Safe Browsing hash calculation during parallel downloads. When a parallel download is resumed using a stale database state (for example, after a browser crash within the 10-second DB commit window), the sparse-file branch of BaseFile::Open fails to truncate the intermediate file. This can result in a completed file retaining an untruncated malicious suffix, while Safe Browsing only receives and validates the hash of the benign prefix.

Affected files:

  • components/download/internal/common/base_file.cc
  • components/download/internal/common/download_file_impl.cc
  • components/download/internal/common/download_db_cache.cc

Estimated timestamp from git blame: Unknown (Google3 checkout)

Root Cause

In Chrome's parallel download implementation, BaseFile::Open (in components/download/internal/common/base_file.cc) handles intermediate file opening and state validation. When reopening an intermediate file during download resumption, the non-sparse branch truncates the file via file_.SetLength(bytes_so_far_) whenever the on-disk file size exceeds the logged progress (bytes_so_far_).

However, the sparse branch (is_sparse_file_ == true) lacks this truncation, returning early if the file length is at least bytes_so_far_:

C++
// components/download/internal/common/base_file.cc
if (is_sparse_file_) {
  if (file_.GetLength() < bytes_so_far_) {
    *bytes_wasted = bytes_so_far_;
    ClearFile();
    return LogInterruptReason("File has fewer written bytes than expected", 0,
                              DOWNLOAD_INTERRUPT_REASON_FILE_TOO_SHORT);
  }
  return DOWNLOAD_INTERRUPT_REASON_NONE;   // No truncation occurs here
}

When completion occurs, BaseFile::Finish() for sparse files invokes CalculatePartialHash() to hash the downloaded file, but only hashes exactly bytes_so_far_ bytes starting from offset 0. Since the physical file is never truncated and CalculatePartialHash only reads up to bytes_so_far_ (which is determined by the server-provided length of the final version of the download), trailing bytes from previous high-offset writes remain on disk. The file is eventually renamed and moved to the final path, retaining the untruncated trailing data.


Potential Trigger Path

Note: These are suggested/potential steps; our tooling agent does not currently have the capability to run code to verify this interactively.

  1. Parallel Download and High-Offset Writes: During a parallel download, ParallelDownloadJob spans multiple worker requests to download slices. A high-offset range worker writes data at offset H (writing B bytes up to H+B) directly to the intermediate .crdownload file.
  2. Metadata Batching Window: Intermediate database updates for in-progress downloads are batched in DownloadDBCache::AddOrReplaceEntry with a timer interval of kUpdateDBIntervalMs = 10000 (10 seconds) (see components/download/internal/common/download_db_cache.cc).
  3. Unclean Exit: If the browser process terminates abruptly (e.g. due to Android OOM-kill or a force stop) within this 10-second window, the physical file on disk retains the high-offset slice data (extending to length H+B), but the persisted database metadata (received_slices_) is stale, lacking this high-offset slice information.
  4. Resumption: Upon restart, the database entry loads the stale slice metadata. The download is resumed with the same ETag validator.
  5. No Truncation on Resume: DownloadFileImpl::Initialize initializes the file as sparse and calls BaseFile::Open(). Because the file is sparse, Open() skips truncation, leaving the physical file size at H+B bytes while the internal tracking state (bytes_so_far_) is set to 0 (or the stale metadata state).
  6. Completion and Hash Bypass: On resumption, the server completes the remaining download slices up to logical length L (where L < H+B) and completes successfully. BaseFile::Finish() is called, which computes the SHA-256 hash of only the prefix [0..L) via CalculatePartialHash().
  7. Bypass: The final file on disk is renamed to its destination but retains the trailing [L..H+B) bytes of attacker-controlled data. Safe Browsing checks are populated using the computed prefix hash and length L, allowing the file to bypass reputation checks if the prefix matches a known benign binary.

Suggested Fix

To remediate this issue, the intermediate file should be physically truncated to its logical size upon download completion. Inside BaseFile::Finish() (in components/download/internal/common/base_file.cc), truncate the file to bytes_so_far_ before closing and renaming it:

C++
std::unique_ptr<crypto::SecureHash> BaseFile::Finish() {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);

  if (is_sparse_file_) {
    CalculatePartialHash(std::string());
    // Truncate the sparse file to its final completed logical length
    if (file_.IsValid()) {
      file_.SetLength(bytes_so_far_);
    }
  }
  Close();
  return std::move(secure_hash_);
}

Evaluated with Chrome root at commit: a2bea94528f4bd6cc57739c43fa3bb890b8367d3


Results so far have been promising, but there can be wrong deductions. Feel free to adjust as follows:

  • If you are familiar with the severity guidelines, you may adjust the severity.
  • If this is a false positive, and there's no work to be done, please close as WAI.
  • If there is work to do here but not a vulnerability, please change the issue type to Task/Bug/FR.

Data from false positives will be used to improve accuracy over time. And please feel free to reach out to me directly if you have concerns or feedback on the project.

The original report as published on the Chromium issue tracker. Images and videos are our own copies; raw HTML is shown as text. View it on Chromium issue tracker.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the sparse-file branch of BaseFile::Open returns early without truncating the file to the logged progress, and BaseFile::Finish only hashes bytes_so_far_ without shrinking the file first.

Impact

A downloaded file could keep attacker-controlled trailing bytes that Safe Browsing never hashed, potentially bypassing reputation checks; the report notes the trigger path is unverified.

What the attacker needed

Parallel download in progress; browser killed within 10s DB window; resume with same ETag validator

The fix

The intermediate file should be truncated to bytes_so_far_ in BaseFile::Finish before it is closed and renamed.

How it was found

  1. A parallel download worker writes a slice at a high offset into the temporary file.
  2. Database updates for in-progress downloads are batched on a 10-second timer.
  3. The browser process dies within that window, leaving the file long but the saved slice metadata stale.
  4. On restart the download resumes as a sparse file and Open skips truncation.
  5. The download completes at a logical length shorter than the physical file.
  6. Finish hashes only the prefix, and the file is renamed with the trailing bytes intact.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

Chrome can download one file in several pieces at once and writes them into a temporary file. If the browser is killed before it saves its progress notes, the temporary file can be longer than the download is supposed to be, and the extra bytes at the end are never removed. The malware check then only looks at the expected part of the file, so the leftover bytes slip past it.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More from Google Chrome

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.