Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RBAC] Issues detected when using RBAC #2579

Closed
AdriiiPRodri opened this issue Oct 30, 2020 · 3 comments
Closed

[RBAC] Issues detected when using RBAC #2579

AdriiiPRodri opened this issue Oct 30, 2020 · 3 comments
Assignees
Labels
type/bug Bug issue
Milestone

Comments

@AdriiiPRodri
Copy link

Hi team,

Recently we have had three problems using the APP with Wazuh version 4.0. The first of these problems is related to the dev-tools. The endpoint /security/users/me is not working properly. It always returns all system permissions. For example, in this screenshot we only have permission to see the agents that belong to the group US_WEST:
0

We see that the permissions have been correctly applied as only agent 002 belongs to this group. However, when we make a request with the endpoint /security/users/me all the permissions are returned to us:
1

Note: This error may occur with more security endpoints.

The second problem is related to the overview of the Wazuh APP. Despite having the permission to see the agents of the group US_WEST, we see that we have 0 agents. Investigating the requests that are made to obtain this information, we see that it is called the endpoint /agents/summary/status which returns a correct output taking into account our permissions: {active: 1, disconnected: 0, never_connected: 0, pending: 0, total: 1}
2

3

The third problem is related to the 'Agents' tab, when we click on it no agent appears. In order to obtain this information, the endpoint /agents/000/config/request/remote is used. However, our user does not have permissions on agent 000 as it does not belong to the US_WEST group. This causes users to always have to add agent 000 to the permissions.
4
5
6
7

These are the permissions we have used to perform these tests:
8
9
10

Regards

@AdriiiPRodri AdriiiPRodri added the type/bug Bug issue label Oct 30, 2020
@snaow snaow added this to the Sprint 119 milestone Nov 3, 2020
@frankeros frankeros self-assigned this Nov 3, 2020
@frankeros
Copy link
Contributor

Hi @AdriiiPRodri,

Regarding the issue about the query in Dev Tools GET /security/users/me is not taking into account the permissions as the query GET /agents is doing.

From the app, when the token is generated with run_as:

{ 
  method: 'POST',
  headers: { 'content-type': 'application/json' },
  auth: { username: 'wazuh-wui', password: 'wazuh-wui' },
  url: 'https://localhost:55000/security/user/authenticate/run_as',
  data: { 
     user_name: 'test',
     is_reserved: false,
     is_hidden: false,
     is_internal_user: true,
     user_requested_tenant: null,
     backend_roles: [],
     custom_attribute_names: [],
     tenants: { test: true, global_tenant: true },
     roles: [ 'admin', 'kibana_user', 'own_index' ] 
  } 
}

The token obtained is: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3YXp1aCIsImF1ZCI6IldhenVoIEFQSSBSRVNUIiwibmJmIjoxNjA0NTAzNDk0LCJleHAiOjE2MDQ1MDcwOTQsInN1YiI6IndhenVoLXd1aSIsInJ1bl9hcyI6dHJ1ZSwicmJhY19yb2xlcyI6WzEwMF0sInJiYWNfbW9kZSI6IndoaXRlIn0.JGDHDpuHLGDpmFqaxmB_mYC0-2VDu2PYp9_eCflFsAo
image

If we sent a curl with this token to the endpoint GET /security/users/me the user is still wazuh-wui
image

In conclusion, both queries are sent with the same token, so we think that maybe is the API who isn't taking into account the user permissions for the endpoint GET /security/users/me. However, the endpoint GET GET /security/users/me/polices is returning correctly, it's returning only the policies that the user is associated with.
image

Can you check this, please?

@AdriiiPRodri
Copy link
Author

Hi @frankeros,

We have been testing and it is correct, the endpoint /security/users/me does not return the correct permissions when the user has authenticated through an authorization context.

We have the fix ready and it will be merge as soon as possible. Thanks for the report.

@frankeros
Copy link
Contributor

frankeros commented Nov 5, 2020

Hi @AdriiiPRodri,
Thanks to you.
Regarding the other issues that you reported, I created the issue #6502, because we need some improvement in the enpodint /agents/summary/status to be able to skip the 000 agent.

@davidjiglesias davidjiglesias changed the title [RBAC] Issues detected with using RBAC [RBAC] Issues detected when using RBAC Nov 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Bug issue
Projects
None yet
Development

No branches or pull requests

4 participants