Skip to content

Commit 71ecbc2

Browse files
committed
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
1 parent 3e805b3 commit 71ecbc2

File tree

2 files changed

+74
-20
lines changed

2 files changed

+74
-20
lines changed

2019/en/src/0xa3-excessive-data-exposure.md

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,13 @@ A3:2019 Excessive Data Exposure
44
| Threat agents/Attack vectors | Security Weakness | Impacts |
55
| - | - | - |
66
| 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. |
88

99
## Is the API Vulnerable?
1010

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.
2014

2115
## Example Attack Scenarios
2216

@@ -29,24 +23,18 @@ comment’s author, is also returned. The endpoint implementation uses a generic
2923
`toJSON()` method on the `User` model, which contains PII, to serialize the
3024
object.
3125

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:
38-
`GET /api/v1/users.list?query={“roles”:{$in:“admin”}}&fields={“services.password.reset”:1, “username”:1”, “email.0”:1}`.
39-
Via password reset, the attacker can takeover one of the admin accounts.
40-
4126
## How To Prevent
4227

4328
* Never rely on the client side to perform sensitive data filtering.
4429
* Review the responses from the API to make sure they contain only legitimate
4530
data.
46-
* Be careful when performing data filtering based on filters from the client.
4731

4832
## References
4933

5034
### OWASP
5135

5236
### External
37+
38+
* [CWE-213: Intentional Information Exposure][1]
39+
40+
[1]: https://cwe.mitre.org/data/definitions/213.html
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
A11:2019 Filter Manipulation
2+
============================
3+
4+
| Threat agents/Attack vectors | Security Weakness | Impacts |
5+
| - | - | - |
6+
| 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
60+
properties.
61+
62+
## References
63+
64+
### OWASP
65+
66+
### External

0 commit comments

Comments
 (0)