Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions routes/vendorReport.ts
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}'`)

@zeropath-ai-staging zeropath-ai-staging Bot Sep 9, 2026

Copy link
Copy Markdown

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

Suggested change
models.sequelize.query(`SELECT * FROM Products WHERE name = '${vendor}'`)
models.sequelize.query('SELECT * FROM Products WHERE name = :vendor', { replacements: { vendor: String(vendor) } })

💬 Reply @ZeroPath false-positive because … or @ZeroPath accepted-risk because … to triage this finding, or ask it any question.

All commands

@zeropath-ai-staging zeropath-ai-staging Bot Sep 9, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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.
View details in ZeroPath

Suggested change
models.sequelize.query(`SELECT * FROM Products WHERE name = '${vendor}'`)
models.sequelize.query('SELECT * FROM Products WHERE name = :vendor', { replacements: { vendor } })

💬 Reply @ZeroPath false-positive because … or @ZeroPath accepted-risk because … to triage this finding, or ask it any question.

All commands

.then(([rows]: any) => { res.json({ rows }) })
.catch((error: Error) => { next(error) })
}
}
2 changes: 2 additions & 0 deletions server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ const web3Wallet = require('./routes/web3Wallet')
const updateProductReviews = require('./routes/updateProductReviews')
const likeProductReviews = require('./routes/likeProductReviews')
const security = require('./lib/insecurity')
const vendorReport = require('./routes/vendorReport')
const app = express()
const server = require('http').Server(app)
const appConfiguration = require('./routes/appConfiguration')
Expand Down Expand Up @@ -571,6 +572,7 @@ restoreOverwrittenFilesWithOriginals().then(() => {
app.get('/rest/basket/:id', basket())
app.post('/rest/basket/:id/checkout', order())
app.put('/rest/basket/:id/coupon/:coupon', coupon())
app.get('/rest/vendor/report', vendorReport())
app.get('/rest/admin/application-version', appVersion())
app.get('/rest/admin/application-configuration', appConfiguration())
app.get('/rest/repeat-notification', repeatNotification())
Expand Down