Skip to content
Access control Disclosed report Intermediate

An organization admin can create an attacker-controlled organization owner via the gem transfer flow

An Organization admin on RubyGems.org could grant the Owner role, which is meant to be reserved for existing owners, by using the gem transfer flow rather than the normal membership endpoints. This let an admin escalate privileges and create an attacker-controlled organization owner.

timhaines Follow

Originally disclosed on HackerOne

High 7.0 View original
  • Triaged in 26 days
  • Fixed in 32 days
  • Disclosed after 2 months

Summary by the program

An Organization admin on RubyGems.org can grant the Owner role, which is reserved for existing owners, by going through the gem transfer flow instead of the normal membership flow. The membership endpoints correctly stop admins from inviting owners: a direct owner invite returns 404, and adding a direct gem owner returns 403.

The transfer flow only checks that the user is an admin of the Organization. It then accepts whatever role is submitted for each invitee, including Owner, and creates the Organization membership without applying the owner-only rule. A previous fix enforced this rule on the direct membership route but did not extend it to gem transfers.

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

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 4 min read.

What the report shows

The target is RubyGems.org and the feature is the gem transfer flow. The report describes a role escalation: an Organization admin can create an Organization owner through that flow, even though the Owner role is meant to be reserved for existing owners.

The normal membership routes behave correctly. According to the report, a direct owner invite returns 404, and adding a direct gem owner returns 403. Those two refusals are what stop an admin from inviting an owner through the ordinary path.

The transfer flow is the gap. It only verifies that the requesting user is an admin of the Organization. Once that check passes, it accepts whatever role is submitted for each invitee, including Owner, and creates the Organization membership without applying the owner-only rule. The result is a new Organization owner whose role was chosen by the admin rather than by an existing owner.

The report notes that a previous fix enforced the owner-only rule on the direct membership route but did not extend it to gem transfers. That is the whole of the finding as written: no request or response is included, so the exact endpoint, parameters and payloads are not shown here.

The platform records the report as high severity with a CVSS score of 7.0, classified as improper access control (generic). No bounty figure is given.

Root cause

The report says a previous fix enforced the owner-only rule on the direct membership route but did not extend it to gem transfers. The membership endpoints correctly stop admins from inviting owners. The transfer endpoint applies only the first rule. Because the role value is taken from the submitted invitee data and written straight into the new membership, the second rule never runs.

The previous fix covered the direct membership route but not gem transfers. The transfer path creates memberships without applying the owner-only rule.

Impact

An Organization admin, a role that is supposed to sit below Owner, can create an Organization owner. That breaks the intended separation between the two roles and lets an admin create an Organization owner through a route that was meant to be closed to them. The report does not describe what an owner can do beyond what an admin cannot, so the practical consequences depend on the target's permission model.

How this kind of bug works

Role and privilege escalation through a secondary code path is common wherever an application has more than one way to perform the same state change. A team fixes the endpoint named in a report, adds a check there, and moves on. Later, or in parallel, another feature performs the same write: a transfer, an import, a bulk invite, an API endpoint, a background job, an admin console. If the check lives in the controller rather than in the service or model that performs the write, the second path is unprotected.

The mechanism is always the same: user-controlled input includes a privileged attribute (a role, a flag, an owner identifier), the server validates the caller's identity but not the value being assigned, and the write succeeds. Defences are centralised authorisation on the object being changed, an allow-list of roles the caller may assign, and treating role assignment as a separate privileged operation from membership creation.

How to test for it

  1. Map every route that creates or modifies membership, ownership or role. Look beyond the obvious settings page: transfers, imports, bulk operations, invitations, API versions, and any endpoint that accepts a list of users with roles.
  2. Establish the baseline. As a low-privileged member or admin, try the direct route to grant the highest role. Note the status code and body of the refusal.
  3. Repeat the same intent through each alternative route, keeping the privileged role value in the submitted data. Watch for a success response, a new membership appearing, or the role changing on a subsequent read.
  4. Confirm with a fresh session: log in as the promoted account and check that the elevated permissions actually apply, rather than the response merely echoing the submitted role.
  5. Check both directions: escalation by the attacker on themselves, and creation of a new privileged account the attacker controls.

A positive result is a state change that the direct route refuses. Common false positives are responses that accept the role field but silently coerce it to a lower role, UI-only changes with no server-side effect, and cases where the caller already held the higher role through another grant. Always verify the stored state, not just the HTTP status.

How it is fixed

Enforce the role rule in the layer that performs the write, so every caller inherits it. Validate the submitted role against an allow-list of roles the caller is permitted to assign, and reject Owner unless the caller is an owner. Apply the same check to every path that creates memberships, including transfers and bulk operations. Add regression tests that exercise each route with a privileged role value, and log or alert on attempts to assign roles above the caller's level.

Hunting notes

These bugs hide in features added after the original fix: transfers, migrations, team imports, SSO provisioning, API endpoints that mirror the UI, and anything that accepts a list of invitees. Recon signals include multiple endpoints that write to the same membership table, role fields accepted as free-form strings, and changelogs mentioning access control fixes on one route only.

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 6 min read.

What happened, in plain words

RubyGems.org is the site where Ruby gems are published and downloaded. Gems have owners. Organizations on the site have members with roles. The Owner role is meant to be reserved for existing owners. Only an existing owner should be able to create another owner.

The report describes a way around that rule. An Organisation admin can use the gem transfer flow to create a new Organisation owner. The normal membership routes behave correctly: a direct owner invite returns 404 (not found) and adding a direct gem owner returns 403 (forbidden). Those two refusals are what stop an admin from inviting an owner through the ordinary path.

The transfer flow is the gap. It only checks that the person making the request is an admin of the Organisation. Once that passes, it accepts whatever role is submitted for each invitee, including Owner, and creates the Organisation membership without applying the owner-only rule. The result is a new Organisation owner whose role was chosen by the admin rather than by an existing owner.

The report notes that a previous fix enforced the owner-only rule on the direct membership route but did not extend it to gem transfers. That is the finding as written: no request or response is included, so the exact endpoint, parameters and payloads are not shown. The platform records it as high severity with a CVSS score of 7.0, classified as improper access control (generic). No bounty figure is given.

The concepts involved

  • A request is what your browser sends to a website when you click something: a message asking the server to do something, such as "add this person to my Organisation with this role".
  • Access control is the set of rules deciding who is allowed to do what. When those rules are missing or applied in the wrong place, the weakness is called improper access control.
  • Privilege escalation means getting a higher level of permission than you were given. Here an admin, a role below Owner, ends up able to create an Owner.
  • A 404 response means the server says the thing you asked for does not exist. A 403 means it exists but you are not allowed to use it. Both are refusals, and both are the correct behaviour in this case.

Why the gap matters

The membership endpoints correctly stop admins from inviting owners. The transfer route applies only the first. Because the role value is taken from the submitted invitee data and written straight into the new membership, the second rule never runs. An admin, a role supposed to sit below Owner, can create an Organisation owner through a route that was meant to be closed to them. The report does not describe what an owner can do beyond what an admin cannot, so the practical consequences depend on the site's permission model.

In general, how this kind of bug works

Role escalation through a secondary code path is common wherever an application has more than one way to perform the same change. A team fixes the endpoint named in a report, adds a check there, and moves on. Later, or in parallel, another feature performs the same write: a transfer, an import, a bulk invite, an API endpoint, a background job, an admin console. If the check lives in the page handler rather than in the shared code that actually saves the change, the second path is unprotected.

The mechanism is always the same: user-controlled input includes a privileged attribute (a role, a flag, an owner identifier), the server validates who the caller is but not the value being assigned, and the write succeeds. Defences are centralised authorisation on the object being changed, an allow-list of roles the caller may assign, and treating role assignment as a separate privileged operation from membership creation.

How to test for it

  1. Map every route that creates or modifies membership, ownership or role. Look beyond the obvious settings page: transfers, imports, bulk operations, invitations, API versions, and any endpoint that accepts a list of users with roles.
  2. Establish the baseline. As a low-privileged member or admin, try the direct route to grant the highest role. Note the status code and body of the refusal.
  3. Repeat the same intent through each alternative route, keeping the privileged role value in the submitted data. Watch for a success response, a new membership appearing, or the role changing on a subsequent read.
  4. Confirm with a fresh session: log in as the promoted account and check that the elevated permissions actually apply, rather than the response merely echoing the submitted role.
  5. Check both directions: escalation by the attacker on themselves, and creation of a new privileged account the attacker controls.

A positive result is a state change that the direct route refuses. Common false positives are responses that accept the role field but silently coerce it to a lower role, changes that only affect what the page displays with no server-side effect, and cases where the caller already held the higher role through another grant. Always verify the stored state, not just the HTTP status.

How it is fixed

Enforce the role rule in the layer that performs the write, so every caller inherits it. Validate the submitted role against an allow-list of roles the caller is permitted to assign, and reject Owner unless the caller is an owner. Apply the same check to every path that creates memberships, including transfers and bulk operations. Add regression tests that exercise each route with a privileged role value, and log or alert on attempts to assign roles above the caller's level.

Where to look

These bugs hide in features added after the original fix: transfers, migrations, team imports, single sign-on provisioning, API endpoints that mirror the interface, and anything that accepts a list of invitees. Signals worth watching include multiple endpoints that write to the same membership table, role fields accepted as free-form text, and changelogs mentioning access control fixes on one route only.

Glossary

  • RubyGems.org: the public website for publishing and downloading Ruby software packages, called gems.
  • Gem: a packaged piece of Ruby software that can be published and downloaded.
  • Organisation: a grouping of gems and people on the site, with members who hold roles.
  • Role: a named level of permission, such as admin or Owner.
  • Owner: a role meant to be granted only by an existing owner.
  • Admin: a role below Owner that should not be able to create owners.
  • Gem transfer flow: the flow through which the owner role could be granted.
  • Membership route: the ordinary path for adding someone to an Organisation with a role.
  • Request: the message a browser sends to a server asking it to do something.
  • Response: the server's reply, including a status code and often a body.
  • 404: status code meaning the requested thing was not found.
  • 403: status code meaning the request was understood but refused.
  • Access control: the rules deciding who may perform which actions.
  • Improper access control: a weakness where those rules are missing or applied in the wrong place.
  • Privilege escalation: gaining a higher level of permission than you were granted.
  • CVSS: a standard scoring system for the severity of a security flaw; 7.0 is in the high range.
  • Endpoint: a specific address on a server that accepts requests, such as one for transfers and another for membership.
  • Payload: the data sent inside a request, such as the role being assigned.
  • Allow-list: an explicit list of permitted values; anything not on it is rejected.
  • Regression test: an automated test that checks a fixed bug stays fixed.
  • Session: the logged-in state a server keeps for your browser, usually tied to a cookie.
  • Cookie: a small piece of data your browser stores and sends back so the server recognises you.
  • False positive: a result that looks like a bug but is not one.

More by timhaines

View all

2 more disclosed reports, best first.

More from RubyGems

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.