]> BookStack Code Mirror - bookstack/commit
Added protections against path traversal in file system operations
authorDan Brown <redacted>
Fri, 8 Oct 2021 16:47:14 +0000 (17:47 +0100)
committerDan Brown <redacted>
Fri, 8 Oct 2021 16:47:14 +0000 (17:47 +0100)
commit7224fbcc89f00f2b71644e36bb1b1d96addd1d5a
tree05bba97fd82c04eea861453e8db83df679e282cd
parent81d6b1b016bdbb6c7d01f7f7d0a14585d3104c55
Added protections against path traversal in file system operations

- Files within the storage/ path could be accessed via path traversal
  references in content, accessed upon HTML export.
- This addresses this via two layers:
  - Scoped local flysystem filesystems down to the specific image &
    file folders since flysystem has built-in checking against the
    escaping of the root folder.
  - Added path normalization before enforcement of uploads/{images,file}
    prefix to prevent traversal at a path level.

Thanks to @Haxatron via huntr.dev for discovery and reporting.
Ref: https://huntr.dev/bounties/ac268a17-72b5-446f-a09a-9945ef58607a/
app/Config/filesystems.php
app/Uploads/AttachmentService.php
app/Uploads/ImageService.php