qaentadmin123 / RAWURLsPublic

0 stars 0 forks source link

ABAC_Level2 on PUT:/api/v1/orgs/{id} #570

Open FidaUrRahman opened 2 years ago

FidaUrRahman commented 2 years ago

Title: ABAC_Level2 Vulnerability on PUT:/api/v1/orgs/{id} Project: Bismillah Description: The ABAC exploit allows an attacker to read, modify, delete, add and perform actions on customer/un-authorized data.

Assertion Name: Attribute Based Access Control 2 (ABAC 2) ( 1 )

Overview: Access Control (or Authorization) is the process of granting or denying specific requests from a user, program, or process. Access control also involves the act of granting and revoking those privileges. Attribute Based Access Control (ABAC) will grant or deny user requests based on arbitrary attributes of the user and arbitrary attributes of the object, and environment conditions that may be globally recognized and more relevant to the policies at hand.

'Attribute-based-access-control 2' identifies all types of top-level/non-dependent resource/data/record vulnerabilities. e.g. Accounts of type Savings, Checking, & Investment etc. making sure there are no vulnerabilities across all of these types of resources and not just one. ABAC scanning identifies data/resource leak/attack vulnerabilities. Looks for private user/account data being illegally read, written, updated, deleted or operated by other users or tenants or accounts.

This scanner requires a private-account/user to create private data/resources e.g. UserA. And it also requires other users who shouldn't have any access to UserA's data like UserB, UserC, & UserD based on your App multi-tenancy model. e.g. UserA can be a user from tenant/org-a and UserB can be a user in tenant-b and UserC can be a user in tenant-c with admin privileges.

APIs tend to expose endpoints that handle object identifiers, creating a wide attack surface Level Access Control issue. Object-level authorization checks should be considered in every function that accesses a data source using input from the user.

Severity: OWASP 2019 API Top 10 ranks ABAC vulnerabilities at Top 1 position and is named Broken Object Level Authorization. ( 2 )

Vulnerability Impact: With flawed or broken ABAC security control policy in place, The following are some of the consequences.

Exploitation: Attackers can exploit API endpoints that are vulnerable to broken object level authorization by manipulating the ID of an object that is sent within 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.

Remediation: The following techniques may be checked for ensuring RBAC is in place ( 2 ) ( 3 ) ( 4 ).
References:
  1. Enforce Access Controls - https://owasp-top-10-proactive-controls-2018.readthedocs.io/en/latest/c7-enforce-access-controls.html
  2. OWASP 2019 API Top 10 - https://github.com/OWASP/API-Security/raw/master/2019/en/dist/owasp-api-security-top-10.pdf
  3. OWASP Access Control Cheat Sheet - https://cheatsheetseries.owasp.org/cheatsheets/Access_Control_Cheat_Sheet.html
  4. OWASP REST Security Cheat Sheet - https://cheatsheetseries.owasp.org/cheatsheets/REST_Security_Cheat_Sheet.html

Risk: ABAC_Level2 Severity: High API Endpoint: http://netbanking.apisec.ai:8080/api/v1/orgs/8a80812080b952900180ff3f4b5b1117 Environment: Master_github Playbook: ApiV1OrgsIdPutUseraCreateOrgorgplanbasicUserbDisallowAbact2 Researcher: [apisec Bot]

QUICK TIPS

