Repository navigation
Fix zip-slip blacklist bypass in isDangerousZipEntryName - #621
Merged
Merged
Conversation
isDangerousZipEntryName rejected entries via string prefix/substring
checks (startsWith('/'), startsWith('../'), includes('/../')), which
misses entries whose traversal segment isn't bounded by a following
'/' -- e.g. an entry named exactly 'scripts/..' (no trailing content)
passes all three checks, as does any entry using backslash as a
separator instead of forward slash (e.g. 'scripts\\..\\..\\evil').
Confirmed via a dynamic PoC (crafted a real zip with Python's zipfile
module, bypassing AdmZip's own write-side path normalization, and fed
the raw bytes through the actual compiled loadSkillFromZipBuffer) that
'scripts/..' passes the old check and reaches
skill.resources.scripts['..']. A second, independent hardened check in
materializeFiles (utils/file_utils.ts) was confirmed to catch and
reject the resulting escape attempt in every consumer of this data
that writes to disk, so this fix closes a genuine gap in
defense-in-depth rather than a currently-reachable filesystem escape.
Replaces the prefix/substring checks with a segment-based check: split
on both '/' and '\\' and reject if any segment is exactly '..', plus
an explicit absolute-path check (POSIX and Windows style). Verified
against the previous bypass cases, the existing test suite (68 tests,
all still pass), and additional false-positive traps (filenames merely
containing '..' as a substring, e.g. 'a/b..c/d', must not be rejected).
Contributor
|
Hi @kalenkevich, I have tested and validated the proposed changes in this PR. Could you please review this PR? |
kalenkevich
approved these changes
Aug 5, 2026
Merged
kalenkevich
added a commit
that referenced
this pull request
Aug 5, 2026
Both PR titles used "Fix <subject>" with no colon, so the squash subjects were not conventional commits and release-please dropped them from the generated changelog: d3f250e Fix unsafe A2A peer-supplied transferToAgent metadata (#596) 7bc05f6 Fix zip-slip blacklist bypass in isDangerousZipEntryName (#621) Both are core-only security fixes landed after adk-v1.5.0, so they belong in the adk 1.6.0 Bug Fixes section. Entries are inserted in the position release-please would have emitted them.
kalenkevich
added a commit
that referenced
this pull request
Aug 6, 2026
* Release: v1.6.0 * chore(changelog): add missing #596 and #621 security fixes to adk 1.6.0 Both PR titles used "Fix <subject>" with no colon, so the squash subjects were not conventional commits and release-please dropped them from the generated changelog: d3f250e Fix unsafe A2A peer-supplied transferToAgent metadata (#596) 7bc05f6 Fix zip-slip blacklist bypass in isDangerousZipEntryName (#621) Both are core-only security fixes landed after adk-v1.5.0, so they belong in the adk 1.6.0 Bug Fixes section. Entries are inserted in the position release-please would have emitted them.
prasanna8585
added a commit
to prasanna8585/adk-js
that referenced
this pull request
Aug 21, 2026
isDangerousZipEntryName rejected entries via string prefix/substring
checks (startsWith('/'), startsWith('../'), includes('/../')), which
misses entries whose traversal segment isn't bounded by a following
'/' -- e.g. an entry named exactly 'scripts/..' (no trailing content)
passes all three checks, as does any entry using backslash as a
separator instead of forward slash (e.g. 'scripts\\..\\..\\evil').
Confirmed via a dynamic PoC (crafted a real zip with Python's zipfile
module, bypassing AdmZip's own write-side path normalization, and fed
the raw bytes through the actual compiled loadSkillFromZipBuffer) that
'scripts/..' passes the old check and reaches
skill.resources.scripts['..']. A second, independent hardened check in
materializeFiles (utils/file_utils.ts) was confirmed to catch and
reject the resulting escape attempt in every consumer of this data
that writes to disk, so this fix closes a genuine gap in
defense-in-depth rather than a currently-reachable filesystem escape.
Replaces the prefix/substring checks with a segment-based check: split
on both '/' and '\\' and reject if any segment is exactly '..', plus
an explicit absolute-path check (POSIX and Windows style). Verified
against the previous bypass cases, the existing test suite (68 tests,
all still pass), and additional false-positive traps (filenames merely
containing '..' as a substring, e.g. 'a/b..c/d', must not be rejected).
prasanna8585
pushed a commit
to prasanna8585/adk-js
that referenced
this pull request
Aug 21, 2026
* Release: v1.6.0 * chore(changelog): add missing google#596 and google#621 security fixes to adk 1.6.0 Both PR titles used "Fix <subject>" with no colon, so the squash subjects were not conventional commits and release-please dropped them from the generated changelog: d3f250e Fix unsafe A2A peer-supplied transferToAgent metadata (google#596) 7bc05f6 Fix zip-slip blacklist bypass in isDangerousZipEntryName (google#621) Both are core-only security fixes landed after adk-v1.5.0, so they belong in the adk 1.6.0 Bug Fixes section. Entries are inserted in the position release-please would have emitted them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
isDangerousZipEntryNameused prefix/substring string checks (startsWith('/'),startsWith('../'),includes('/../')) that miss entries whose traversal segment isn't followed by more path content — e.g. an entry literally namedscripts/..passes all three checks, as does any entry using a backslash separator instead of a forward slash.Confirmed via a dynamic PoC: crafted a real zip with Python's
zipfilemodule (bypassing AdmZip's own write-side path normalization, which is not representative of an attacker-crafted zip), fed the raw bytes through the actual compiledloadSkillFromZipBuffer, and confirmedscripts/..passes the old check and reachesskill.resources.scripts['..']. Also confirmed a second, independent check inmaterializeFiles(utils/file_utils.ts) catches and rejects the resulting escape attempt in every consumer that writes this data to disk — so this closes a genuine defense-in-depth gap rather than a currently-reachable filesystem escape in the traced call paths.Replaces the checks with a segment-based approach: split on both
/and\, reject if any segment is exactly.., plus an explicit absolute-path check (POSIX and Windows). Added two regression test cases for the confirmed bypasses.