Creating an Access token that never expires bypassing the 1 year automatically expire functionality.
GitLab had removed the ability to create personal access tokens without an expiry date, but the server did not properly validate the expiry value. By submitting a zero date, an attacker could create a token that never expires, bypassing the one-year limit.
GitLab
Originally disclosed on GitLab
- Fixed in 16 days
- Disclosed after 16 days
⚠️ 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 #1998426 by jeetbhdr on 2023-05-23, assigned to @nmalcolm:
Report | Attachments | How To Reproduce
Report
Summary
In the latest version of Gitlab 16.0 the creation of access token without an expire date was removed. But due to some issue in the user input validation I was able to create a token that never expires bypassing the 1 year expire date.
Steps to reproduce
1 . Login to Your GitLab account .]
2 . Go to Edit Profile ---> Access token.
3 . Here Give access token a name , an expiration date and select scope ----> Create Personal Access token and intercept the request.
POST /-/profile/personal_access_tokens HTTP/2
Host: gitlab.com
Cookie:
Accept: text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: https://gitlab.com/-/profile/personal_access_tokens
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With: XMLHttpRequest
Content-Length: 128
Origin: https://gitlab.com
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
X-Bug-Bounty: jeetbhdr
Te: trailers
personal_access_token%5Bname%5D=bbb&personal_access_token%5Bexpires_at%5D=0000-00-00&personal_access_token%5Bscopes%5D%5B%5D=api
4 . Here in the POST request body change the expires at to 0000-00-00 and send the request .
5. You will be able to create a personal access token that never expires.
- Using your browser's inspector, delete the expiry input
- Click submit and see a personal access token that doesn't expire
Impact
Bypassing the gitlab restriction that doesn't allows creating an access token that never expires.
What is the current bug behavior?
Create an access token that never expires.
What is the expected correct behavior?
According to Gitlab documentation an GITLAB access token should expire after 365 days.
Thank you for looking into my report . If you want additional information feel free to ask.
Regards,
Jeetbhdr
Impact
Bypassing the gitlab restriction that doesn't allows creating an access token that never expires.
Attachments
Warning: Attachments received through HackerOne, please exercise caution!
How To Reproduce
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 server trusted the client-supplied expiry value and did not validate that it was a real, future date within the allowed range.
Impact
An attacker could create a personal access token that never expires, bypassing the intended one-year limit.
What the attacker needed
A GitLab account; ability to intercept HTTP requests
How it was found
- Log in to your GitLab account.
- Open the profile page and go to the access token section.
- Fill in a name, an expiry date and a scope, then intercept the create request.
- Change the expiry value in the request body to a zero date and send it.
- Observe that a personal access token with no expiry is created.
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 personal access token is like a password that a program uses to act as you on a website. GitLab wanted every token to stop working after a year, but the server accepted a nonsense date instead of rejecting it. That let someone make a token that stays valid forever, which is dangerous if it leaks.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.