Description
to_abs_path in scripts/iib/tool.py normalised the requested path with os.path.normpath, which collapses dot segments but does not resolve symbolic links. A symlink placed inside a scanned directory therefore satisfies the containment comparison performed by is_path_trusted in scripts/iib/api.py while pointing outside that directory, and FileResponse follows the link when serving the response, so a link created in an image directory and targeting a file such as /etc/passwd discloses that file. Whether the check applies depends on get_enable_access_control in scripts/iib/tool.py: it returns true when IIB_ACCESS_CONTROL is set to enable, false when set to disable, and otherwise true when the host Stable Diffusion WebUI was started with share, ngrok, listen or server_name, falling back to false. Confinement is therefore active in the network-exposed WebUI deployments that rely on it, while a standalone run with no such option serves every readable file regardless of this flaw. The fix resolves the path with os.path.realpath.
Affected products
| Vendor | Product | Affected | Fixed |
|---|---|---|---|
| zanllp | infinite-image-browsing | ≤ 1.8.0 | — |
References
- GitHub Issue #968 issue-tracking
- GitHub Pull Request #969 issue-tracking patch
- Fix path traversal in is_path_trusted (CWE-22/CWE-59) patch
- to_abs_path normalising with normpath at v1.8.0 technical-description
- is_path_trusted consuming the unresolved path at v1.8.0 technical-description
- https://github.com/zanllp/infinite-image-browsing product
- VulnCheck Advisory: Infinite Image Browsing Resolves Paths With normpath, Allowing Symlink Escape From Scanned Directories third-party-advisory