Skip to content

security: zlib inflate methods might be vulnerable to zip bombs #27253

@jorangreef

Description

@jorangreef

From the documentation, it doesn't appear that there is any way to limit zlib's inflate methods max uncompressed size?

Without a way to limit the maximum amount of data to be uncompressed, Node's zlib inflate methods could be vulnerable to zip bombs, where a few megabytes of input could result in hundreds of megabytes of uncompressed data.

For parsers such as https://github.com/thejoshwolfe/yauzl, which parse the zip format, and which know the compressed and uncompressed sizes exactly, ahead of time, it should be possible to pass this information on to zlib's inflate methods, so that these can stop when they uncompress more than the zip container allows.

zlib's inflate methods should throw an error when more than maxUncompressedSize has been inflated.

See also: thejoshwolfe/yauzl#107

Metadata

Metadata

Assignees

No one assigned

    Labels

    securityIssues and PRs related to security.zlibIssues and PRs related to the zlib subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions