CWE
20 22
Advisory Published
Updated

GHSA-r9mq-3c9r-fmjq: Input Validation

First published: Tue Oct 15 2024(Updated: )

# Description ## Path traversal This vulnerability allows an attacker to craft a request which is able to traverse the server file system and retrieve the contents of arbitrary files, including sensitive data such as configuration files, environment variables, and other critical data stored on the server. From Rajesh Sharma who discovered the vulnerability: POC: `curl --path-as-is http://localhost:3000/assets/../package.json` gives you the content of package.json present in the local directory. The vulnerability stems from usage of decodedReqPath directly in path.join without performing any path normalization i.e path.normalize in node.js https://github.com/vendure-ecommerce/vendure/blob/801980e8f599c28c5059657a9d85dd03e3827992/packages/asset-server-plugin/src/plugin.ts#L352-L358 If the vendure service is behind some server like nginx, apache, etc. Path normalization is performed on the root server level but still the actual client's request path will be sent to vendure service but not the resultant normalized path. However, depending the type of root server one can try various payloads to bypass such normalization. The reporter found a customer website which uses local asset plugin and using above mentioned vulnerability, and was able to find secrets like email credentials. ## DOS via malformed URI In the same code path is an additional vector for crashing the server via a malformed URI Again from Rajesh: There is also a potential Denial of Service (DoS) issue when incorrectly encoded URI characters are passed as part of the asset URL. When these malformed requests are processed, they can lead to system crashes or resource exhaustion, rendering the service unavailable to users. Exploit: `curl --path-as-is http://localhost:3000/assets/%80package.json` , here `%80` is not a valid url-encoded character hence the decodeURIComponent is called on it, the entire app crashes. ``` [:server] /Users/abc/mywork/vendure/packages/asset-server-plugin/src/plugin.ts:353 [:server] const decodedReqPath = decodeURIComponent(req.path); [:server] ^ [:server] URIError: URI malformed ``` ### Patches v3.0.5, v2.3.3 ### Workarounds - Use object storage rather than the local file system, e.g. MinIO or S3 - Define middleware which detects and blocks requests with urls containing `/../`

Affected SoftwareAffected VersionHow to fix
npm/@vendure/asset-server-plugin>=3.0.0<3.0.5
3.0.5
npm/@vendure/asset-server-plugin<2.3.3
2.3.3

Never miss a vulnerability like this again

Sign up to SecAlerts for real-time vulnerability data matched to your software, aggregated from hundreds of sources.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2024 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203