Skip to content

tools: harden zbloat against command injection#9715

Merged
z3moon merged 1 commit intomainfrom
zm/fix-zbloat
Feb 13, 2026
Merged

tools: harden zbloat against command injection#9715
z3moon merged 1 commit intomainfrom
zm/fix-zbloat

Conversation

@z3moon
Copy link
Contributor

@z3moon z3moon commented Feb 13, 2026

This fixes #9701 by replacing shell execution (shell=True and os.system) with direct subprocess calls using argument lists in tools/zbloat/zbloat.py

Previously, the script used f-strings to pass paths directly into a shell command, which created an unnecessary risk: if an external archive contained files with shell metacharacters, it could lead to accidental or malicious command execution during analysis.

By passing arguments as lists, the subprocess module maps them directly to the executable, bypassing the system shell and eliminating the vulnerability.

This fixes #9701 by replacing shell execution (`shell=True` and
`os.system`) with direct subprocess calls using argument lists in
`tools/zbloat/zbloat.py`

Previously, the script used f-strings to pass paths directly into a
shell command, which created an unnecessary risk: if an external archive
contained files with shell metacharacters, it could lead to accidental
or malicious command execution during analysis.

By passing arguments as lists, the subprocess module maps them directly
to the executable, bypassing the system shell and eliminating the
vulnerability.
@z3moon z3moon added the internal Issue/PR does not affect clients label Feb 13, 2026
@z3moon z3moon merged commit 89c3b3f into main Feb 13, 2026
18 checks passed
@z3moon z3moon deleted the zm/fix-zbloat branch February 13, 2026 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Issue/PR does not affect clients

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hardening: avoid shell=True in tools/zbloat.py when executing external commands

3 participants