You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(a3:2019): move Filter Manipulation to a dedicated category
* remove "Filter Manipulation" references from A3:2019
* create a candidate "A11:2019 Filter Manipulation" category
* improve Fitler Manipulation "Is the API Vulnerable?" and
"How to Prevent" sections
| API Specific : Exploitability **3**| Prevalence **2** : Detectability **2**| Technical **2** : Business Specific |
7
-
| Exploitation of excessive data exposure is simple, and is usually done by using different clients while sniffing the traffic they produce to analyze the API responses and look for sensitive data exposure that should not be returned to the user. | APIs rely on clients to perform the data filtering. Since APIs are used as data sources, sometimes developers try to implement them in a generic way without thinking about the sensitivity of the exposed data. Automatic tools usually can’t detect this type of vulnerability because it’s hard to differentiate between legitimate data returned from the API and sensitive data that should not be returned without a deep understanding of the application. | Excessive Data Exposure commonly leads to exposure of sensitive data. |
7
+
| Exploitation of Excessive Data Exposure is simple, and is usually done by sniffing the traffic to analyze the API responses looking for sensitive data exposure that should not be returned to the user. | APIs rely on clients to perform the data filtering. Since APIs are used as data sources, sometimes developers try to implement them in a generic way without thinking about the sensitivity of the exposed data. Automatic tools usually can’t detect this type of vulnerability because it’s hard to differentiate between legitimate data returned from the API and sensitive data that should not be returned without a deep understanding of the application. | Excessive Data Exposure commonly leads to exposure of sensitive data. |
8
8
9
9
## Is the API Vulnerable?
10
10
11
-
There are two types of Excessive Data Exposure:
12
-
13
-
***Client Side Data Filtering**: The API returns sensitive data to the client
14
-
by design. This data is usually filtered on the client side before being
15
-
presented to the user. An attacker can easily sniff the traffic and see the
16
-
sensitive data.
17
-
***Filter Manipulation**: the API performs data filtering in an unsafe manner
18
-
based on filters from the client. An attacker can send malicious filters
19
-
causing the API to return sensitive data they should not be exposed to.
11
+
The API returns sensitive data to the client by design. This data is usually
12
+
filtered on the client side before being presented to the user. An attacker can
13
+
easily sniff the traffic and see the sensitive data.
20
14
21
15
## Example Attack Scenarios
22
16
@@ -29,24 +23,18 @@ comment’s author, is also returned. The endpoint implementation uses a generic
29
23
`toJSON()` method on the `User` model, which contains PII, to serialize the
30
24
object.
31
25
32
-
### Scenario #2
33
-
34
-
An open source team chat solution provides the endpoint `/api/v1/users.list`
35
-
which supports two parameters: `query` and `fields`. Using a regular user
36
-
account and manipulating both parameters an attacker can enumerate admin
37
-
accounts, exposing sensitive information such as the password reset token:
| API Specific : Exploitability **3**| Prevalence **2** : Detectability **2**| Technical **2** : Business Specific |
7
+
| Exploitation of Filter Manipulation is usually done by using different clients while sniffing the traffic they produce to analyze the API responses. API requests are then replayed with common values for each filter (e.g. replacing `{"role": "user"}` by `{"role":"admin"}`) | APIs rely on clients to perform the data filtering. Since APIs are used as data sources, sometimes developers try to implement them in a generic way leaving the door open to unauthorized data access through filter manipulation. | Filter Manipulation usually leads to sensitive data exposure. |
8
+
9
+
## Is the API Vulnerable?
10
+
11
+
The API performs data filtering in an unsafe manner based on filters from the
12
+
client. An attacker can send malicious filters causing the API to return
13
+
sensitive data they should not be exposed to.
14
+
15
+
The API might be vulnerable if:
16
+
17
+
* Accepts any object property as filter (unless this is a business
18
+
requirement).
19
+
* Does not maintain a whitelist of allowed values for each filter.
20
+
* Accepts wildcards (e.g. `{"role":"*"}`) as filter.
21
+
* API clients are allowed to select what object properties should be included in
22
+
the API server response.
23
+
24
+
## Example Attack Scenarios
25
+
26
+
### Scenario #1
27
+
28
+
An open source team chat solution provides the endpoint `/api/v1/users.list`
29
+
which supports two parameters: `query` and `fields`. Using a regular user
30
+
account and manipulating the `query` parameter an attacker can enumerate admin
31
+
accounts:
32
+
33
+
```
34
+
GET /api/v1/users.list?query={“roles”:{$in:“admin”}}&fields={“username”:1”, “email.0”:1}
35
+
```
36
+
37
+
### Scenario #2
38
+
39
+
An open source team chat solution provides the endpoint `/api/v1/users.list`
40
+
which supports two parameters: `query` and `fields`. Using a regular user
41
+
account and manipulating the `fields` parameters an attacker can expose
42
+
sensitive information such as password reset tokens:
43
+
44
+
```
45
+
GET /api/v1/users.list?query={“roles”:“user”}&fields={“services.password.reset”:1, “username”:1”, “email.0”:1}
46
+
```
47
+
48
+
Via password reset, the attacker can takeover other users accounts.
49
+
50
+
## How To Prevent
51
+
52
+
* Be careful when performing data filtering based on filters from the client.
53
+
* Validate that API client is authorized to filter data based on given object
54
+
properties.
55
+
* Whenever possible validate given filter values against a whitelist of allowed
56
+
values.
57
+
* Avoid using wildcards (e.g. `{"role":"*"}`) as data filter
58
+
* Whenever the client should be able to select what object properties should be
59
+
included in the API server response, keep a whitelist of such allowed object
0 commit comments