Skip to content

Add check for decompression bomb vulnerabilities #1339

@kfess

Description

@kfess

Is your feature request related to a problem? Please describe.

Bandit currently does not detect potential decompression bomb vulnerabilities.

Describe the solution you'd like

Add a new check (for example, B114) that detects:

  1. Direct dangerous calls:

    • gzip.decompress()
    • zlib.decompress()
    • bz2.decompress()
    • lzma.decompress()
    • and other standard libs.
  2. Reading from compressed files without size limit:

    • gzip.open() followed by .read() without size argument

Describe alternatives you've considered

gosec (Go security checker) has a similar rule (G110).

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions