Skip to content
Access control Disclosed report Beginner

Guest users can create new test cases

A user with the Guest role could create test cases in a private project by changing the issue_type parameter from 'issue' to 'test_case' when submitting an issue creation request. This bypassed the intended permission that only Reporter or higher roles can create test cases.

maruthi12 Follow

Originally disclosed on HackerOne

Bounty$650 Medium 4.3 View original
  • Triaged in 2 days
  • Fixed in 4 months
  • Paid in 3 months
  • Disclosed after 6 months

Summary

According to the permission docs and test case docs , only user with a role Reporter or more is allowed to create a test case. This vulnerability allows, even Guest role users to create new test cases.

Steps to reproduce

  1. Consider a private project with Guest role user.

  2. Consider the API for creating an issue.

    The URL is https://gitlab.com/project_name/-/issues (POST).

    POST Data format for this is as follows:

    utf8=✓
    

authenticity_token= your_auth_token issue[title]=issue_title issue[description]=issue_description issue[confidential]=0 issue[issue_type]=issue issue[lock_version]=0

3. Now, in the parameter_set,  tamper with `issue[issue_type]` value and change it from `issue` to `test_case`.
4. Now, send the request.
5. A test case is now created. 

The test case can be viewed at https://gitlab.com/project_name/-/quality/test_cases

## Impact

Test Cases are important part of a project  as it helps product, quality and development teams to combine and Guest users should not be allowed to create it.

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

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 4 min read.

Context

GitLab projects have a feature called test cases, part of the quality management tooling. According to the permission documentation and the test case documentation that the researcher cites, creating a test case requires the Reporter role or higher within a project. A Guest is the lowest project role and is not supposed to be able to create test cases.

The report shows that a Guest can in fact create one, by abusing the endpoint that creates issues and changing a single parameter in the submitted form data. The result is a privilege escalation from Guest to an action reserved for Reporter and above.

Setup

The precondition is a private project with a user who holds the Guest role in that project. The researcher works through the web interface rather than a documented API: the request used is the one the browser sends when an issue is created from the project's issue page. No specific GitLab version, browser or tooling is named in the report.

Finding it

The starting point is the documented permission model. The permission docs and the test case docs both state that only a Reporter or above may create a test case. The issue creation request carries an issue_type field, and the report shows a Guest submitting it. The field is submitted by the client, and the report shows its value changed from issue to test_case. If the server trusts the submitted value without re-checking the caller's role against the resulting object type, a Guest who is allowed to create issues could ask for a different type of object to be created instead.

Exploitation

Step 1: establish the low-privileged position

Take a private project in which the attacking account has the Guest role. This is the role the whole attack is built around: it is enough to reach the issue creation form, but not enough, per the documentation, to create a test case.

Step 2: capture the issue creation request

The request that creates an issue is a POST to the project's issues path:

The body is form-encoded and has the following shape:

Text
utf8=✓
authenticity_token= your_auth_token
issue[title]=issue_title
issue[description]=issue_description
issue[confidential]=0
issue[issue_type]=issue
issue[lock_version]=0

The fields do the following:

  • utf8 is the usual Rails form marker.
  • authenticity_token is the CSRF token for the session, shown here as your_auth_token.
  • issue[title] and issue[description] are the content of the object being created.
  • issue[confidential] sets confidentiality, here 0.
  • issue[issue_type] selects the type of object, here issue.
  • issue[lock_version] is the optimistic locking field submitted with the form.

Step 3: tamper with the type

In the parameter set, change the value of issue[issue_type] from issue to test_case:

Everything else in the request stays as the browser sent it. The attacker is not adding a new endpoint or a new permission; they are only changing the value of a field the client already controls.

Step 4: send the request

Submit the modified request with the Guest session. The server accepts it.

Step 5: observe the result

A test case is created. It can be viewed at the project's test case listing:

Text
https://gitlab.com/project_name/-/quality/test_cases

