File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,30 @@ vulnerable firmware:
60
60
$ curl -k "https://${deviceIP}:4567/api/CONFIG/restore" -F 'appid=$(/etc/pod/power_down.sh)'
61
61
```
62
62
63
+ ### Scenario #3
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`
70
+
71
+ On server side, application uses the following function to handle a request:
72
+
73
+ ```
74
+ router.delete('/bookings', async function (req, res, next) {
75
+ try {
76
+ const deletedBooking = await Bookings.findOneAndRemove({'_ id' : req.query.bookingId});
77
+ res.status(200);
78
+ } catch (err) {
79
+ res.status(400).json({error: 'Unexpected error occured while processing a request'});
80
+ };
81
+ ```
82
+
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.
86
+
63
87
## How To Prevent
64
88
65
89
Preventing injection requires keeping data separate from commands and queries.
You can’t perform that action at this time.
0 commit comments