Description
Hermes WebUI before version 0.51.303 contains a time-of-check time-of-use (TOCTOU) race condition vulnerability in the git_discard function within api/workspace_git.py that allows attackers to delete files outside the configured workspace boundary by replacing a validated path component with a symlink after validation but before deletion. Attackers can substitute a workspace-controlled path component with a symlink pointing to an external directory between the safe_resolve_ws() validation step and the subsequent Path.unlink() or shutil.rmtree() deletion call, causing the delete operation to follow the symlink and remove arbitrary files outside the workspace.
Problem types
Time-of-check Time-of-use (TOCTOU) Race Condition
Product status
Any version before 0.51.303
Credits
Chia Min Jun Lennon
References
github.com/nesquena/hermes-webui/pull/3702
github.com/nesquena/hermes-webui/releases/tag/v0.51.303
github.com/nesquena/hermes-webui/pull/3702
github.com/nesquena/hermes-webui/pull/3756
github.com/...ommit/4580f584964d640b95c4ffc9245a21ab926bec73
www.vulncheck.com/...i-toctou-race-condition-via-git-discard