The object exists despite the account never having held the Reporter role that the documentation requires for this action.

Root cause

The issue creation path accepts a client-supplied issue_type and acts on it, creating a test case when the value is test_case. The request succeeds even though the documentation reserves test case creation for Reporter and above; the report does not explain why. The report does not include the server-side code, so the exact location of the missing or misplaced check is not shown; the above is the behaviour the steps demonstrate.

Impact

A Guest in a private project can create test cases, an action reserved for Reporter and above. The researcher frames the impact around the role test cases play in a project: they are an important part of a project because they let product, quality and development teams combine their work, and Guest users should not be able to create them. The escalation is limited to this object type and to projects where the attacker already has Guest access; the report does not describe any further escalation, data disclosure or persistence beyond creating the test case.

Fix

Variants to test

  • Other values of the type field. Try any other object types the same form or endpoint accepts in issue_type, and check whether each one is created with Guest privileges. A positive result is an object appearing in the project that the documentation says needs a higher role.
  • Other forms with a type selector. Look for creation forms available to low-privileged roles that carry a field naming the kind of object to create, and swap the value for a type reserved for a higher role. A positive result is the higher-privileged object being created and listed.
  • Role boundary checks on sibling features. For each feature whose documentation states a minimum role, find the lowest-privileged form that reaches the same controller and see whether the role check follows the object type or the entry point. A positive result is an action succeeding below its documented role.

Hunting notes

This kind of bug hides where a single endpoint serves several object types and the type is chosen by the client. The signal during recon is a form field whose value names a class of object, combined with documentation that assigns different minimum roles to those classes. Comparing the permission table against the forms a Guest can actually submit is the cheapest way to find the gap: if a low role can reach a creation form, check every parameter that influences what gets created.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 10 min read.

What happened, in plain words

GitLab is a website where teams keep their software projects. Every project has people in it, and each person is given a role. A role is a label that says how much that person is allowed to do. GitLab has a feature called test cases, which the researcher describes as an important part of a project that helps product, quality and development teams combine their work.

GitLab's own documentation says that to create a test case you need a role called Reporter or something higher. A Guest is the lowest role in a project, so a Guest is not supposed to be able to create test cases.

The researcher found that a Guest can create one anyway. The trick is to use the ordinary form for creating an issue (a bug report or task in the project) and change one small value in what the browser sends. The server then creates a test case instead of an issue, even though the person was never allowed to create test cases.

This kind of bug is called privilege escalation: someone with low permissions manages to perform an action that is reserved for people with higher permissions.

Background you need first

Projects, roles and permissions

A GitLab project is a container for code, issues, and other work. People are added to a project with a role. The roles relevant here are Guest (the lowest) and Reporter (higher). Permissions are the individual actions a role is allowed to perform, such as "create an issue" or "create a test case". GitLab publishes a permission table in its documentation that lists which role can do what.

A private project is one that only its members can see. The whole scenario in this report happens inside a private project, with an account that has only the Guest role in it.

Issues and test cases

An issue is a written item in a project: a bug, a task, a feature request. A test case is a similar-looking written item, but it describes a check of expected behaviour. An issue is created through a form in the web interface; the report shows a test case appearing in the project's test case listing.

What an API and an HTTP request are

When you fill in a form in your browser and press a button, the browser sends a message to the server. That message is an HTTP request. The request has a method (the verb, such as POST, which means "create something"), a URL (the address it is sent to), and a body (the data you filled in). An API is simply the set of addresses and rules a server accepts requests on. You do not need special tools to see these requests: your browser's developer tools show them, and you can also resend a modified copy.

What a token is

A token is a short piece of text that proves who you are or that a form really came from the site. The authenticity_token in this report is a CSRF token. CSRF stands for cross-site request forgery: an attack where another website tries to make your browser submit a form on a site you are logged into. The token is a random value the server gave your browser earlier; the server checks it when the form arrives, so a request without the right token is rejected. Think of it as a stamped ticket that the server issued to your browser and expects to see again.

