diff options
author | Sheogorath | 2020-11-23 12:42:19 +0100 |
---|---|---|
committer | David Mehren | 2020-12-27 19:51:01 +0100 |
commit | dc29a286e665555cccb92760908e50cd967fd2e7 (patch) | |
tree | 57754a3e2b0ed3e1ce00b667f495c76ffc3e5159 /yarn.lock | |
parent | 58276ebbf4504a682454a3686dcaff88bc1069d4 (diff) |
Fix arbitary file upload for uploadimage API endpoint
This patch fixes a security issue with all existing CodiMD and HedgeDoc
installation which allows arbitary file uploads to instances that expose
the `/uploadimage` API endpoint. With the patch it implies the same
restrictions on the MIME-types as the frontend does. Means only images
are allowed unless configured differently.
This issue was reported by Thomas Lambertz.
To verify if you are vulnerable or not, create two files `test.html` and
`test.png` and try to upload them to your hedgedoc installation.
```
curl -X POST -F "image=@$(pwd)/test.html" http://localhost:3000/uploadimage
curl -X POST -F "image=@$(pwd)/test.png" http://localhost:3000/uploadimage
```
Note: Not all backends are affected. Imgur and lutim should prevent this
by their own upload API. But S3, minio, filesystem and azure, will be at
risk.
Addition Note: When using filesystem instead of an external uploads
providers, there is a higher risk of code injections as the default CSP
do not block JS from the main domain.
References:
https://github.com/hedgedoc/hedgedoc/security/advisories/GHSA-wcr3-xhv7-8gxc
Signed-off-by: Christoph Kern <sheogorath@shivering-isles.com>
Diffstat (limited to 'yarn.lock')
0 files changed, 0 insertions, 0 deletions