CVE-2021-39935 Elastic Security · Elastic

Detect GitLab SSRF via Import Feature (CVE-2021-39935) in Elastic Security

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

Tactic
Reconnaissance Discovery Lateral Movement

Elastic Detection Query

Elastic Security (Elastic)
eql
sequence by source.ip with maxspan=5m
  [network where event.dataset in ("nginx.access", "apache.access") and
   url.path like~ "*/api/v4/projects*" or url.path like~ "*/import*" or url.path like~ "*/integrations*"]
  [network where event.dataset in ("nginx.access", "apache.access") and
   (destination.ip == "169.254.169.254" or
    destination.ip == "100.100.100.200" or
    CIDR(destination.ip, "127.0.0.0/8") or
    CIDR(destination.ip, "10.0.0.0/8") or
    CIDR(destination.ip, "172.16.0.0/12") or
    CIDR(destination.ip, "192.168.0.0/16"))]
high severity medium confidence

EQL sequence detection correlating GitLab API access with subsequent outbound connections to internal or metadata IP ranges, indicating SSRF pivot.

Data Sources

nginx.accessapache.accessnetwork.flow

Required Tables

logs-nginx.access-*logs-apache.access-*logs-network.flow-*

False Positives & Tuning

  • Internal GitLab runner communications to private network services
  • Automated integration tests that legitimately reach internal endpoints
  • Misconfigured GitLab webhooks targeting internal monitoring infrastructure

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.

  1. 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

  2. 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

  3. 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.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections