muqeetkhan20 / JuneSanity

0 stars 0 forks source link

ABAC_Level1 on POST:/api/v1/users/team-sign-up #2077

Open qauser21 opened 3 years ago

qauser21 commented 3 years ago

Title: ABAC_Level1 Vulnerability on POST:/api/v1/users/team-sign-up Project: Sanity 7th July 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 1 (ABAC) ( 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 1' identifies top-level/non-dependent resource/data/record 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_Level1 Severity: High API Endpoint: http://95.217.118.53:8080/api/v1/users/team-sign-up Environment: Master Playbook: ApiV1UsersTeamSignUpPostUseraCreateUsersUserbDisallowAbac Researcher: [apisec Bot]

QUICK TIPS

Suggestion: Add access-control checks on incoming requests against all data calls. Effort Estimate: 2.0 Hrs Wire Logs: 00:42:31 [D] [ UCUAIAbac] : Endpoint [http://95.217.118.53:8080/api/v1/users/enterprise-sign-up] 00:42:31 [D] [ UCUAIAbac] : Method [POST] 00:42:31 [D] [ UCUAIAbac] : Authorization [UserA] 00:42:31 [D] [ UCUAIAbac] : Request headers [[Content-Type:"application/json", Accept:"application/json", Authorization=[**]}] 00:42:31 [D] [ UCUAIAbac] : Request [{ "accountNonExpired" : false, "accountNonLocked" : false, "company" : "Mertz and Sons", "createdBy" : "", "createdDate" : "", "credentialsNonExpired" : false, "email" : "bernhard.douglas@apisec.ai", "enabled" : false, "id" : "", "inactive" : false, "jobTitle" : "Regional Sales Technician", "location" : "tlp0ebY7", "modifiedBy" : "", "modifiedDate" : "", "name" : "tlp0ebY7", "password" : "M2WMfYAIVFD*", "privileges" : [ "tlp0ebY7" ], "username" : "trinity.goyette", "version" : "" }] 00:42:31 [D] [ UCUAIAbac] : Status code [200] 00:42:31 [D] [ UCUAIAbac] : 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=YjBiOGFiOTUtNzZkNC00ZThlLTllMzItMmRkZGVlOGIyOTYy; Path=/; HttpOnly", Content-Type:"application/json;charset=UTF-8", Transfer-Encoding:"chunked", Date:"Fri, 30 Jul 2021 00:42:31 GMT"]] 00:42:31 [D] [ UCUAIAbac] : Response [{ "requestId" : "None", "requestTime" : "2021-07-30T00:42:31.326+0000", "errors" : true, "messages" : [ { "type" : "ERROR", "key" : "", "value" : "Org name [Mertz and Sons] exists." } ], "data" : false, "totalPages" : 0, "totalElements" : 0 }] 00:42:31 [D] [ UCUAIAbac] : Response time [1144] 00:42:31 [D] [ UCUAIAbac] : Response size [208] 00:42:31 [I] [ UCUAIAbac] : Assertion [@StatusCode == 200 OR @StatusCode == 201 OR @Response.errors != true] resolved-to [200 == 200 OR 200 == 201 OR true != true] result [Passed] 00:42:31 [D] [UCUAIAHeaders] : 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=YjBiOGFiOTUtNzZkNC00ZThlLTllMzItMmRkZGVlOGIyOTYy; Path=/; HttpOnly", Content-Type:"application/json;charset=UTF-8", Transfer-Encoding:"chunked", Date:"Fri, 30 Jul 2021 00:42:31 GMT"]] 00:42:31 [D] [UCUAIAHeaders] : 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=YjBiOGFiOTUtNzZkNC00ZThlLTllMzItMmRkZGVlOGIyOTYy; Path=/; HttpOnly", Content-Type:"application/json;charset=UTF-8", Transfer-Encoding:"chunked", Date:"Fri, 30 Jul 2021 00:42:31 GMT"]] 00:42:31 [D] [ UCUAIA]] : 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=YjBiOGFiOTUtNzZkNC00ZThlLTllMzItMmRkZGVlOGIyOTYy; Path=/; HttpOnly", Content-Type:"application/json;charset=UTF-8", Transfer-Encoding:"chunked", Date:"Fri, 30 Jul 2021 00:42:31 GMT"]] 00:42:31 [D] [ UCUAIA]] : 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=YjBiOGFiOTUtNzZkNC00ZThlLTllMzItMmRkZGVlOGIyOTYy; Path=/; HttpOnly", Content-Type:"application/json;charset=UTF-8", Transfer-Encoding:"chunked", Date:"Fri, 30 Jul 2021 00:42:31 GMT"]] 00:42:32 [D] [AVUTSUPUCUUDAbac] : Endpoint [http://95.217.118.53:8080/api/v1/users/team-sign-up] 00:42:32 [D] [AVUTSUPUCUUDAbac] : Method [POST] 00:42:32 [D] [AVUTSUPUCUUDAbac] : Authorization [UserB] 00:42:32 [D] [AVUTSUPUCUUDAbac] : Request headers [[Accept:"application/json", Content-Type:"application/json", Authorization=[**]}] 00:42:32 [D] [AVUTSUPUCUUDAbac] : Request [{ "accountNonExpired" : false, "accountNonLocked" : false, "company" : "Kovacek LLC", "createdBy" : "", "createdDate" : "", "credentialsNonExpired" : false, "email" : "isadore.marks@apisec.ai", "enabled" : false, "id" : "None", "inactive" : false, "jobTitle" : "Product Facilitator", "location" : "EgFJTOjX", "modifiedBy" : "", "modifiedDate" : "", "name" : "EgFJTOjX", "password" : "axbs3fhTJTC=", "privileges" : [ "EgFJTOjX" ], "username" : "wilbert.abernathy", "version" : "" }] 00:42:32 [D] [AVUTSUPUCUUDAbac] : Status code [200] 00:42:32 [D] [AVUTSUPUCUUDAbac] : 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=ZDllZWZlZTUtODFkMC00MTg3LWE0ZTktYzRjMDQ0YWY3YWIw; Path=/; HttpOnly", Content-Type:"application/json;charset=UTF-8", Transfer-Encoding:"chunked", Date:"Fri, 30 Jul 2021 00:42:32 GMT"]] 00:42:32 [D] [AVUTSUPUCUUDAbac] : Response [{ "requestId" : "None", "requestTime" : "2021-07-30T00:42:32.606+0000", "errors" : false, "messages" : [ { "type" : "INFO", "key" : "", "value" : "Sign-up successful!" } ], "data" : true, "totalPages" : 0, "totalElements" : 0 }] 00:42:32 [D] [AVUTSUPUCUUDAbac] : Response time [930] 00:42:32 [D] [AVUTSUPUCUUDAbac] : Response size [193] 00:42:32 [E] [AVUTSUPUCUUDAbac] : 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]

IMPORTANT LINKS

Vulnerability Details: https://cloud.fxlabs.io/#/app/projects/8a8093567a8012b6017a803bf31114fd/dashboard/8a8093d27aec646c017af4dcdd8147bd/details

Project: https://cloud.fxlabs.io/#/app/projects/8a8093567a8012b6017a803bf31114fd/allScans

Environment: https://cloud.fxlabs.io/#/app/projects/8a8093567a8012b6017a803bf31114fd/environments/8a8093567a8012b6017a803bf3181500/edit

Scan Dashboard: https://cloud.fxlabs.io/#/app/projects/8a8093567a8012b6017a803bf31114fd/profiles/8a8093567a8012b6017a803c070d16cb/runs/8a8093d27aec646c017af4dc268e4689

Playbook: https://cloud.fxlabs.io/#/app/projects/8a8093567a8012b6017a803bf31114fd/playbooks/ApiV1UsersTeamSignUpPostUseraCreateUsersUserbDisallowAbac

Coverage: https://cloud.fxlabs.io/#/app/projects/8a8093567a8012b6017a803bf31114fd/categories

Code Sample: https://cloud.fxlabs.io/#/app/projects/8a8093567a8012b6017a803bf31114fd/dashboard/8a8093d27aec646c017af4dcdd8147bd/codesamples

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

--- apisec Bot ---