Inherited group member and Direct shared group member can share the group with other members contrary to documentation

Please read the process on how to fix security issues before starting to work on the issue. Vulnerabilities must be fixed in a security mirror.

HackerOne report #2044962 by theluci on 2023-06-30, assigned to @kmorrison1:

Report | Attachments | How To Reproduce

Report

Hello,
I stumbled upon this bug.
I’m not sure whether this is a documentation update or a security fix, regardless I thought it should be reported.

Background

Gitlab provides various types of memberships,

1july-1.png

For Direct shared membership, one may use Invite a group option,

30jun-2.png

In the above example, Direct members of My-other-group are Direct shared members of a-new-group.

Vulnerability

According to docs, Inherited group member and Direct shared group member cannot share the group with other members.

1july-2.png

That is, a member that has Inherited membership or Direct shared membership in a group should not be able to invite new members to the group.

However, the above is not enforced.

Steps to reproduce

  1. attacker creates a group attacker-group and adds victim as guest.
  2. victim creates a group victim-group.
  3. victim goes to https://gitlab.com/groups/<victim-group>/-/group_members, clicks on Invite a group and invite attacker-group as owner.

attacker is now a Direct shared group member of victim-group.

  1. attacker goes to https://gitlab.com/groups/<victim-group>/-/group_members, clicks on Invite members and invite a user.

attacker is able to share the group with other members contrary to documentation.

Note:

Above I’ve only demonstrated the attack for Direct shared group members but it is also possible with Inherited membership.

Output of checks

This bug happens on GitLab.com (Probably on instance too).

Impact

Inherited group member and Direct shared group member can share the group with other members contrary to documentation.

Attachments

Warning: Attachments received through HackerOne, please exercise caution!

How To Reproduce

Please add reproducibility information to this section: