Skip to content

Access service of other user #9

@JNKielmann

Description

@JNKielmann

Hi all,

Lately we have been doing some further testing of contaxy and I noticed a bug that allows a user to access any service regardless of permissions.
Steps to reproduce:

  • Login as user A (id 6i2jix6d17pg61vun97kydah2)
  • Start a service (e.g. ealen/echo-server) in the private user home project. It is accessible via:
    /projects/6i2jix6d17pg61vun97kydah2/services/ctxy-p-6i2jix6d17pg61vun97kydah2-s-echo/access/80
  • Login as user B (id 9xz28racfobhlrzqigcg18pg4)
  • Access the service by modifying the url above to point to a project that the user has access to:
    /projects/9xz28racfobhlrzqigcg18pg4/services/ctxy-p-6i2jix6d17pg61vun97kydah2-s-echo/access/80
    This allows user B to access the service of user A.

I think the issue is in the nginx config (https://github.com/ml-tooling/contaxy/blob/main/docker/nginx/nginx.conf#L166). By modifying the url to point to the private project of User B, the token verification for the following permission is made "/projects/9xz28racfobhlrzqigcg18pg4/services/ctxy-p-6i2jix6d17pg61vun97kydah2-s-echo/access/80#read". This check succeeds as User B has access to the project and therefore access to all its services. However, it is not checked if the service being accessed is actually part of that project.
As a potential fix of the nginx config we could extract the project id from the service name (everything between -p- and -s-) and use that for the permission check or check that it is the same as the project id in the URL.

What do you think?

Thanks,
Jan

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions