intesar / NB-Sales

0 stars 0 forks source link

ABAC_Level1 on GET:/api/v1/branches/{id} #1589

Open intesar opened 3 years ago

intesar commented 3 years ago

Title: ABAC_Level1 Vulnerability on GET:/api/v1/branches/{id} Project: NetBanking API 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/branches/2c9280847452ae00017493da50c049d8 Environment: Master Playbook: ApiV1BranchesIdGetUseraCreateBranchUserbDisallowAbac Researcher: [apisec Bot] QUICK TIPS Suggestion: Add access-control checks on incoming requests against all data calls. Effort Estimate: 2.0 Wire Logs: 10:19:52 [D] [ BCUAIAbac] : URL [http://95.217.118.53:8080/api/v1/branches] 10:19:52 [D] [ BCUAIAbac] : Method [POST] 10:19:52 [D] [ BCUAIAbac] : Auth [UserA] 10:19:52 [D] [ BCUAIAbac] : Request [{ "access" : "i54OMmJb", "atmAtBranch" : "i54OMmJb", "branchMediatedServiceName" : "i54OMmJb", "branchName" : "i54OMmJb", "branchType" : "i54OMmJb", "createdBy" : "", "createdDate" : "", "customerSegment" : "i54OMmJb", "faxNumber" : "i54OMmJb", "id" : "", "inactive" : false, "modifiedBy" : "", "modifiedDate" : "", "version" : "" }] 10:19:52 [D] [ BCUAIAbac] : Request-Headers [{Content-Type=[application/json], Accept=[application/json], Authorization=[**********]}] 10:19:52 [D] [ BCUAIAbac] : Response [{ "requestId" : "None", "requestTime" : "2020-09-15T22:19:52.392+0000", "errors" : false, "messages" : [ ], "data" : { "id" : "2c9280847452ae00017493da50c049d8", "createdBy" : "2c928085730548680173054c9f720003", "createdDate" : "2020-09-15T22:19:52.384+0000", "modifiedBy" : "2c928085730548680173054c9f720003", "modifiedDate" : "2020-09-15T22:19:52.384+0000", "version" : null, "inactive" : false, "access" : "YNmyos1d", "atmAtBranch" : "YNmyos1d", "branchName" : "YNmyos1d", "branchMediatedServiceName" : "YNmyos1d", "branchType" : "YNmyos1d", "customerSegment" : "YNmyos1d", "faxNumber" : "YNmyos1d" }, "totalPages" : 0, "totalElements" : 0 }] 10:19:52 [D] [ BCUAIAbac] : 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=NTVlNDdhODgtYjA2YS00M2RhLThkNjktMTg1NDM4NTRhMWQz; Path=/; HttpOnly], Content-Type=[application/json;charset=UTF-8], Transfer-Encoding=[chunked], Date=[Tue, 15 Sep 2020 22:19:51 GMT]}] 10:19:52 [D] [ BCUAIAbac] : StatusCode [200] 10:19:52 [D] [ BCUAIAbac] : Time [1701] 10:19:52 [D] [ BCUAIAbac] : Size [578] 10:19:52 [I] [ BCUAIAbac] : Assertion [@StatusCode == 200 AND @Response.errors == false] resolved-to [200 == 200 AND false == false] result [Passed] 10:19:52 [D] [BCUAIAHeaders] : 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=NTVlNDdhODgtYjA2YS00M2RhLThkNjktMTg1NDM4NTRhMWQz; Path=/; HttpOnly], Content-Type=[application/json;charset=UTF-8], Transfer-Encoding=[chunked], Date=[Tue, 15 Sep 2020 22:19:51 GMT]}] 10:19:52 [D] [BCUAIAHeaders] : 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=NTVlNDdhODgtYjA2YS00M2RhLThkNjktMTg1NDM4NTRhMWQz; Path=/; HttpOnly], Content-Type=[application/json;charset=UTF-8], Transfer-Encoding=[chunked], Date=[Tue, 15 Sep 2020 22:19:51 GMT]}] 10:19:52 [D] [ BCUAIA]] : 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=NTVlNDdhODgtYjA2YS00M2RhLThkNjktMTg1NDM4NTRhMWQz; Path=/; HttpOnly], Content-Type=[application/json;charset=UTF-8], Transfer-Encoding=[chunked], Date=[Tue, 15 Sep 2020 22:19:51 GMT]}] 10:19:52 [D] [ BCUAIA]] : 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=NTVlNDdhODgtYjA2YS00M2RhLThkNjktMTg1NDM4NTRhMWQz; Path=/; HttpOnly], Content-Type=[application/json;charset=UTF-8], Transfer-Encoding=[chunked], Date=[Tue, 15 Sep 2020 22:19:51 GMT]}] 10:19:53 [D] [AVBIGUCBUDAbac] : URL [http://95.217.118.53:8080/api/v1/branches/2c9280847452ae00017493da50c049d8] 10:19:53 [D] [AVBIGUCBUDAbac] : Method [GET] 10:19:53 [D] [AVBIGUCBUDAbac] : Auth [UserB] 10:19:53 [D] [AVBIGUCBUDAbac] : Request [] 10:19:53 [D] [AVBIGUCBUDAbac] : Request-Headers [{Accept=[application/json], Content-Type=[application/json], Authorization=[**********]}] 10:19:53 [D] [AVBIGUCBUDAbac] : Response [{ "requestId" : "None", "requestTime" : "2020-09-15T22:19:52.999+0000", "errors" : false, "messages" : [ ], "data" : { "id" : "2c9280847452ae00017493da50c049d8", "createdBy" : "2c928085730548680173054c9f720003", "createdDate" : "2020-09-15T22:19:52.384+0000", "modifiedBy" : "2c928085730548680173054c9f720003", "modifiedDate" : "2020-09-15T22:19:52.384+0000", "version" : null, "inactive" : false, "access" : "YNmyos1d", "atmAtBranch" : "YNmyos1d", "branchName" : "YNmyos1d", "branchMediatedServiceName" : "YNmyos1d", "branchType" : "YNmyos1d", "customerSegment" : "YNmyos1d", "faxNumber" : "YNmyos1d" }, "totalPages" : 0, "totalElements" : 0 }] 10:19:53 [D] [AVBIGUCBUDAbac] : 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=ZjMxNzI3M2QtYjEzYS00MWNlLWI0ZjQtZWExOTBmOGYzYmMx; Path=/; HttpOnly], Content-Type=[application/json;charset=UTF-8], Transfer-Encoding=[chunked], Date=[Tue, 15 Sep 2020 22:19:53 GMT]}] 10:19:53 [D] [AVBIGUCBUDAbac] : StatusCode [200] 10:19:53 [D] [AVBIGUCBUDAbac] : Time [595] 10:19:53 [D] [AVBIGUCBUDAbac] : Size [578] 10:19:53 [E] [AVBIGUCBUDAbac] : Assertion [@StatusCode == 401 OR @StatusCode == 404 OR @Response.errors == true] resolved-to [200 == 401 OR 200 == 404 OR false == true] result [Failed] 10:19:53 [D] [AVBIDBAAbac] : URL [http://95.217.118.53:8080/api/v1/branches/2c9280847452ae00017493da50c049d8] 10:19:53 [D] [AVBIDBAAbac] : Method [DELETE] 10:19:53 [D] [AVBIDBAAbac] : Request [null] 10:19:53 [D] [AVBIDBAAbac] : Auth [UserA] 10:19:53 [D] [AVBIDBAAbac] : Request-Headers [{Content-Type=[application/json], Accept=[application/json], Authorization=[Basic dXNlcjFAbmV0YmFua2luZy5pbzphZG1pbjEyMyQ=]}] 10:19:53 [D] [AVBIDBAAbac] : Response [{ "requestId" : "None", "requestTime" : "2020-09-15T22:19:53.557+0000", "errors" : false, "messages" : [ ], "data" : null, "totalPages" : 0, "totalElements" : 0 }] 10:19:53 [D] [AVBIDBAAbac] : 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=ZDZkYWViMjYtMGNkMC00OGIwLWE1NjItYWQyNmQ1NjMxYTU3; Path=/; HttpOnly], Content-Type=[application/json;charset=UTF-8], Transfer-Encoding=[chunked], Date=[Tue, 15 Sep 2020 22:19:53 GMT]}] 10:19:53 [D] [AVBIDBAAbac] : StatusCode [200] 10:19:53 [D] [AVBIDBAAbac] : Time [555] 10:19:53 [D] [AVBIDBAAbac] : Size [139] 10:19:53 [I] [AVBIGUCBUDAbac] : Assertion [@StatusCode == 200] resolved-to [200 == 200] result [Passed] IMPORTANT LINKS Vulnerability Details: https://cloud.fxlabs.io/#/app/projects/8a8081766fc3e2a1016fc421d6e55a13/recommendations/8a8084a0748c80b3017493da575e7f83/details Project: https://cloud.fxlabs.io/#/app/projects/8a8081766fc3e2a1016fc421d6e55a13/jobs Environment: https://cloud.fxlabs.io/#/app/projects/8a8081766fc3e2a1016fc421d6e55a13/environments/8a8081766fc3e2a1016fc421d7155a15/edit Scan Dashboard: https://cloud.fxlabs.io/#/app/projects/8a8081766fc3e2a1016fc421d6e55a13/jobs/8a8081766fc3e2a1016fc4230f426628/runs/8a8084a0748c80b3017493da11287f2f Playbook: https://cloud.fxlabs.io/#/app/projects/8a8081766fc3e2a1016fc421d6e55a13/template/ApiV1BranchesIdGetUseraCreateBranchUserbDisallowAbac Coverage: https://cloud.fxlabs.io/#/app/projects/8a8081766fc3e2a1016fc421d6e55a13/configuration Code Sample: https://cloud.fxlabs.io/#/app/projects/8a8081766fc3e2a1016fc421d6e55a13/recommendations/8a8084a0748c80b3017493da575e7f83/codesamples PS: Please contact support@apisec.ai for apisec access and login issues. --- apisec Bot ---