What form-encoded data is

When a browser submits a normal HTML form, it sends the fields as name=value pairs joined together. That format is called form-encoded. The names can contain square brackets, like issue[title], which is a convention for grouping fields: it tells the server that title belongs to the issue object.

The setup

The precondition is a private project with a user who holds the Guest role in that project. The researcher works through the web interface rather than a documented API: the request used is the one the browser sends when an issue is created from the project's issue page. No specific GitLab version, browser or tooling is named in the report.

Finding it

The starting point is the documented permission model. The permission docs and the test case docs both state that only a Reporter or above may create a test case. The issue creation request carries an issue_type field, and the report shows a Guest submitting it. The field is submitted by the client, and the report shows its value changed from issue to test_case. If the server trusts the submitted value without re-checking the caller's role against the resulting object type, a Guest who is allowed to create issues could ask for a different type of object to be created instead.

Exploitation, step by step

Step 1: put yourself in the low-privileged position

Take a private project in which the attacking account has the Guest role. This is the role the whole attack is built around: it is enough to reach the issue creation form, but not enough, per the documentation, to create a test case.

Why start here? Because the bug is about a boundary between two roles. To show the boundary is broken, you first need an account that sits on the low side of it and can still reach the form.

Step 2: capture the request that creates an issue

The request that creates an issue is a POST to the project's issues path:

Line by line:

  • POST is the method. It means "create something on the server".
  • https://gitlab.com/project_name/-/issues is the address. project_name is a placeholder for the real project's name, and /-/issues is the page and endpoint for the project's issues.

The body is form-encoded and has the following shape:

Text
utf8=✓
authenticity_token= your_auth_token
issue[title]=issue_title
issue[description]=issue_description
issue[confidential]=0
issue[issue_type]=issue
issue[lock_version]=0

Line by line:

  • utf8=✓ is the usual Rails form marker. Rails is the web framework GitLab is built on, and it adds this field to forms to signal that the form uses UTF-8 character encoding. It is housekeeping, not security.
  • authenticity_token= your_auth_token is the CSRF token for the session, shown here as your_auth_token. It proves the form came from the site and belongs to your logged-in session.
  • issue[title]=issue_title and issue[description]=issue_description are the content of the object being created: its title and its description text.
  • issue[confidential]=0 sets confidentiality, here 0, meaning not confidential.
  • issue[issue_type]=issue selects the type of object, here issue. This is the field the whole attack turns on.
  • issue[lock_version]=0 is the optimistic locking field submitted with the form. Optimistic locking is a way to stop two people from overwriting each other's changes: the server remembers a version number and rejects a save if the number has moved on since the form was loaded.

Why capture this request? Because the browser already knows how to build a valid request, including the token. Rather than guess the format, you take the real one and change as little as possible.

Step 3: change the type

In the parameter set, change the value of issue[issue_type] from issue to test_case:

Everything else in the request stays as the browser sent it. The attacker is not adding a new endpoint or a new permission; they are only changing the value of a field the client already controls.

Why this step? The form lets the browser say what kind of object it wants. If the server believes that value without checking whether this particular user is allowed to create that kind of object, then the value is effectively a choice the user makes, not a rule the server enforces.

Step 4: send the request

Submit the modified request with the Guest session. The server accepts it.

Why this step? Sending it is the test. If the server rejects it, there is no bug. If it accepts it, the permission check did not catch the change.

Step 5: look at the result

A test case is created. It can be viewed at the project's test case listing:

Text
https://gitlab.com/project_name/-/quality/test_cases

Line by line:

  • https://gitlab.com/project_name/-/quality/test_cases is the page in the project that lists test cases. /-/quality/test_cases is the path for that listing.

