Reporter, external users, collaborators can mark sent swag awarded to reporter as unsent
A GraphQL mutation authorised the user against the program they manage but then updated whichever swag object was supplied, without checking that the swag belonged to that program. A reporter or collaborator could therefore flip a sent swag item back to unsent, potentially causing the swag to be shipped more than once.
- Triaged in under an hour
- Fixed in 7 days
- Disclosed after 7 days
An Insecure Direct Object Reference (IDOR) vulnerability allow the reporter, external users, and collaborators to mark sent swag that was awarded to the reporter as unsent. This may result in swag being sent multiple times.
Proof of concept Follow the steps below to reproduce the vulnerability.
- sign in to a user that is not part of any programs
- submit a report to a program, let's assume this program has ID 1
- sign in to a user that can award swag for program 1
- award swag to the report, let's assume the swag object has ID 1
- mark the swag as sent
- sign back in to the user that submitted the report
- create a new program in the sandbox, let's assume this program has ID 2
- use the following GraphQL to toggle the swag back to unsent
{"query":"mutation updateState($input_0:UpdateProgramSwagInput!) {updateProgramSwag(input:$input_0) { swag { _id } } }","variables":{"input_0":{"program_id":"Z2lkOi8vaGFja2Vyb25lL1RlYW0vMg==","swag_id":"Z2lkOi8vaGFja2Vyb25lL1N3YWcvMQ==","sent":false,"clientMutationId":"0"}}}
Important to note here is that the current signed in user must be allowed to manage swag for the given program_id. However, the given swag_id can belong to any other program. Due to the protected schema, this will only allow the attacker to pass in swag IDs that were reported to themselves or they are an external user or collaborator in a report that was awarded swag. No additional information is leaked.
app/graphql/mutations/update_program_swag_mutation.rb
# ...
def resolve(program_id:, swag_id:, sent:)
unsafe_program = context.schema.object_from_id program_id, context
safe_program = context[:tics].teams_where_i_have_program_management_permission.find unsafe_program.id # <-- proper authorization check
swag = context.schema.object_from_id swag_id, context # <-- will return any swag object the user is authorized to see
updated_swag = Interactors::Programs::UpdateSwag.interact(
as_user: context[:current_user],
team: safe_program,
swag: swag, # <-- swag object is passed to the interactor
sent: sent,
).values[:swag]
app/backend/interactors/programs/update_swag.rb
# frozen_string_literal: true
module Interactors
module Programs
class UpdateSwag < HackeroneInteractor
include Pavlov::StandardizedResult
attribute :team, Team
attribute :swag, ::Swag
attribute :sent, Boolean
result_value :swag, ::Swag
private
def execute
# ...
swag.update(sent: sent) # <-- updates the swag object without authorizing the user
# ...
end
def authorized?
can? :manage_swag, team # <-- only authorizes the user to manage swag for the passed Team
end
# ...
end
end
end
Recommendation The mutation or subsequent interactor can derive the team from the swag object that is passed. It could also do an additional check that the swag object belongs to the given team.
Impact
This vulnerability may result in swag being sent multiple times.
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 authorised the user against the supplied program but resolved the swag by its global identifier and passed it to the interactor, which updated it without verifying the swag belonged to that program.
Impact
Swag could be sent multiple times; the protected schema limited the attacker to swag IDs they were already allowed to see, and no additional information was leaked.
What the attacker needed
An account not in any programs; ability to submit a report; a program that awards swag; attacker can create a sandbox program
The fix
The mutation or the interactor should derive the team from the swag object, or additionally check that the swag belongs to the given team.
How it was found
- Sign in as a user not in any program and submit a report to a program.
- Sign in as a user who can award swag for that program and award swag to the report.
- Mark the swag as sent.
- Sign back in as the reporting user and create a new program in the sandbox.
- Send a GraphQL mutation using the new program's identifier with the original swag's identifier to set it back to unsent.
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.
When a website lets you change an item, it should check both that you are allowed to use the page and that the specific item belongs to you. Here the site checked only that you manage some program, then trusted the item identifier you sent. So someone could change a record belonging to a different program, in this case marking a shipped reward as not yet shipped.
What is IDOR?
One user can read or change another user's data, usually by changing an identifier the server trusts without checking who is asking. One of the most paid bug classes on web programs.