CVE-2021-39906

8.7 HIGH

📋 TL;DR

This vulnerability allows attackers to execute arbitrary JavaScript code in victims' browsers by uploading malicious ipynb (Jupyter Notebook) files to GitLab. It affects GitLab Community Edition (CE) and Enterprise Edition (EE) versions 13.5 and above. Attackers can perform actions on behalf of authenticated users who view the malicious files.

💻 Affected Systems

Products:
  • GitLab Community Edition
  • GitLab Enterprise Edition
Versions: 13.5 and above
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: Affects all deployments where ipynb file uploads are enabled (default). Self-managed and GitLab.com instances are both affected.

📦 What is this software?

Gitlab by Gitlab

GitLab is a complete DevOps platform providing source code management, CI/CD pipelines, security scanning, container registry, and collaboration tools used by millions of developers and thousands of enterprises worldwide. As both a cloud-hosted SaaS offering (GitLab.com) and self-managed software, G...

Learn more about Gitlab →

Gitlab by Gitlab

GitLab is a complete DevOps platform providing source code management, CI/CD pipelines, security scanning, container registry, and collaboration tools used by millions of developers and thousands of enterprises worldwide. As both a cloud-hosted SaaS offering (GitLab.com) and self-managed software, G...

Learn more about Gitlab →

Gitlab by Gitlab

GitLab is a complete DevOps platform providing source code management, CI/CD pipelines, security scanning, container registry, and collaboration tools used by millions of developers and thousands of enterprises worldwide. As both a cloud-hosted SaaS offering (GitLab.com) and self-managed software, G...

Learn more about Gitlab →

Gitlab by Gitlab

GitLab is a complete DevOps platform providing source code management, CI/CD pipelines, security scanning, container registry, and collaboration tools used by millions of developers and thousands of enterprises worldwide. As both a cloud-hosted SaaS offering (GitLab.com) and self-managed software, G...

Learn more about Gitlab →

Gitlab by Gitlab

GitLab is a complete DevOps platform providing source code management, CI/CD pipelines, security scanning, container registry, and collaboration tools used by millions of developers and thousands of enterprises worldwide. As both a cloud-hosted SaaS offering (GitLab.com) and self-managed software, G...

Learn more about Gitlab →

Gitlab by Gitlab

GitLab is a complete DevOps platform providing source code management, CI/CD pipelines, security scanning, container registry, and collaboration tools used by millions of developers and thousands of enterprises worldwide. As both a cloud-hosted SaaS offering (GitLab.com) and self-managed software, G...

Learn more about Gitlab →

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete account takeover, data exfiltration, privilege escalation, and lateral movement within the GitLab instance through cross-site scripting attacks.

🟠

Likely Case

Session hijacking, unauthorized actions performed on behalf of authenticated users, and potential data theft from user sessions.

🟢

If Mitigated

Limited impact with proper content security policies, file upload restrictions, and user awareness training.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ✅ No
Complexity: LOW

Exploitation requires an attacker to upload a malicious ipynb file and a victim to view it. Public proof-of-concept exists in HackerOne report.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: GitLab 14.5.2, 14.4.4, 14.3.6

Vendor Advisory: https://about.gitlab.com/releases/2021/12/06/security-release-gitlab-14-5-2-released/

Restart Required: Yes

Instructions:

1. Backup your GitLab instance. 2. Update to GitLab 14.5.2, 14.4.4, or 14.3.6 using your package manager. 3. Restart GitLab services. 4. Verify the update completed successfully.

🔧 Temporary Workarounds

Disable ipynb file uploads

all

Temporarily disable Jupyter Notebook file uploads until patching is possible

Edit GitLab configuration to restrict ipynb file types

Implement Content Security Policy

all

Add CSP headers to restrict JavaScript execution from untrusted sources

Configure CSP in GitLab's web server configuration

🧯 If You Can't Patch

  • Restrict file upload permissions to trusted users only
  • Implement network segmentation to isolate GitLab instances from sensitive systems

🔍 How to Verify

Check if Vulnerable:

Check GitLab version: if version is 13.5 or above and below 14.3.6, 14.4.4, or 14.5.2, the system is vulnerable.

Check Version:

sudo gitlab-rake gitlab:env:info | grep 'GitLab version'

Verify Fix Applied:

Verify GitLab version is 14.5.2, 14.4.4, or 14.3.6 or higher. Test ipynb file upload and rendering functionality.

📡 Detection & Monitoring

Log Indicators:

  • Unusual ipynb file uploads from unexpected users
  • JavaScript execution errors in application logs
  • Multiple failed file upload attempts

Network Indicators:

  • Unexpected outbound connections from GitLab server after file uploads
  • Suspicious HTTP requests to external domains

SIEM Query:

source="gitlab.log" AND ("ipynb" OR "Jupyter") AND ("upload" OR "render")

🔗 References

📤 Share & Export