Skip to content
Access control Write-up Advanced

One Slot Ran Another Slot’s Code: Inside CVE-2026–19478

A GitLab GraphQL fallback for fields tagged with a future version could be tricked into calling arbitrary Ruby methods on the underlying object, allowing an unauthenticated attacker to delete a project by requesting a field named 'destroy'. A second bug in batch processing let a read operation inherit state from a later write operation, though a login was required to actually perform the write.

medium.com

Published on medium.com

Cve

First name Last name, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

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. 8 min read.

Context

GitLab exposes a GraphQL API. Clients can use it to ask questions (reads) or to instruct the server to do things (writes). This write-up covers two bugs in that API, tracked as CVE-2026-19478. The first lets a plain read quietly turn into a hidden write. The second is worse: a single request, with no login at all, can delete a real project, just by asking for a field that does not exist.

GitLab ships some new GraphQL fields early but hides them until the right release. A field is tagged like this:

Text
count @gl_introduced(version: "99.0.0")

If the running GitLab is older than the stated version, GitLab hides the field and returns null instead. That is the intended behaviour of the feature. The lab behind this write-up found two ways it breaks.

Setup

The researcher created a throwaway public project for the first bug and reproduced the deletion three separate times, on three separate disposable projects, with the same result each time. The first bug was triggered with no login and no token, using one plain HTTP request. Verification that the project was gone was done with a real admin token through the normal REST API. The second bug was tested with a baseline star count of 1 and required a login with an API token to actually change anything. The proof-of-concept code, patch and full evidence are in the linked repository, and everything under src/ there is real upstream GitLab source rather than a rewrite.

Finding it

Normally, if you ask GraphQL for a field that does not exist, it says "no such field" and stops. GitLab has a fallback: if a missing field carries the @gl_introduced tag, GitLab builds a stand-in field on the fly, so old and new servers do not break each other during a rolling deploy.

The code that builds the stand-in is:

Text
def fallback_field(name:)  GraphQL::Schema::Field.new(    owner: self,    name: name,    type: GraphQL::Types::Boolean,    fallback_value: nil  )end

On the surface this looks safe: it says "return nil" through fallback_value: nil. But it never says how to get the value. When a GraphQL field has no instructions, the underlying library falls back to its own default: call a Ruby method with the same name, on the real object behind the field. So if you ask for a field called destroy and the object behind it is a real GitLab project, the library calls project.destroy. For real. fallback_value: nil only takes effect if the method truly does not exist. If it does exist, even a dangerous one, it runs.

The second bug lives in how GitLab tracks state across a batch of GraphQL operations. The code that runs this feature keeps its notes in one shared box:

Text
def parse(query_string:)  @original_query_document = super            @contain_future_fields   = false  filter = FutureFieldFilter.new(@original_query_document.dup)  filter.visit.tap { @contain_future_fields = filter.contain_future_fields }enddef execute_query(query:)  return super unless @contain_future_fields  query.instance_variable_set(:@document, @original_query_document)    query.send(:prepare_ast)  superend

GitLab uses one box for the whole batch, and it reads every operation before it runs any of them. So the box only ever remembers the last thing put in it.

Exploitation

Step 1: delete a project with an anonymous read

The researcher made a throwaway public project, then, with no login, no token and one plain HTTP request, sent:

GraphQL
query {  project(fullPath: "root/verify-disposable") {    id    destroy @gl_introduced(version: "99.0.0")  }}

The query asks for the project's id and for a field named destroy, tagged with @gl_introduced at a version far in the future. Because the field does not exist, the fallback builds a stand-in for it, and the stand-in resolves by calling the Ruby method of the same name on the project object.

GitLab answered:

JSON
{ "data": { "project": { "id": "gid://gitlab/Project/2", "destroy": true } } }

The destroy field returned true.

Step 2: confirm the project is gone

The researcher checked the project again, this time with a real admin token, through the normal REST API:

HTTP
GET /api/v4/projects/2 -> 404

The project no longer existed. One anonymous request, no trick payload, no batching, no login: just a field name that happened to match a real, dangerous method.

GitLab's own server logs showed 9 database writes for that one request, and zero new entries in the audit log. Deleting a project the normal way goes through a proper service: it logs the action, fires webhooks and leaves a trail. This path skipped all of it and went straight to the database.

Step 3: make a read slot run a write slot

