Skip to content

πŸ›‘οΈ Sentinel: [HIGH] Fix Zip Slip path traversal vulnerability in skills import#148

Open
thirdeyenation wants to merge 1 commit into
mainfrom
sentinel-zip-slip-skills-import-11254959432677005139
Open

πŸ›‘οΈ Sentinel: [HIGH] Fix Zip Slip path traversal vulnerability in skills import#148
thirdeyenation wants to merge 1 commit into
mainfrom
sentinel-zip-slip-skills-import-11254959432677005139

Conversation

@thirdeyenation
Copy link
Copy Markdown
Owner

🚨 Severity: HIGH
πŸ’‘ Vulnerability: Unsafe extraction of ZIP archives in _unzip_to_temp_dir (helpers/skills_import.py) allowing path traversal (Zip Slip) via z.extractall(target) without properly checking member paths.
🎯 Impact: Maliciously crafted ZIP archives could contain relative path specifiers like ../ to extract and overwrite files outside the intended temporary extraction directory, potentially leading to arbitrary code execution or file corruption elsewhere in the system.
πŸ”§ Fix: Modified _unzip_to_temp_dir to iterate through z.namelist(), calculate the resolved absolute path for each member, and strictly verify using pathlib.Path.is_relative_to() that the resolved path falls within the intended target directory. If a path escapes the target directory, it raises a ValueError rejecting the archive.
βœ… Verification: A temporary test script was written and executed verifying that a ZIP containing ../evil.txt correctly triggers the ValueError exception and halts extraction without deploying the file. Cleaned up the testing code.


PR created automatically by Jules for task 11254959432677005139 started by @thirdeyenation

Added defense-in-depth against "Zip Slip" (path traversal) vulnerabilities during the extraction of zipped skill directories in `helpers/skills_import.py`. Iterates through `z.namelist()` and ensures that each extracted file resolves to a path that is strictly relative to the target extraction directory.

Co-authored-by: thirdeyenation <133812267+thirdeyenation@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown

πŸ‘‹ Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a πŸ‘€ emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant