DAST scan leaking custom request headers in job logs
Custom request headers configured for an on-demand DAST scan are written in clear text to job logs, which are accessible to unauthenticated users on public projects. An attacker could read these headers, potentially exposing sensitive credentials.
GitLab
Originally disclosed on GitLab
- Fixed in 57 days
- Disclosed after 57 days
HackerOne report #1765521 by joaxcar on 2022-11-07, assigned to @greg:
Report | 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. The 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 headers will be present in clear text in job logs accessible by unauthenticated users (on a public project)
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.
Impact
DAST scan job logs leak headers to deploy environments
Examples
What is the current bug behavior?
Headers are printed in clear text (or base64) in job log files open to all users
What is the expected correct behavior?
Headers should not end up in the logs
Output of checks
This bug happens on GitLab.com
How To Reproduce
Please add reproducibility information to this section:
-
Log in as a victim user.
-
Create a new public project (you need Ultimate subscription)
-
Go to https://gitlab.com/GROUP/PROJECT/-/on_demand_scans/new
-
Configure all fields for a web scan
-
Add a custom header
-
Click
save and run scan -
Click the new pipeline and then click on the DAST job
-
When the job finishes, search for CustomHeaders
-
Your header should now be visible in the log in the clear tesxt
-
Visit the log as an unauthorized attacker in another browser to see that it is leaking
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
Impact
On a public project, unauthenticated users can read the leaked headers from job logs, potentially exposing sensitive information.
What the attacker needed
Ultimate subscription; Public project; Ability to configure DAST scan
The fix
Headers should not be written to logs; they should be redacted or omitted.
How it was found
- Log in as a victim user.
- Create a new public project (requires Ultimate subscription).
- Go to the on-demand scans creation page.
- Configure all fields for a web scan and add a custom header.
- Click 'save and run scan'.
- Go to pipelines, click the new pipeline, then the DAST job, and search for CustomHeaders in the log.
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, you can add secret headers (like passwords) that should be hidden. But the scan writes these headers into a log file that anyone can see if the project is public. So secrets that were meant to be private become visible to anyone.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.