-
Notifications
You must be signed in to change notification settings - Fork 0
feat(vendor): add vendor report endpoint #38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,16 @@ | ||||||
| /* | ||||||
| * Copyright (c) 2014-2024 Bjoern Kimminich & the OWASP Juice Shop contributors. | ||||||
| * SPDX-License-Identifier: MIT | ||||||
| */ | ||||||
|
|
||||||
| import * as models from '../models/index' | ||||||
| import { type Request, type Response, type NextFunction } from 'express' | ||||||
|
|
||||||
| module.exports = function vendorReport () { | ||||||
| return (req: Request, res: Response, next: NextFunction) => { | ||||||
| const vendor = req.query.vendor ?? '' | ||||||
| models.sequelize.query(`SELECT * FROM Products WHERE name = '${vendor}'`) | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SQL Injection in GET /rest/vendor/report (routes/vendorReport.ts) (Severity: HIGH) An anonymous attacker can inject SQL via the vendor query parameter which gets directly concatenated into a SQL statement, leading to potential exposure of Products data. The code reads req.query.vendor in routes/vendorReport.ts and interpolates it into the query in vendorReport(), resulting in arbitrary SQL execution without input validation or parameterization.
Suggested change
💬 Reply |
||||||
| .then(([rows]: any) => { res.json({ rows }) }) | ||||||
| .catch((error: Error) => { next(error) }) | ||||||
| } | ||||||
| } | ||||||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SQL Injection in vendorReport endpoint (routes/vendorReport.ts:12) (Severity: HIGH)
SQL injection risk: unauthenticated requests to /rest/vendor/report allow manipulation of the query via the vendor parameter, which is interpolated directly into the SQL statement. This leads to potential data exposure or modification as the WHERE clause can be altered, resulting in arbitrary row retrieval or additional statements depending on configuration, with the vulnerability exposed in vendorReport() handling of req.query.vendor.
View details in ZeroPath
💬 Reply
@ZeroPath false-positive because …or@ZeroPath accepted-risk because …to triage this finding, or ask it any question.All commands