For the second bug, send two operations in one batch:

  • Slot 1: query { currentUser { username } }, a plain read.
  • Slot 2: mutation { starProject(...) { count @gl_introduced(version: "99.0.0") } }, a write, with a future field.

Following the shared box through the batch:

  1. parse(slot 1) puts slot 1 in the box. Flag: no future field.
  2. parse(slot 2) puts slot 2 in the box. Flag: yes, future field. This overwrites slot 1's state.
  3. execute(slot 1): the flag is on, so GitLab swaps slot 1's query with the box, and slot 1 now runs slot 2.

Slot 1 said "read". Slot 1 ran the write. Old state from the last parse leaks into the first run.

Step 4: observe the star count change

The baseline star count was 1. The researcher sent the batch above. Slot 1, the one that only asked for a username, came back with {"starProject":{"count":"0"}}. The star count dropped to 0.

This bug needs a login with an API token to actually change something. Sent with no login at all, the swap still happens and the read slot really does reach the write, but GitLab has a second lock on every mutation:

Text
Ability.allowed?(current_user, :execute_graphql_mutation, :global)

With no login, that check says no and the write is stopped at the door. Bug #1 has no such lock in its path at all: it never goes through a mutation, so this lock never applies to it.

Root cause

Both bugs come from trusting a default too much.

Bug #1 trusted a library's default behaviour, "call a method with this name", without checking whether the name was safe first. The stand-in field sets fallback_value: nil but provides no resolver, so the GraphQL library falls through to calling the same-named Ruby method on the underlying object. The nil fallback only applies when the method does not exist, so any existing method, including destroy, is reachable through a field name the schema never defined. Because the request is a query rather than a mutation, the :execute_graphql_mutation ability check is never consulted, and because the call bypasses the normal deletion service, no audit entry or webhook is produced.

Bug #2 trusted a shared variable to hold the right thing at the right time, without checking who else might write to it first. The parse phase stores the original document and the future-field flag in instance state shared across the whole batch, and the execute phase reads that state for every operation. Since all operations are parsed before any is executed, the last parse wins, and an earlier read operation is executed against the later operation's document.

Neither mistake is exotic. Both look completely fine in a code review, right up until someone sends a field name the code never expected.

Impact

Bug #1 lets an unauthenticated attacker reach an existing Ruby method on the object behind a field, by naming it as a field tagged with @gl_introduced; the demonstrated case was destroy on a project. In the demonstrated case this deleted a real project with a single anonymous HTTP request, with no audit log entry and no webhooks. The researcher reproduced the deletion three times on three disposable projects. The full range of methods reachable this way is not established in the write-up; the demonstrated impact is project deletion.

Bug #2 allows an authenticated user with an API token to have one operation in a batch execute another operation's document, so a read slot can perform a write. Without authentication the swap still occurs but the mutation is blocked by the :execute_graphql_mutation check. The demonstrated effect was a star count dropping from 1 to 0.

Fix

Two small changes, one for each bug.

Bug #1's fix gives the stand-in field real instructions instead of letting it fall through to the default:

Text
resolver_class: Resolvers::NilResolver

Bug #2's fix stops using one shared box and gives each operation its own notes, keyed by its own document:

Text
@introduced_tracer_data[filtered_document] = {  original_document: original_document,  contain_future_fields: filter.contain_future_fields}doc_data = @introduced_tracer_data[query.document]

The report lists the fix as present in 18.11.11, 19.0.8, 19.1.6 and 19.2.4. If you run GitLab, upgrade.

Variants to test

  • Other dangerous method names as fields. On a GraphQL API with a similar fallback for unknown fields, request fields named after destructive or state-changing methods on the object behind the parent field (for example deletion, transfer or permission methods). A positive result is the field returning a value and the underlying object changing state, confirmed out of band.
  • Fallback fields on other object types. Repeat the @gl_introduced-tagged unknown field against different parent objects (users, groups, tokens) rather than projects. A positive result is any method invocation that the schema never intended to expose.
  • Audit and webhook checks. After any suspected fallback invocation, check whether the action appears in the audit log or fires webhooks. A positive result for an attacker is a state change with no corresponding audit entry.
  • Batch state leakage with more than two slots. Send batches where a future-field operation is parsed after a benign read, and vary the order and count. A positive result is the read slot returning data or effects belonging to the other operation.
  • Batch leakage without authentication. Send the same batch with no credentials and observe whether the read slot still reaches the write path before the mutation ability check rejects it. A positive result is any observable side effect that survives the check.
  • Other shared per-batch state. Look for other instance variables set during parse and read during execute in batch-capable GraphQL servers. A positive result is one operation's parse-time state influencing another operation's execution.

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. 12 min read.

