π‘οΈ Sentinel: [CRITICAL] Fix Path Traversal Bypass#21
Conversation
Fix a path traversal bypass vulnerability in `public/api/files.php`, `public/api/terminal.php`, `public/api/projects.php`, and `src/Utils/Security.php` where validating if a user-supplied path is within an allowed directory using `strpos($realPath, $allowedReal) === 0` allowed access to sibling directories (e.g., an allowed path `/var/www` matched the malicious path `/var/www_backup`). Fixed by ensuring exact path matches or appending a trailing directory separator (`/`) to the allowed path prefix.
|
π 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Hello from @codemakerai. CodeMaker AI GitHub App integration. Usage: @codemakerai [command or prompt] AssistantAll Assistant features are supported in GitHub. Assistant can answer general questions as well as questions directly @codemakerai assistant prompt - the assistant prompt CommandsPull Request Commands - commands that can be posted as comments on the pull request: @codemakerai help - prints this help message Pull Request Code Review Commands - commands that can be posted as comments on the code review i.e. "Files changed" tab: @codemakerai assistant prompt - the assistant prompt TriggersTo automatically trigger certain actions on pull requests you can create and use the following GitHub labels. codemakerai-pull-request-generate-documentation - automatically generates comments/documentation on Pull Request creation. For in depth explanation of the features, please consult https://docs.codemaker.ai In case of any issues please report them to https://community.codemaker.ai |
π¨ Severity: CRITICAL
π‘ Vulnerability: Path traversal / Authorization Bypass where a user could access sibling directories by creating a directory sharing the same prefix as an allowed directory (e.g.,
/var/www_backupwhen/var/wwwis allowed).π― Impact: Attackers could gain unauthorized access to read, create, delete, or rename files and directories outside of their allowed workspaces or system folders, compromising the security of the host system.
π§ Fix: Modified the path validation logic across the API endpoints to strictly enforce directory boundaries by appending a trailing slash (
/) to the allowed directory path before performing the prefix check usingstrpos. Also added exact match checks for the root of the allowed directory.β Verification: Ran
php tests/SecurityTest.phpand manually verified with test scripts that unauthorized path bypasses are now correctly rejected.PR created automatically by Jules for task 13539185397145297378 started by @LebToki