Skip to content

Commit fbfac1d

Browse files
committed
chore: Pull Request review
* remove referece to "MEAN stack" since this is not "MEAN stack" specific * syntax highlight * minor changes Closes #6
1 parent ddb0c68 commit fbfac1d

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

2019/en/src/0xa8-injection.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,14 @@ $ curl -k "https://${deviceIP}:4567/api/CONFIG/restore" -F 'appid=$(/etc/pod/pow
6262
6363
### Scenario #3
6464
65-
We have MEAN stack application with basic CRUD functionality for operations with
66-
bookings. Attacker managed to identify that NoSQL injection might be possible
67-
through `bookingId` query string parameter in delete booking request.
68-
Request looks like:
69-
`DELETE /bookings?bookingId=678`
65+
We have an application with basic CRUD functionality for operations with
66+
bookings. An attacker managed to identify that NoSQL injection might be possible
67+
through `bookingId` query string parameter in the delete booking request. This
68+
is how the request looks like: `DELETE /api/bookings?bookingId=678`.
7069
71-
On server side, application uses the following function to handle a request:
70+
The API server uses the following function to handle delete requests:
7271
73-
```
72+
```javascript
7473
router.delete('/bookings', async function (req, res, next) {
7574
try {
7675
const deletedBooking = await Bookings.findOneAndRemove({'_id' : req.query.bookingId});
@@ -80,9 +79,14 @@ router.delete('/bookings', async function (req, res, next) {
8079
};
8180
```
8281

83-
Attacker intercepted the request and changed bookingId query string parameter as below:
84-
`DELETE /bookings?bookingId[$ne]=678`
85-
As a result, an attacker managed to delete another user booking.
82+
Attacker intercepted the request and changed `bookingId` query string parameter
83+
as below:
84+
85+
```
86+
DELETE /api/bookings?bookingId[$ne]=678
87+
```
88+
89+
As a result, the attacker managed to delete another user booking.
8690

8791
## How To Prevent
8892

0 commit comments

Comments
 (0)