What happened, in plain words

GitLab is a website that teams use to store and manage their code projects. Like most modern websites, it has a way for programs to talk to it directly, without a human clicking buttons. That channel is called an API, and GitLab's API speaks a language called GraphQL.

GraphQL works like a very precise order form. You send a request that says exactly which pieces of information you want, and the server sends back only those pieces. You can use it in two ways:

  • To read: ask questions like "what is the name of this project?"
  • To write: tell the server to do something, like "star this project for me".

This story is about two mistakes in that order form. The first mistake lets a request that looks like a harmless question quietly perform a destructive action. The second is worse in a different way: a single request, sent with no login at all, can delete a real project, simply by asking for a piece of information that does not exist.

The write-up is titled around CVE-2026-19478. A CVE is a public catalogue number for a known security flaw, so that everyone can refer to the same bug by the same name.

A tiny bit of background

GitLab sometimes adds new features to its API before they are officially released. To do this safely, it hides the new pieces of information until the right version of GitLab is running. Each hidden piece is tagged with a note like this:

Text
count @gl_introduced(version: "99.0.0")

Here is what that line means, piece by piece:

  • count is the name of a field, meaning one piece of information you can ask for. In this example it would be a number, such as how many stars a project has.
  • @gl_introduced is a label, called a directive in GraphQL, that attaches extra instructions to the field.
  • version: "99.0.0" says the field was introduced in version 99.0.0 of GitLab. That version number is deliberately far in the future, so no real server is that new yet.

If the GitLab server you are talking to is older than the stated version, GitLab hides the field and answers with null instead. null is the computing word for "nothing" or "empty". The idea is simple: old servers and new servers can coexist during an upgrade, and nobody's request breaks.

That is how the feature is supposed to work. The security lab behind this write-up found two ways it breaks.

Bug #1: asking for a field that isn't there

Normally, if you ask GraphQL for a field that does not exist, it politely says "no such field" and stops. Nothing bad happens.

But GitLab has a fallback. If a missing field carries the @gl_introduced tag, GitLab builds a stand-in field on the fly. The reason is practical: during a rolling deploy, some servers are on the old version and some on the new one, and this fallback stops them from breaking each other's requests.

Here is the code that builds the stand-in:

Text
def fallback_field(name:)  GraphQL::Schema::Field.new(    owner: self,    name: name,    type: GraphQL::Types::Boolean,    fallback_value: nil  )end

