-
Notifications
You must be signed in to change notification settings - Fork 0
feat(ops): add warehouse audit endpoint #28
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: zp313-ubase
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,20 @@ | ||||||
| /* | ||||||
| * 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' | ||||||
|
|
||||||
| // Warehouse audit lookup for the operations console. | ||||||
| module.exports = function warehouseAudit () { | ||||||
| return (req: Request, res: Response, next: NextFunction) => { | ||||||
| const zone = req.query.zone ?? '' | ||||||
| models.sequelize.query(`SELECT * FROM Products WHERE description LIKE '%${zone}%'`) | ||||||
|
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 warehouseAudit endpoint (routes/warehouseAudit.ts) (Severity: HIGH) SQL injection risk exposes or alters data because the zone query parameter is interpolated directly into a LIKE clause in a raw SQL query, which can be exploited by supplying special characters. This occurs in routes/warehouseAudit.ts line 13 where zone is read from req.query.zone and embedded in sequelize.query without parameter binding, leading to potentially unintended queries executed by GET /rest/warehouse/audit.
Suggested change
💬 Reply |
||||||
| .then(([rows]: any) => { | ||||||
| res.json({ zone, 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 /rest/warehouse/audit (warehouseAudit.ts) (Severity: CRITICAL)
The route allows unauthenticated access which can lead to data exposure. It interpolates req.query.zone directly into a SQL statement, causing injection that could read arbitrary tables; this is performed without parameter binding, resulting in the returned rows in the JSON response.
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