Detect GitLab SSRF via Import Feature (CVE-2021-39935) in Google Chronicle
CVE-2021-39935 is a Server-Side Request Forgery (SSRF) vulnerability in GitLab Community and Enterprise Editions. An attacker can abuse GitLab's project import or integration features to cause the server to issue arbitrary HTTP requests to internal network resources, enabling reconnaissance, metadata service access, and potential lateral movement within cloud-hosted or on-premises GitLab deployments. This vulnerability is listed in the CISA Known Exploited Vulnerabilities catalog.
MITRE ATT&CK
YARA-L Detection Query
rule gitlab_ssrf_cve_2021_39935 {
meta:
author = "df00tech"
description = "Detects SSRF exploitation attempts against GitLab import/integration APIs (CVE-2021-39935)"
severity = "HIGH"
priority = "HIGH"
events:
$req.metadata.event_type = "NETWORK_HTTP"
$req.target.hostname = /gitlab/
(
$req.target.url = /\/api\/v4\/projects/ or
$req.target.url = /\/import/ or
$req.target.url = /\/integrations/
)
(
$req.target.url = /169\.254\.169\.254/ or
$req.target.url = /metadata\.google\.internal/ or
$req.target.url = /100\.100\.100\.200/ or
$req.target.url = /127\.0\.0\.1/ or
$req.target.url = /localhost/
)
condition:
$req
} Chronicle YARA-L rule detecting SSRF requests to GitLab API endpoints targeting internal or metadata IP addresses.
Data Sources
Required Tables
False Positives & Tuning
- Internal GitLab administration tools that legitimately query metadata endpoints
- Developer testing of GitLab import functionality against local instances
- Security scanning tools generating SSRF-pattern traffic for audit purposes
Other platforms for CVE-2021-39935
Testing Methodology
Validate this detection against 3 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1SSRF via GitLab Project Import URL — Cloud Metadata
Expected signal: Outbound network connection from GitLab server process to 169.254.169.254:80; HTTP GET request logged in GitLab production.log with import_url parameter containing metadata IP
- Test 2SSRF via GitLab Webhook Integration — Internal Host
Expected signal: Network connection attempt from GitLab process to 192.168.1.1:6379; webhook creation logged in GitLab audit log with attacker-supplied internal URL
- Test 3SSRF via GitLab External Issue Tracker Integration — GCP Metadata
Expected signal: DNS lookup for metadata.google.internal followed by HTTP GET from GitLab server; integration update recorded in GitLab application log
Unlock Pro Content
Get the full detection package for CVE-2021-39935 including response playbook, investigation guide, and atomic red team tests.