Unrestricted Attachment Upload
InvenTree allowed authenticated users to upload arbitrary files as attachments, including HTML files containing malicious JavaScript. When another user opened such an attachment, the script ran in their browser, enabling cross-site scripting.
inventree/inventree
Originally disclosed on huntr
Impact
InvenTree allows unrestricted upload of files as attachments to various database fields. Potentially dangerous files (such as HTML files containing malicious javascript) can be uploaded, and (when opened by the user) run the malicious code directly in the users browser.
Note that the upload of malicious files must be performed by an authenticated user account
Solution
The solution for this vulnerability is to ensure that attachment files are downloaded to the local machine before opening, rather than opening the file in the current browser context.
Patches
- The issue is addressed in the upcoming 0.8.0 release
- This fix will also be back-ported to the 0.7.x branch, applied to the 0.7.2 release
Workarounds
Users can alleviate risk of opening malicious files by right-clicking on the attachment link and selecting "Save link as"
This minimizes risk (e.g. of XSS attacks) by opening the HTML file from the users computer
References
https://huntr.dev/bounties/a0e5c68e-0f75-499b-bd7b-d935fb8c0cd1/
For more information
If you have any questions or comments about this advisory:
- Open an issue in github
- Email us at [email protected]
From the GitHub Advisory Database (GHSA-fr2w-mp56-g4xp, CC BY 4.0).
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the application served uploaded attachments inline from its own origin without restricting file types or forcing a download, so browser-executable content ran in the site's context.
Impact
An authenticated attacker could upload a malicious HTML attachment that, when opened by another user, executes script in that user's browser; the advisory notes the upload requires an authenticated account.
What the attacker needed
Authenticated user account; victim opens the attachment
The fix
The issue was fixed in version 0.8.0 and back-ported to 0.7.2 by ensuring attachment files are downloaded locally before opening rather than opened in the browser context.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A web application let logged-in users attach any kind of file to records. If someone uploaded a web page with hidden script and another person clicked to view it, that script ran as if it were part of the site. This is called cross-site scripting, where an attacker's code runs in a victim's browser session.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.