Skip to content

fix(security): zip decode limits trust the size declared in the archive header (zip-bomb bypass) #1561

Closed

Description

@ZhuchkaTriplesix

Problem

SafeZipExtractor._validateArchive (lib/core/security/safe_zip_extractor.dart:141-166) enforces the per-entry, total and compression-ratio limits using entry.size, which is the uncompressed size declared in the zip header.

In archive 4.4.0 that value is only a hint for the initial buffer (codecs/zip/zip_file.dart: "uncompressedSize is only a hint for the initial buffer"). A crafted zip that declares 1 KB can inflate to gigabytes on file.content, so all four limits can be bypassed. Affects marketplace install, sideload (no sha256 there, the file is user-chosen) and the updater.

Expected

  • Extract with a bounded streaming inflate that counts actual bytes written, per entry and in total, and aborts when a limit is exceeded.
  • Keep the header-based pre-check as a cheap early reject.
  • Test with a zip whose header lies about the size.

Activity

  1. added
    bugSomething isn't working
    stabilityTheme parser epic label: stability
    coreCore library logic and services
    P1High priority / Core capability
    on Oct 13, 2026
  2. added a commit that references this issue on Oct 17, 2026
  3. ZhuchkaTriplesix commented on Oct 25, 2026

    @ZhuchkaTriplesix
    MemberAuthor

    Fixed on dev by 40d1c41: fix(security): zip limits cannot be bypassed by a header that understates sizes (#1561). It reaches main with the next dev to main merge (closed after checking the code and its tests).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High priority / Core capabilitybugSomething isn't workingcoreCore library logic and servicesstabilityTheme parser epic label: stability

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions