@@ -62,15 +62,14 @@ $ curl -k "https://${deviceIP}:4567/api/CONFIG/restore" -F 'appid=$(/etc/pod/pow
62
62
63
63
### Scenario #3
64
64
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`.
70
69
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 :
72
71
73
- ```
72
+ ```javascript
74
73
router.delete('/bookings', async function (req, res, next) {
75
74
try {
76
75
const deletedBooking = await Bookings.findOneAndRemove({'_id' : req.query.bookingId});
@@ -80,9 +79,14 @@ router.delete('/bookings', async function (req, res, next) {
80
79
};
81
80
```
82
81
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.
86
90
87
91
## How To Prevent
88
92
0 commit comments