Skip to content

Commit 452ac2e

Browse files
committed
Merge branch 'section/improper-data-filtering' into release/alpha
2 parents baba0db + 0f93a91 commit 452ac2e

File tree

1 file changed

+28
-12
lines changed

1 file changed

+28
-12
lines changed

2019/en/0xa3-improper-data-filtering.md

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,49 @@ A3:2019 Improper Data Filtering
22
===============================
33

44
| Threat agents/Attack vectors | Security Weakness | Impacts |
5-
| -- | -- | -- |
6-
| Access Lvl : Exploitability ? | Prevalence ? : Detectability ? | Technical ? : Business |
7-
| Since API are used as data sources, many times while writing the APIs developers try to implement them in a very generic way, without thinking about the sensitivity of the exposed data. They rely on clients to perform the data filtering before showing it to the user. | | Frequently sensitive object properties are exposed such as those holding PII protected by law or regulation (e.g. GDPR), authentication data or meaningful resources relationships. |
5+
| - | - | - |
6+
| API Specific : Exploitability **3** | Prevalence **2** : Detectability **2** | Technical **2** : Business Specific |
7+
| Exploitation of improper data filtering 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. | Improper Data Filtering commonly leads to exposure of sensitive data. |
88

99
## Is the API Vulnerable?
1010

11+
There are two types of Improper Data Filtering:
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.
20+
1121
## Example Attack Scenarios
1222

1323
### Scenario #1
1424

15-
The mobile team uses the `/api/articles/{articleId}/comments/{commendId}`
16-
endpoint in the articles view to render some comments metadata. Sniffing the
17-
mobile app traffic an attacker finds out that other sensitive data is also
18-
returned. The endpoint implementation uses a generic `toJSON()` method on the
19-
`User` model to serialize the object.
25+
The mobile team uses the `/api/articles/{articleId}/comments/{commentId}`
26+
endpoint in the articles view to render comments metadata. Sniffing the mobile
27+
application traffic an attacker finds out that other sensitive data related to
28+
comment’s author, is also returned. The endpoint implementation uses a generic
29+
`toJSON()` method on the `User` model, which contains PII, to serialize the
30+
object.
2031

2132
### Scenario #2
2233

2334
An open source team chat solution provides the endpoint `/api/v1/users.list`
2435
which supports two parameters: `query` and `fields`. Using a regular user
25-
account and manipulating both parameters an attacker can enumerate `admin`
26-
accounts, exposing sensitive information such as the password reset token: `GET
27-
/api/v1/users.list?query={“roles”:{$in:“admin”}}&fields={“services.password.reset”:1, “username”:1”, “email.0”:1}`.
28-
Via password reset, the attacker can takeover one of the `admin` accounts.
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.
2940

3041
## How To Prevent
3142

43+
* Never rely on the client side to perform sensitive data filtering.
44+
* Review the responses from the API to make sure they contain only legitimate
45+
data.
46+
* Be careful when performing data filtering based on filters from the client.
47+
3248
## References
3349

3450
### OWASP

0 commit comments

Comments
 (0)