Line by line, in plain words:

  • def fallback_field(name:) starts the definition of a small routine called fallback_field. It takes one input, name, which is the name of the field someone asked for.
  • GraphQL::Schema::Field.new( begins creating a brand new field object, using a class from the GraphQL library that GitLab is built on.
  • owner: self, says which object this new field belongs to. self means "the object we are currently working with".
  • name: name, gives the new field the same name the visitor asked for.
  • type: GraphQL::Types::Boolean, says the answer will be a true or false value.
  • fallback_value: nil says: if there is nothing to return, return nothing (nil is Ruby's word for null).
  • ) closes the field creation, and end closes the routine.

On the surface this looks safe. It says "return nothing" through fallback_value: nil. But it never says how to get the value. And when a GraphQL field has no instructions, the underlying library falls back to its own default: call a Ruby method with the same name, on the real object behind the field.

A method, in programming, is a named action that an object can perform. Think of an object as a person and a method as something you can ask that person to do, like "sit" or "stand". If you shout a command at someone and they happen to know how to do it, they will do it.

So if you ask for a field called destroy, and the object behind it is a real GitLab project, the library calls project.destroy. For real. The fallback_value: nil only takes effect if the method truly does not exist. If it does exist, even a dangerous one, it runs.

Proof

The researcher made a throwaway public project, purely for testing. Then, with no login, no token, one plain HTTP request, they sent this:

GraphQL
query {  project(fullPath: "root/verify-disposable") {    id    destroy @gl_introduced(version: "99.0.0")  }}

What each part means:

  • query { starts a read request. A query is the GraphQL word for "please tell me something".
  • project(fullPath: "root/verify-disposable") says: find the project whose full path is root/verify-disposable. A full path is like a project's address inside GitLab.
  • id asks for the project's unique identifier.
  • destroy @gl_introduced(version: "99.0.0") asks for a field named destroy, tagged as if it were introduced in version 99.0.0. No such field exists in GitLab's official list of fields, which is exactly the point.
  • The closing braces end the request.

GitLab answered:

JSON
{ "data": { "project": { "id": "gid://gitlab/Project/2", "destroy": true } } }
  • "data" is the section where GraphQL puts the answers.
  • "project" holds the details of the project that was found.
  • "id": "gid://gitlab/Project/2" is the project's identifier. The gid:// prefix means it is a global identifier, a unique label used across GitLab.
  • "destroy": true is the alarming part. The destroy field returned true, meaning the method ran.

Then the researcher checked the project again, this time with a real admin token, through the normal REST API:

HTTP
GET /api/v4/projects/2 -> 404
  • GET is the standard web request for "fetch me something".
  • /api/v4/projects/2 is the address of project number 2 in GitLab's older-style API, called REST.
  • -> 404 means the server answered "not found". The project was gone.

A token, in this context, is a long secret string that proves who you are, a bit like a wristband at an event. The admin token was used only to check the result, not to cause the deletion.

One anonymous request. No trick payload, no batching, no login. Just a field name that happened to match a real, dangerous method.

It gets worse. GitLab's own server logs showed 9 database writes for that one request, and zero new entries in the audit log. An audit log is the record of who did what and when, the thing a company checks after an incident. Deleting a project the normal way goes through a proper service: it logs the action, fires webhooks (automatic notifications sent to other systems), and leaves a trail. This path skipped all of it and went straight to the database.

The researcher reproduced this three separate times, on three separate disposable projects. Same result every time.

Bug #2: one slot in a batch runs another slot's code

GitLab lets you send many GraphQL operations in one request. That is called a batch. Think of it as one envelope containing several separate letters.

This second bug lives in how GitLab tracks state across a batch. State means the notes a program keeps while it works, like a notepad on the desk.

The code that runs this feature keeps its notes in one shared box:

Text
def parse(query_string:)  @original_query_document = super            @contain_future_fields   = false  filter = FutureFieldFilter.new(@original_query_document.dup)  filter.visit.tap { @contain_future_fields = filter.contain_future_fields }enddef execute_query(query:)  return super unless @contain_future_fields  query.instance_variable_set(:@document, @original_query_document)    query.send(:prepare_ast)  superend

Line by line:

  • def parse(query_string:) starts a routine called parse. Parsing means reading a request and turning it into a form the program can work with, like reading a letter before acting on it.
  • @original_query_document = super saves the original request text. The The @ symbol in Ruby marks an instance variable, one that belongs to the object rather than a single routine. Here the same object is reused across the batch, which is the shared box.
  • @contain_future_fields = false sets a flag, a simple on/off switch, saying "so far, no future fields seen".
  • filter = FutureFieldFilter.new(@original_query_document.dup) creates a helper that looks for future fields. .dup makes a copy so the original is not altered.
  • filter.visit.tap { @contain_future_fields = filter.contain_future_fields } runs the helper and stores its finding in the shared flag. tap is a Ruby trick for doing something with a value and still returning it.
  • end closes parse.
  • def execute_query(query:) starts the routine that actually runs a request.
  • return super unless @contain_future_fields says: if the flag is off, just do the normal thing and stop here. super means "run the parent version of this routine".
  • query.instance_variable_set(:@document, @original_query_document) overwrites the current request's document with whatever is in the shared box.
  • query.send(:prepare_ast) re-prepares the request after the swap.
  • super then runs the normal execution.
  • end closes execute_query.

GitLab uses one box for the whole batch, and it reads every operation before it runs any of them. So the box only ever remembers the last thing put in it.

Send two operations in one batch:

  • Slot 1: query { currentUser { username } }; a plain read. It asks for the username of the person making the request.
  • Slot 2: mutation { starProject(...) { count @gl_introduced(version: "99.0.0") } }; a write, with a future field. A mutation is GraphQL's word for "change something". starProject is the mutation used in the example, and count is the future field.

Now follow the box:

  1. parse(slot 1) puts slot 1 in the box. Flag: no future field.
  2. parse(slot 2) puts slot 2 in the box. Flag: yes, future field. This overwrites slot 1's state.
  3. execute(slot 1): the flag is on, so GitLab swaps slot 1's query with the box, and slot 1 now runs slot 2.

Slot 1 said "read". Slot 1 ran the write. That is the whole bug. Old state from the last parse leaks into the first run.

Proof

The baseline star count was 1. The researcher sent the batch above. Slot 1, the one that only asked for a username, came back with {"starProject":{"count":"0"}}. The star count dropped to 0.

This one needs a login with an API token to actually change something. Sent with no login at all, the swap still happens, the read slot really does reach the write, but GitLab has a second lock on every mutation:

Text
Ability.allowed?(current_user, :execute_graphql_mutation, :global)
  • Ability.allowed? asks a permission-checking system whether something is allowed.
  • current_user is whoever is making the request.
  • :execute_graphql_mutation is the specific permission being checked: may this person run a mutation?
  • :global means the check applies across the whole system.

With no login, that check says no, and the write is stopped at the door. Bug #1 has no such lock in its path at all. It never goes through a mutation, so this lock never even applies to it.

The fix

Two small changes, one for each bug.

Bug #1's fix: give the stand-in field real instructions, instead of letting it fall through to the default:

Text
resolver_class: Resolvers::NilResolver

A resolver is the part that says how to get a field's value. The fix names Resolvers::NilResolver explicitly instead of leaving the decision to the library default. By naming it explicitly, the code no longer leaves the decision to the library's default of "call a method with this name".

Bug #2's fix: stop using one shared box. Give each operation its own notes, keyed by its own document:

Text
@introduced_tracer_data[filtered_document] = {  original_document: original_document,  contain_future_fields: filter.contain_future_fields}doc_data = @introduced_tracer_data[query.document]
  • @introduced_tracer_data[filtered_document] = { stores notes in a lookup table, using each operation's own document as the key. A lookup table, or hash, is like a filing cabinet where each folder has a label.
  • original_document: original_document, saves that operation's own original text.
  • contain_future_fields: filter.contain_future_fields saves whether that operation had future fields.
  • } closes the entry.
  • doc_data = @introduced_tracer_data[query.document] later fetches the notes belonging to the exact operation being run, instead of whatever was written last.

Fixed in: 18.11.11, 19.0.8, 19.1.6, 19.2.4. If you run GitLab, upgrade.

The lesson

Two different mistakes, one shared cause: trusting a default too much.

Bug #1 trusted a library's default behaviour, "call a method with this name", without checking whether the name was safe first. Bug #2 trusted a shared variable to hold the right thing at the right time, without checking who else might write to it first.

Neither one is exotic. Both are the kind of thing that looks completely fine in a code review, right up until someone sends a field name the code never expected.

One made-up field name. One deleted project.

Lab, PoCs, patch, and full evidence are in the repo. Everything undersrc/is real upstream GitLab source, not a rewrite.

Glossary

  • API: a way for programs to talk to a service directly, without a human using a browser.
  • GraphQL: a language for asking a server for exactly the pieces of information you want, and for telling it to change things.
  • Query: a GraphQL request that only reads information.
  • Mutation: a GraphQL request that changes something on the server.
  • Field: one named piece of information you can ask for in GraphQL.
  • Directive: a label in GraphQL that attaches extra instructions to a field, such as @gl_introduced.
  • @gl_introduced: GitLab's tag marking a field as available only from a certain version onwards.
  • null / nil: the computing word for "nothing" or "empty". Ruby uses nil.
  • Method: a named action an object can perform, like destroy.
  • Object: a thing in a program that holds data and can perform methods.
  • Fallback: a backup behaviour used when the normal one is not available.
  • Resolver: the part of a GraphQL server that says how to get a field's value.
  • Batch: several GraphQL operations sent together in one request.
  • State: the notes a program keeps while it works.
  • Flag: a simple on/off switch in a program.
  • Parse: to read a request and turn it into a form the program can work with.
  • Execute: to actually run a request.
  • Token: a secret string that proves who you are, like a wristband at an event.
  • REST API: an older, simpler style of API where each address does one thing, such as GET /api/v4/projects/2.
  • HTTP request: a message a browser or program sends to a server over the web.
  • 404: the server's answer meaning "not found".
  • Audit log: the record of who did what and when.
  • Webhook: an automatic notification sent to another system when something happens.
  • CVE: a public catalogue number for a known security flaw.
  • Rolling deploy: an upgrade where some servers run the old version while others run the new one.
  • Lookup table (hash): a structure that stores values under labels, like a filing cabinet.
  • PoC: proof of concept, a small demonstration that a bug is real.
  • Patch: a code change that fixes a bug.
  • Repository (repo): a place where code and related files are stored, often on GitHub.
  • src/: the folder in a code repository that holds the source code.

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.