Skip to content

Comments

fixes Path Traversal + ZIP Slip allow arbitrary filesystem read/write…#35

Open
arnchlmcodes wants to merge 1 commit intoOSeMOSYS:masterfrom
arnchlmcodes:fix-issue-34
Open

fixes Path Traversal + ZIP Slip allow arbitrary filesystem read/write…#35
arnchlmcodes wants to merge 1 commit intoOSeMOSYS:masterfrom
arnchlmcodes:fix-issue-34

Conversation

@arnchlmcodes
Copy link

Fixes #34

Summary

This PR fixes multiple security vulnerabilities involving path traversal and ZIP Slip attacks that could allow arbitrary filesystem read/write.

Changes

Security Improvements

  • Added Security helper class with:
    • safeCasePath(baseDir, casename) - ensures resolved paths remain inside the intended directory (prevents ../ traversal).
    • safeExtractall(zf, targetDir) - validates ZIP entries before extraction to prevent ZIP Slip attacks.

Path Traversal Protection

  • Added Security.safeCasePath() validation to routes handling user-supplied paths:
    • API/Routes/Case/CaseRoute.py (multiple endpoints)
    • API/Routes/Upload/UploadRoute.py (backupCase())

Requests attempting directory escape now return HTTP 400.

ZIP Extraction Hardening

  • Replaced unsafe zf.extractall() usage with Security.safeExtractall() in:
    • uploadCaseUnchunked_old()
    • handle_full_zip()

Upload Size Limiting

Updated Flask configuration:

app.config["MAX_CONTENT_LENGTH"] = 500 * 1024 * 1024  # 500 MB

Prevents unbounded file uploads.

@arnchlmcodes arnchlmcodes deleted the fix-issue-34 branch February 21, 2026 20:38
@arnchlmcodes arnchlmcodes restored the fix-issue-34 branch February 21, 2026 20:42
@arnchlmcodes arnchlmcodes reopened this Feb 21, 2026
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.

[SECURITY] Path Traversal + ZIP Slip allow arbitrary filesystem read/write/delete

1 participant