Disclosed vulnerabilities
Fixed: Aug 25, 2023
CVE-2023-46943 Published: Aug 25, 2023

Insecure JWT – Hardcoded HMAC Secret in @evershop/evershop

9.1 Critical Severity hardcoded HMAC insecure JWT
Bruno Dias Reported by Checkmarx Zero

Summary

NPM’s package @evershop/evershop prior to 1.0.0-rc.8 has the HMAC secret used for generating tokens hardcoded as “secret”. A weak HMAC secret poses a risk because attackers can use the predictable secret to create valid JSON Web Tokens (JWTs), allowing them access to important information and actions within the application. This vulnerability has been fixed by implementing session authentication.

Product

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

Impact

This vulnerability allows for easy forging of valid JWTs, enabling unauthorized access to sensitive information, such as obtaining Admin IDs and performing potentially harmful actions within the application.

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. Craft a malicious JWT token with the forged HMAC secret (the token should contain the key "user":{"isAdmin": true})
  4. Make a POST request to GraphQL API (ensure that the request includes the Cookie header with a cookie named ‘admin_token’ and set its value to the forged JWT) with the following query to obtain a list of Admin IDs and retrieve detailed information about a specific admin user:
    {"query": "query {ntadminUsers(filters:[]) {nttcurrentFilters {ntttoperationntt}ntttotalnnttitems {ntttadminUserIdntt}nt}n}"}
  5. Once the Admin ID is obtained make a POST request to GraphQL API with the following query (in this example Admin ID: 1) to obtain full information about the user, including its UUID:
    {"query": "query {ntadminUser(id:1) {nttadminUserIdnttfullNamenttuuidnttemailnttstatusnt}n}"}
  6. Utilize the obtained administrator information to construct a valid JWT to perform more sensitive actions within the application.

Expected result:

Complete exploitation of the application, by extracting detailed information about a specific admin user which can be used to build a perfectly valid JWT.

Remediation

A fix was released in commit 187260b, where Express session authentication was implemented. 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 Bruno Dias.

Resources

  1. Pull Request
  2. Commit

Stay connected and never miss a research update!