Skip to content
Info disclosure Disclosed report Intermediate

CVE-2022-4342 Bypassed - Maintainer can leak masked webhook secrets by changing target URL of the webhook

A maintainer could leak masked webhook secrets by changing the webhook target URL to an attacker-controlled server and masking that URL, causing the secret to be sent in the request. This bypasses the fix for CVE-2022-4342.

GitLab

Originally disclosed on GitLab

  • Fixed in 22 hours
  • Disclosed after 22 hours

⚠️ Please read the process on how to fix security issues before starting to work on the issue. Vulnerabilities must be fixed in a security mirror.

HackerOne report #1915507 by theluci on 2023-03-23, assigned to @ottilia_westerlund:

Report | Attachments | How To Reproduce

Report

Hello, I found that CVE-2022-4342 which was fixed in version 15.7.2 can be bypassed. And a malicious maintainer can leak masked webhook secrets by changing target URL of the webhook.

Summary

There is an option to mask parts of a webhook URL to treat it as a secret value.
https://docs.gitlab.com/ee/user/project/integrations/webhooks.html#mask-sensitive-portions-of-webhook-urls

When this feature is used any secret string in the configured URL will be masked in the UI and in any logs in the UI. The values work the same as other tokens in that they are not even accessible by the user configuring it after it is first configured. It should not be possible for the initial user or any other users to retrieve these values.

The docs states this about the secret

Sensitive portions do not get logged and are encrypted at rest in the database.

However, there is a way to leak masked webhook secrets by masking the attacker controlled server url itself. (see Steps/POC)

POC

CVE-2022-4342_Bypassed.mp4 From the original on GitLab

Steps to reproduce on Gitlab.com

victim is the owner of a project project-victim
attacker is a maintainer in project-victim

  1. victim goes to his project-victim webhook settings,https://gitlab.com/GROUP/PROJECT/-/hooks
  2. victim configures a webhook with a secret token and mask the secret token. For example, Put the URL like this https://example.com?token=secret-token
  3. Click to add a mask, add the value secret-token with the replacement token. Click save for the webhook
a0.png
a0.png From the original on GitLab
  1. attacker goes to project-victim webhook settings,https://gitlab.com/GROUP/PROJECT/-/hooks

  2. Scroll to the bottom of the page to the list of configured hooks and edit the webhook.

  3. attacker edit the url to an "attacker controlled server" (i used https://webhook.site to catch the request). Keep the token={token} part. Like this `https://WEBHOOK.SITE?token={TOKEN} and mask the URL of the attacker controlled server as shown in the image

a1.png
a1.png From the original on GitLab
  1. click save
  2. click test
  3. check your server to see that the request is sent to the new URL and containing the secret token
a2.png
a2.png From the original on GitLab
  1. attacker can remove the trace by changing the url back to the original url

Impact

Maintainers can leak secret masked values that should not be accessible after configuration.

Attachments

Warning: Attachments received through HackerOne, please exercise caution!

How To Reproduce

Please add reproducibility information to this section:

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

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

Likely the masking feature did not properly prevent a user from masking the attacker-controlled URL, allowing the secret to be revealed when the webhook was triggered.

Impact

Maintainers can leak secret masked values that should not be accessible after configuration.

What the attacker needed

Attacker is a maintainer in the project; victim has configured a webhook with a masked secret

How it was found

  1. Victim configures a webhook with a secret token and masks the secret token.
  2. Attacker edits the webhook URL to an attacker-controlled server, keeping the token part and masking the new URL.
  3. Attacker saves and tests the webhook.
  4. Attacker checks their server to see the request containing the secret token.
  5. Attacker changes the URL back to the original to remove the trace.

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.

Webhooks are automatic messages sent to another server when something happens. GitLab lets you hide secret parts of the webhook URL, but a user with maintainer rights could change the URL to their own server and trick GitLab into sending the secret there.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

More from GitLab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.