Suggestion: Add access-control checks on incoming requests against all data calls. Effort Estimate: 4.0 Hrs Wire Logs: 07:22:59 [D] [ OOBCUAI2] : Endpoint [http://netbanking.apisec.ai:8080/api/v1/orgs] 07:22:59 [D] [ OOBCUAI2] : Method [POST] 07:22:59 [D] [ OOBCUAI2] : Authorization [UserA] 07:22:59 [D] [ OOBCUAI2] : Request headers [[Content-Type:"application/json", Accept:"application/json", Authorization=[**]]] 07:22:59 [D] [ OOBCUAI2] : Request [{ "billingEmail" : "watson.rohan@apisec.ai", "company" : "Gottlieb, Gottlieb and Gottlieb", "createdBy" : "", "createdDate" : "", "description" : "60aZdisV", "id" : "", "inactive" : false, "location" : "60aZdisV", "modifiedBy" : "", "modifiedDate" : "", "name" : "60aZdisV", "orgPlan" : "BASIC", "orgType" : "PERSONAL", "version" : "" }] 07:22:59 [D] [ OOBCUAI2] : Status code [200] 07:22:59 [D] [ OOBCUAI2] : Response headers [[X-Content-Type-Options:"nosniff", X-XSS-Protection:"1; mode=block", Cache-Control:"no-cache, no-store, max-age=0, must-revalidate", Pragma:"no-cache", Expires:"0", X-Frame-Options:"DENY", Set-Cookie:"SESSION=N2VkNzg2NjctNTAyYi00Yjc1LTk5YzQtNGU4YTFkNGFlZTAx; Path=/; HttpOnly", Content-Type:"application/json;charset=UTF-8", Transfer-Encoding:"chunked", Date:"Thu, 26 May 2022 07:22:59 GMT"]] 07:22:59 [D] [ OOBCUAI2] : Response [{ "requestId" : "None", "requestTime" : "2022-05-26T07:22:59.804+0000", "errors" : false, "messages" : [ ], "data" : { "id" : "8a80812080b952900180ff3f4b5b1117", "createdBy" : "8a80811e8091b6ba018091b9e037000c", "createdDate" : "2022-05-26T07:22:59.803+0000", "modifiedBy" : "8a80811e8091b6ba018091b9e037000c", "modifiedDate" : "2022-05-26T07:22:59.803+0000", "version" : null, "inactive" : false, "name" : "60aZdisV", "description" : "60aZdisV", "orgType" : "ENTERPRISE", "billingEmail" : "watson.rohan@apisec.ai", "company" : "Gottlieb, Gottlieb and Gottlieb", "location" : "60aZdisV", "orgPlan" : "ENTERPRISE" }, "totalPages" : 0, "totalElements" : 0 }] 07:22:59 [D] [ OOBCUAI2] : Response time [858] 07:22:59 [D] [ OOBCUAI2] : Response size [589] 07:22:59 [I] [ OOBCUAI2] : Assertion [@StatusCode == 200 OR @StatusCode == 201 OR @Response.errors != true] resolved-to [200 == 200 OR 200 == 201 OR false != true] result [Passed] 07:22:59 [D] [OOBCUAIAHeaders] : Headers [[X-Content-Type-Options:"nosniff", X-XSS-Protection:"1; mode=block", Cache-Control:"no-cache, no-store, max-age=0, must-revalidate", Pragma:"no-cache", Expires:"0", X-Frame-Options:"DENY", Set-Cookie:"SESSION=N2VkNzg2NjctNTAyYi00Yjc1LTk5YzQtNGU4YTFkNGFlZTAx; Path=/; HttpOnly", Content-Type:"application/json;charset=UTF-8", Transfer-Encoding:"chunked", Date:"Thu, 26 May 2022 07:22:59 GMT"]] 07:22:59 [D] [OOBCUAIAHeaders] : Headers [[X-Content-Type-Options:"nosniff", X-XSS-Protection:"1; mode=block", Cache-Control:"no-cache, no-store, max-age=0, must-revalidate", Pragma:"no-cache", Expires:"0", X-Frame-Options:"DENY", Set-Cookie:"SESSION=N2VkNzg2NjctNTAyYi00Yjc1LTk5YzQtNGU4YTFkNGFlZTAx; Path=/; HttpOnly", Content-Type:"application/json;charset=UTF-8", Transfer-Encoding:"chunked", Date:"Thu, 26 May 2022 07:22:59 GMT"]] 07:22:59 [D] [ OOBCUAIA]] : Headers [[X-Content-Type-Options:"nosniff", X-XSS-Protection:"1; mode=block", Cache-Control:"no-cache, no-store, max-age=0, must-revalidate", Pragma:"no-cache", Expires:"0", X-Frame-Options:"DENY", Set-Cookie:"SESSION=N2VkNzg2NjctNTAyYi00Yjc1LTk5YzQtNGU4YTFkNGFlZTAx; Path=/; HttpOnly", Content-Type:"application/json;charset=UTF-8", Transfer-Encoding:"chunked", Date:"Thu, 26 May 2022 07:22:59 GMT"]] 07:22:59 [D] [ OOBCUAIA]] : Headers [[X-Content-Type-Options:"nosniff", X-XSS-Protection:"1; mode=block", Cache-Control:"no-cache, no-store, max-age=0, must-revalidate", Pragma:"no-cache", Expires:"0", X-Frame-Options:"DENY", Set-Cookie:"SESSION=N2VkNzg2NjctNTAyYi00Yjc1LTk5YzQtNGU4YTFkNGFlZTAx; Path=/; HttpOnly", Content-Type:"application/json;charset=UTF-8", Transfer-Encoding:"chunked", Date:"Thu, 26 May 2022 07:22:59 GMT"]] 07:23:00 [D] [AVOIPUCOUD2] : Endpoint [http://netbanking.apisec.ai:8080/api/v1/orgs/8a80812080b952900180ff3f4b5b1117] 07:23:00 [D] [AVOIPUCOUD2] : Method [PUT] 07:23:00 [D] [AVOIPUCOUD2] : Authorization [UserB] 07:23:00 [D] [AVOIPUCOUD2] : Request headers [[Accept:"application/json", Content-Type:"application/json", Authorization=[**]]] 07:23:00 [D] [AVOIPUCOUD2] : Request [{ "billingEmail" : "mina.mann@apisec.ai", "company" : "Mueller-Mueller", "createdBy" : "", "createdDate" : "", "description" : "e6uH9fp3", "id" : "8a80812080b952900180ff3f4b5b1117", "inactive" : false, "location" : "e6uH9fp3", "modifiedBy" : "", "modifiedDate" : "", "name" : "e6uH9fp3", "orgPlan" : "TEAM", "orgType" : "PERSONAL", "version" : "" }] 07:23:00 [D] [AVOIPUCOUD2] : Status code [200] 07:23:00 [D] [AVOIPUCOUD2] : Response headers [[X-Content-Type-Options:"nosniff", X-XSS-Protection:"1; mode=block", Cache-Control:"no-cache, no-store, max-age=0, must-revalidate", Pragma:"no-cache", Expires:"0", X-Frame-Options:"DENY", Set-Cookie:"SESSION=NDlhNzk5MWItZjRhNS00Y2NjLWFkNTktZDhhNmQ3MGJlZjdj; Path=/; HttpOnly", Content-Type:"application/json;charset=UTF-8", Transfer-Encoding:"chunked", Date:"Thu, 26 May 2022 07:23:00 GMT"]] 07:23:00 [D] [AVOIPUCOUD2] : Response [{ "requestId" : "None", "requestTime" : "2022-05-26T07:23:00.787+0000", "errors" : false, "messages" : [ ], "data" : { "id" : "8a80812080b952900180ff3f4b5b1117", "createdBy" : "", "createdDate" : null, "modifiedBy" : "8a80811e8091b6ba018091b9410f0000", "modifiedDate" : "2022-05-26T07:23:00.771+0000", "version" : null, "inactive" : false, "name" : "e6uH9fp3", "description" : "e6uH9fp3", "orgType" : "PERSONAL", "billingEmail" : "mina.mann@apisec.ai", "company" : "Mueller-Mueller", "location" : "e6uH9fp3", "orgPlan" : "TEAM" }, "totalPages" : 0, "totalElements" : 0 }] 07:23:00 [D] [AVOIPUCOUD2] : Response time [863] 07:23:00 [D] [AVOIPUCOUD2] : Response size [504] 07:23:00 [E] [AVOIPUCOUD2] : Assertion [@StatusCode == 401 OR @StatusCode == 403 OR @StatusCode == 404 OR @Response.errors == true] resolved-to [200 == 401 OR 200 == 403 OR 200 == 404 OR false == true] result [Failed] 07:23:01 [D] [ AVOIDOA2] : Endpoint [http://netbanking.apisec.ai:8080/api/v1/orgs/8a80812080b952900180ff3f4b5b1117] 07:23:01 [D] [ AVOIDOA2] : Method [DELETE] 07:23:01 [D] [ AVOIDOA2] : Authorization [UserA] 07:23:01 [D] [ AVOIDOA2] : Request headers [[Content-Type:"application/json", Accept:"application/json", Authorization=[**]]] 07:23:01 [D] [ AVOIDOA2] : Request [null] 07:23:01 [D] [ AVOIDOA2] : Status code [200] 07:23:01 [D] [ AVOIDOA2] : Response headers [[X-Content-Type-Options:"nosniff", X-XSS-Protection:"1; mode=block", Cache-Control:"no-cache, no-store, max-age=0, must-revalidate", Pragma:"no-cache", Expires:"0", X-Frame-Options:"DENY", Set-Cookie:"SESSION=NjQyNTUzYmUtYzVkOC00ZmEyLWIwYzUtYjVmNDY4NTA0OGI1; Path=/; HttpOnly", Content-Type:"application/json;charset=UTF-8", Transfer-Encoding:"chunked", Date:"Thu, 26 May 2022 07:23:00 GMT"]] 07:23:01 [D] [ AVOIDOA2] : Response [{ "requestId" : "None", "requestTime" : "2022-05-26T07:23:01.605+0000", "errors" : true, "messages" : [ { "type" : "ERROR", "key" : "", "value" : "Resource name or key already exists." } ], "data" : null, "totalPages" : 0, "totalElements" : 0 }] 07:23:01 [D] [ AVOIDOA2] : Response time [808] 07:23:01 [D] [ AVOIDOA2] : Response size [210] 07:23:01 [I] [AVOIPUCOUD2] : Assertion [@StatusCode == 200] resolved-to [200 == 200] result [Passed]

IMPORTANT LINKS

Vulnerability Details: https://20.120.71.252/#/app/projects/8a70803680faf14f0180ff0340040534/dashboard/8a70803680faf14f0180ff3f53c44a8a/details

Project: https://20.120.71.252/#/app/projects/8a70803680faf14f0180ff0340040534/allScans

Environment: https://20.120.71.252/#/app/projects/8a70803680faf14f0180ff0340040534/environments/8a70803680faf14f0180ff39a86e480c/edit

Scan Dashboard: https://20.120.71.252/#/app/projects/8a70803680faf14f0180ff0340040534/profiles/8a70803680faf14f0180ff39a883480e/runs/8a70803680faf14f0180ff3c15334811

Playbook: https://20.120.71.252/#/app/projects/8a70803680faf14f0180ff0340040534/playbooks/ApiV1OrgsIdPutUseraCreateOrgorgplanbasicUserbDisallowAbact2

Coverage: https://20.120.71.252/#/app/projects/8a70803680faf14f0180ff0340040534/categories

Code Sample: https://20.120.71.252/#/app/projects/8a70803680faf14f0180ff0340040534/dashboard/8a70803680faf14f0180ff3f53c44a8a/codesamples

PS: Please contact support@apisec.ai for apisec access and login issues.

--- apisec Bot ---