Disclosed vulnerabilities
Fixed: Sep 26, 2023
CVE-2023-46496 Published: Sep 25, 2023

Arbitrary File Deletion (via Relative Path Traversal) in @evershop/evershop

8.7 High Severity arbitrary deletion file js npm path relative traversal
Mário Teixeira Reported by Checkmarx Zero

Summary

NPM’s package @evershop/evershop prior to 1.0.0-rc.8 is missing input validation in the function ‘unlinkSync’ in ‘deleteFile.js’, leading to a Relative Path Traversal vulnerability that enables arbitrary file deletion. This vulnerability extends beyond path traversal since the endpoint “/api/files” allows “DELETE” requests which then allow for file deletion across the filesystem.

Product

This vulnerability affects NPM’s package @evershop/evershop in versions prior to 1.0.0-rc.8.

Impact

This issue enables an attacker to delete any file on the filesystem.

Steps to reproduce

  1. Install the @evershop/evershop package dependency for any version prior to 1.0.0-rc.8
  2. Run the EverShop Web Application on localhost
  3. Create a delete_me file in the web root folder
  4. Make a DELETE request to endpoint /api/files/../delete_me to delete the file
  5. Confirm that the file was deleted by making a GET request to /api/files/..

Expected result:

The file delete_me was deleted which indicates that the system is exposed to arbitrary file deletion.

Remediation

A fix was released in commit 677651c, where input validation was implemented to protect against Path Traversal attacks. Users are recommended to upgrade to version 1.0.0-rc.8, which includes this fix.

Credit

This issue was discovered and reported by Checkmarx SCA Security Analyst Mário Teixeira.

Resources

  1. Pull Request
  2. Commit

Stay connected and never miss a research update!