-
Notifications
You must be signed in to change notification settings - Fork 0
feat(hostile): add reporting endpoints with awkward path names #34
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 dashDirAudit () { | ||
| return (req: Request, res: Response, next: NextFunction) => { | ||
| const qd = req.query.qd ?? '' | ||
| models.sequelize.query(`SELECT * FROM Baskets WHERE name = '${qd}'`) | ||
| .then(([rows]: any) => { res.json({ rows }) }) | ||
| .catch((error: Error) => { next(error) }) | ||
| } | ||
| } | ||
| 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 obrienReport () { | ||||||
| return (req: Request, res: Response, next: NextFunction) => { | ||||||
| const qb = req.query.qb ?? '' | ||||||
| models.sequelize.query(`SELECT * FROM Cards WHERE name = '${qb}'`) | ||||||
|
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 /rest/hostile/quote (routes/o'brien.ts:12) (Severity: HIGH) Unauthenticated users can manipulate the qb query parameter which causes the app to interpolate it directly into a SQL statement, leading to potential data leakage or modification via the Cards table. The code in routes/o'brien.ts line 12 builds the query without parameters or escaping, resulting in a risky query execution path when /rest/hostile/quote is requested.
Suggested change
💬 Reply |
||||||
| .then(([rows]: any) => { res.json({ rows }) }) | ||||||
| .catch((error: Error) => { next(error) }) | ||||||
| } | ||||||
| } | ||||||
| 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 quarterlyReportSpace () { | ||
| return (req: Request, res: Response, next: NextFunction) => { | ||
| const qa = req.query.qa ?? '' | ||
| models.sequelize.query(`SELECT * FROM Orders WHERE name = '${qa}'`) | ||
| .then(([rows]: any) => { res.json({ rows }) }) | ||
| .catch((error: Error) => { next(error) }) | ||
| } | ||
| } |
| 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 rapportCafe () { | ||
| return (req: Request, res: Response, next: NextFunction) => { | ||
| const qc = req.query.qc ?? '' | ||
| models.sequelize.query(`SELECT * FROM Addresses WHERE name = '${qc}'`) | ||
| .then(([rows]: any) => { res.json({ rows }) }) | ||
| .catch((error: Error) => { next(error) }) | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -102,6 +102,10 @@ const web3Wallet = require('./routes/web3Wallet') | |
| const updateProductReviews = require('./routes/updateProductReviews') | ||
| const likeProductReviews = require('./routes/likeProductReviews') | ||
| const security = require('./lib/insecurity') | ||
| const quarterlyReportSpace = require('./routes/quarterly report') | ||
| const obrienReport = require("./routes/o'brien") | ||
| const rapportCafe = require('./routes/rapport-café') | ||
| const dashDirAudit = require('./routes/-dashdir/audit') | ||
| const app = express() | ||
| const server = require('http').Server(app) | ||
| const appConfiguration = require('./routes/appConfiguration') | ||
|
|
@@ -571,6 +575,10 @@ 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/hostile/space', quarterlyReportSpace()) | ||
|
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 via /rest/hostile/space endpoint in server.ts (Severity: HIGH) The attack can exfiltrate data because the handler uses the attacker-controlled qa parameter to build a raw SQL query, which causes the database to return arbitrary rows. This occurs in server.ts at line 578 where app.get('/rest/hostile/space', quarterlyReportSpace()) is mounted without auth and the handler executes SELECT * FROM Orders WHERE name = '${qa}' and returns JSON results, leading to exposure of other users’ orders and potentially other tables. Automatic patch generation was not possible for this finding. 💬 Reply |
||
| app.get('/rest/hostile/quote', obrienReport()) | ||
|
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 via /rest/hostile/quote in server.ts (Severity: HIGH) The endpoint /rest/hostile/quote allows attackers to inject SQL through the qb parameter, which is interpolated directly into a raw query on the Cards table, risking exposure of payment-card or arbitrary data. This occurs because the handler at server.ts:579 builds a query like SELECT * FROM Cards WHERE name = '${qb}' without input sanitization or authentication, leading to unauthorized data access. Automatic patch generation was not possible for this finding. 💬 Reply |
||
| app.get('/rest/hostile/unicode', rapportCafe()) | ||
|
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. SQLi in /rest/hostile/unicode handler (server.ts:580) (Severity: HIGH) SQL injection risk: an attacker can inject into the query used to fetch Addresses. The handler concatenates qc into a raw SQL string in a vulnerable SELECT, which causes exposure of other users’ addresses or arbitrary rows when the endpoint is called without auth. This is triggered by the /rest/hostile/unicode route mounted in server.ts at line 580 via rapportCafe(), leading to unsafe query construction. Automatic patch generation was not possible for this finding. 💬 Reply |
||
| app.get('/rest/hostile/dash', dashDirAudit()) | ||
|
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 via /rest/hostile/dash in server.ts (Severity: CRITICAL) The vulnerability allows an attacker to inject SQL through the qd parameter, which is interpolated into a raw query in the /rest/hostile/dash handler, leading to disclosure of basket contents and other data. This occurs because server.ts mounts the route without auth and the dashDirAudit() handler executes a query like SELECT * FROM Baskets WHERE name = '${qd}' without input sanitization, allowing arbitrary SQL execution. An attacker can access the endpoint publicly, triggering data leaks via the vulnerable query. Automatic patch generation was not possible for this finding. 💬 Reply |
||
| app.get('/rest/admin/application-version', appVersion()) | ||
| app.get('/rest/admin/application-configuration', appConfiguration()) | ||
| app.get('/rest/repeat-notification', repeatNotification()) | ||
|
|
||
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/hostile/dash (routes/-dashdir/audit.ts) (Severity: HIGH)
The endpoint allows unauthenticated access and uses a user-supplied qd parameter directly in a SQL string, which causes an SQL injection risk that could read or modify data. The code reads qd from req.query and interpolates it into the query on line 12 as
SELECT * FROM Baskets WHERE name = '${qd}', which leads to potential data exposure or manipulation depending on the database driver.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