Skip to content
Info disclosure Disclosed report Beginner

DAST API logs leaking username/password and custom request headers to unauthorized users

DAST scan logs for API scans contained the configured username, password and custom request headers in plain text or base64, and these logs were accessible to unauthenticated users on public projects. An attacker could read these credentials to access the target environment.

GitLab

Originally disclosed on GitLab

  • Fixed in 20 days
  • Disclosed after 20 days

HackerOne report #1765521 by joaxcar on 2022-11-07, assigned to @greg:

Report | Attachments | How To Reproduce

Report

Summary

When configuring an On demand DAST scan (see docs) the user configuring the scan can enter both username and password and a list of custom request headers.

Both the password and the custom request headers are masked in the UI, and are not possible to view after being saved (not even by the user who configured the scan). Note that to even be able to view On demand DAST scan configs a user needs to have at least Developer access to the project.

But when a scan runs it creates some log files, it seems to differ what type depending on if it is a website scan or an API scan. During my testing the API scan leaks usernames, password and custom headers, while website scans leak custom headers.

When a user configures a Site profile (see docs) the user can add headers and password that the docs describe in this way

When configured, request headers and password fields are encrypted using aes-256-gcm before being stored in the database. This data can only be read and decrypted with a valid secrets file.

But they will be present in clear text in job logs accessible by unauthenticated users (on a public project)

As an example, configuring a site profile using a HAR file for API information will when executed leave a log file (/jobs/ID/artifacts/gl-api-security-worker-entry.log) containing the lines

2022-11-07 22:46:05 [DEB] API Security: Setting 'http_password_base64' with value of 'aGVqaGVqaGVq' on app  
...  
2022-11-07 22:46:05 [DEB] API Security: Setting 'request_headers_base64' with value of 'YXNkOiBhc2Q=' on app  

where the base64 values contain password and header values. This file is on a public project accessible by unauthorized users. The same file contains the password and headers in plain text when the site profile is of OpenAPI type

2022-11-07 21:53:22 [DEB] API Security: Payload: {'project': 'ultimatetest7/hen/dast', 'profile': 'Quick-Active', 'runnerOptions': {'httpUsername': '<h1>asd</h1>', 'httpPassword': 'sadfasdf', 'openapi': 'https://webhook.site/8d852063-91a4-4bbb-8a68-27a51f9026c5', 'headers': ['asd: asd'],  

You can visit my logs here (this is how the logs are presented, they are accessed through GitLab pages, I have not moved them):

https://ultimatetest7.gitlab.io/-/hen/dast/-/jobs/3287336724/artifacts/gl-api-security-worker-entry.log

https://ultimatetest7.gitlab.io/-/hen/dast/-/jobs/3287155417/artifacts/gl-api-security-worker-entry.log

On a website target the headers are printed in clear text here

https://gitlab.com/ultimatetest7/hen/dast/-/jobs/3287276071

in the job log. But the password is masked, and no artifacts are created.

Steps to reproduce

  1. Log in as a victim user.
  2. Create a new public project (you need Ultimate subscription)
  3. Go to https://gitlab.com/GROUP/PROJECT/-/on_demand_scans/new
  4. Configure all fields
  5. When you create the site profile makes sure to switch to API. You can fill out with random URLs. It is not important that it works out. It will leak anyway
api2.jpg
api2.jpg From the original on GitLab
  1. Click save and run scan
  2. Go to https://gitlab.com/GROUP/PROJECT/-/pipelines
  3. Click the new pipeline and then click on the DAST job
  4. When available click browse artifacts
  5. Open the file named gl-api-security-worker-entry.log
  6. Your data should now be visible in the log
  7. Visit the log as an unauthorized attacker in another browser to see that it is leaking

Impact

DAST scan logs leak credentials to deploy environments

Examples

https://ultimatetest7.gitlab.io/-/hen/dast/-/jobs/3287336724/artifacts/gl-api-security-worker-entry.log

https://ultimatetest7.gitlab.io/-/hen/dast/-/jobs/3287155417/artifacts/gl-api-security-worker-entry.log

What is the current bug behavior?

Credentials are printed in plain text (or base64) in log files open to all users

What is the expected correct behavior?

Credentials should not end up in the logs

Output of checks

This bug happens on GitLab.com

Impact

DAST scan logs leak credentials to deploy environments

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 DAST scanner logged its configuration, including secrets, without redacting sensitive fields.

Impact

An unauthenticated attacker could read the leaked credentials and use them to access the target environment.

What the attacker needed

Ultimate subscription; Public project; DAST scan configured with credentials

How it was found

  1. Log in as a victim user.
  2. Create a new public project (Ultimate subscription required).
  3. Go to the new on-demand scan page.
  4. Configure all fields, switching the site profile to API.
  5. Click save and run scan.
  6. Go to pipelines, open the DAST job, browse artifacts, and open gl-api-security-worker-entry.log to see the leaked data.

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 you set up a security scan in GitLab, you can give it a username and password to log into your app. These secrets are supposed to be hidden, but the scan's log file accidentally printed them out. Because the log file was public, anyone could read the secrets and use them to break into the app.

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.