Exploit for CVE-2023-2825
GitLab version 16.0.0 fails to sanitise the file path in attachment URLs, allowing an unauthenticated attacker to read arbitrary files on the server via path traversal. The attacker can access sensitive files such as /etc/passwd.
Published on osec.com
On May 23, 2023 GitLab released version 16.0.1 which fixed a critical vulnerability, CVE-2023-2825, affecting the Community Edition (CE) and Enterprise Edition (EE) version 16.0.0. The vulnerability allows unauthenticated users to read arbitrary files through a path traversal bug.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Impact
An unauthenticated attacker could read arbitrary files on the server, potentially exposing sensitive information such as system credentials.
What the attacker needed
GitLab version 16.0.0; A public project nested in at least 5 groups; An attachment exists in the project
The fix
GitLab released version 16.0.1 to fix the vulnerability; upgrading to that version or later resolves the issue.
How it was found
- Create 11 nested groups and a public repository inside them.
- Upload a file as an attachment to an issue in that repository.
- Replace the file name in the attachment URL with a URL-encoded path traversal sequence pointing to the target file.
- Send a GET request to the modified URL to retrieve the file contents.
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 write-up has not been written yet. The Original tab links to the source.
This is a path traversal bug: the web server takes a file name from the URL and uses it to find a file on disk without checking that the file is inside the intended folder. By using special sequences like '../', an attacker can climb out of the upload folder and read any file the server can access, such as system password files.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.