Skip to content

Commit 14e6374

Browse files
committed
Merge branch 'section/object-level-access-control' into release/alpha
2 parents eef0edc + d0fc99b commit 14e6374

File tree

1 file changed

+45
-15
lines changed

1 file changed

+45
-15
lines changed

2019/en/0xa1-broken-object-level-access-control.md

Lines changed: 45 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,66 @@ A1:2019 Broken Object Level Access Control
22
==========================================
33

44
| Threat agents/Attack vectors | Security Weakness | Impacts |
5-
| -- | -- | -- |
6-
| Access Lvl : Exploitability ? | Prevalence ? : Detectability ? | Technical ? : Business |
7-
| | | |
5+
| - | - | - |
6+
| API Specific : Exploitability **3** | Prevalence **3** : Detectability **2** | Technical **3** : Business Specific |
7+
| Attackers can exploit API endpoints that are vulnerable to broken object access control by manipulating the ID of an object that is sent in the request. This may lead to unauthorized access to sensitive data. This issue is extremely common in API based applications because the server component usually does not fully track the client’s state, and instead relies more on parameters like object IDs, that are sent from the client to decide which objects to access. | This has been the most common and impactful attack on APIs. Authorization and access control mechanisms in modern applications are complex and wide-spread. Even if the application implements a proper infrastructure for authorization checks, developers might forget to use these checks before accessing a sensitive object. Access control detection is not typically amenable to automated static or dynamic testing. | Unauthorized access can result in data disclosure to unauthorized parties, data loss, or data manipulation. Unauthorized access to objects can also lead to full account takeover. |
88

99
## Is the API Vulnerable?
1010

11+
Object access control is a mechanism that is usually implemented at the code
12+
level to validate that one user can access only objects that they should have
13+
access to.
14+
15+
Every API endpoint that receives an ID of an object and performs any type of
16+
action on the object should implement object level access control checks. The
17+
checks should validate that the logged-in user does have access to perform the
18+
requested action on the requested object.
19+
20+
Failures in the mechanism typically leads to unauthorized information
21+
disclosure, modification or destruction of all data.
22+
1123
## Example Attack Scenarios
1224

1325
### Scenario #1
1426

15-
An e-commerce platform for online stores provides a listing page with some
16-
revenue charts about their hosted shops.
17-
Inspecting browser requests, an attacker identifies the endpoints used as data
18-
source for those charts and their pattern
19-
`/shops/{shopName}/revenue_data.json`. Using another API endpoint, the attacker
20-
gets the list of all hosted shops names. With a simple script to iterate over
21-
the names in the list, replacing `{shopName}` in the URL, the attacker got
22-
access to sales data of thousands of e-commerce stores.
27+
An e-commerce platform for online stores provides a listing page with the
28+
revenue charts for their hosted shops. Inspecting the browser requests, an
29+
attacker identifies the API endpoints used as a data source for those charts
30+
and their pattern `/shops/{shopName}/revenue_data.json`. Using another API
31+
endpoint, the attacker gets the list of all hosted shop names. With a simple
32+
script to iterate over the names in the list, replacing `{shopName}` in the URL,
33+
the attacker gains access to the sales data of thousands of e-commerce stores.
2334

2435
### Scenario #2
2536

26-
While monitoring a wearable network traffic, the following HTTP `PATCH` request
27-
got attacker’s attention due to the presence of a custom HTTP request header
28-
`X-User-Id: 54796`. Replacing the `X-User-Id` value by `54795`, the attacker got
29-
a successful HTTP response, being able to modify others' account data.
37+
While monitoring the network traffic of a wearable device, the following HTTP
38+
`PATCH` request get the attention of an attacker due to the presence of a custom
39+
HTTP request header `X-User-Id: 54796`. Replacing the `X-User-Id` value with
40+
`54795`, the attacker receives a successful HTTP response and is able to modify
41+
other user account data.
3042

3143
## How To Prevent
3244

45+
* Implement a proper access control mechanism that relies on the user policies
46+
and hierarchy.
47+
* Prefer not to use an ID that has been sent from the client, but instead use an
48+
ID that is stored in the session object when accessing a database record by
49+
the record ID.
50+
* Use an access control mechanism to check if the logged in user has access to
51+
perform the requested action on the record in every function that uses an
52+
input from the client to access a record in the database.
53+
* Prefer to use random and unpredictable values as GUIDs for records’ IDs.
54+
3355
## References
3456

3557
### OWASP
3658

3759
### External
60+
61+
* [CWE-284: Improper Access Control][1]
62+
* [CWE-285: Improper Authorization][2]
63+
* [CWE-639: Authorization Bypass Through User-Controlled Key][3]
64+
65+
[1]: https://cwe.mitre.org/data/definitions/284.html
66+
[2]: https://cwe.mitre.org/data/definitions/285.html
67+
[3]: https://cwe.mitre.org/data/definitions/639.html

0 commit comments

Comments
 (0)