Why this step? Seeing the object on the test case page proves it really is a test case and not an issue with an odd label. The object exists despite the account never having held the Reporter role that the documentation requires for this action.

Why it works

The issue creation path accepts a client-supplied issue_type and acts on it, creating a test case when the value is test_case. The request succeeds even though the documentation reserves test case creation for Reporter and above; the report does not explain why. The report does not include the server-side code, so the exact location of the missing or misplaced check is not shown; the above is the behaviour the steps demonstrate.

Impact

A Guest in a private project can create test cases, an action reserved for Reporter and above. The researcher frames the impact around the role test cases play in a project: they are an important part of a project because they let product, quality and development teams combine their work, and Guest users should not be able to create them. The escalation is limited to this object type and to projects where the attacker already has Guest access; the report does not describe any further escalation, data disclosure or persistence beyond creating the test case.

Fix

Other places to look for the same pattern

  • Other values of the type field. Try any other object types the same form or endpoint accepts in issue_type, and check whether each one is created with Guest privileges. A positive result is an object appearing in the project that the documentation says needs a higher role.
  • Other forms with a type selector. Look for creation forms available to low-privileged roles that carry a field naming the kind of object to create, and swap the value for a type reserved for a higher role. A positive result is the higher-privileged object being created and listed.
  • Role boundary checks on sibling features. For each feature whose documentation states a minimum role, find the lowest-privileged form that reaches the same controller and see whether the role check follows the object type or the entry point. A positive result is an action succeeding below its documented role.

How to hunt for this yourself

This kind of bug hides where a single endpoint serves several object types and the type is chosen by the client. The signal during recon is a form field whose value names a class of object, combined with documentation that assigns different minimum roles to those classes. Comparing the permission table against the forms a Guest can actually submit is the cheapest way to find the gap: if a low role can reach a creation form, check every parameter that influences what gets created.

Glossary

  • API: the set of addresses and rules a server accepts requests on; the way software talks to software.
  • Authorisation: the process of deciding whether a user is allowed to perform a particular action.
  • Body: the part of an HTTP request that carries the data, such as form fields.
  • Browser developer tools: the built-in panel in a browser that shows requests, responses and page code.
  • Confidential: a flag on an issue meaning it is restricted to certain people.
  • Controller: the part of a web application that receives a request and decides what to do with it.
  • CSRF (cross-site request forgery): an attack where another website tries to make your browser submit a form on a site you are logged into.
  • CSRF token / authenticity token: a random value issued to your browser and checked by the server to prove a form came from the site and belongs to your session.
  • CVSS: a standard scoring system for the severity of a security vulnerability; higher numbers mean more severe.
  • Endpoint: a specific address on a server that accepts requests, such as the issues path.
  • Form-encoded: a way of sending form data as name=value pairs.
  • Guest: the lowest role a person can have in a GitLab project.
  • HTTP request: a message a browser or program sends to a server, with a method, a URL and optionally a body.
  • Issue: a written item in a project, such as a bug report or task.
  • Lock version / optimistic locking: a version number sent with a form so the server can reject a save if the data changed since the form was loaded.
  • Method (POST): the verb of an HTTP request; POST means create or submit something.
  • Parameter: a named value sent in a request, such as issue[issue_type].
  • Permission: an individual action a role is allowed to perform.
  • Private project: a project only its members can see.
  • Privilege escalation: a bug where a user with low permissions manages to perform an action reserved for higher permissions.
  • Rails: the web framework GitLab is built on.
  • Reporter: a GitLab project role higher than Guest.
  • Role: a label given to a person in a project that determines what they are allowed to do.
  • Severity: a rating of how serious a vulnerability is.
  • Test case: a written check describing how something in the product should behave.
  • Token: a short piece of text used to prove identity or authenticity.
  • UTF-8: a character encoding that can represent text in most of the world's writing systems.
  • Vulnerability: a weakness in software that allows someone to do something they should not be able to do.

More by maruthi12

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.