CVE-2021-22864

8.8 HIGH

📋 TL;DR

This CVE describes a remote code execution vulnerability in GitHub Enterprise Server where attackers with permission to create GitHub Pages sites could manipulate configuration options to override environment variables and execute arbitrary code on the server instance. All GitHub Enterprise Server versions prior to 3.0.3 are affected. The vulnerability requires authenticated access to create and build GitHub Pages sites.

💻 Affected Systems

Products:
  • GitHub Enterprise Server
Versions: All versions prior to 3.0.3
Operating Systems: Linux
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects instances where GitHub Pages feature is enabled and users have permission to create GitHub Pages sites.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full compromise of the GitHub Enterprise Server instance, allowing attackers to execute arbitrary code with server privileges, potentially leading to data theft, system takeover, or lateral movement within the network.

🟠

Likely Case

Privileged attackers with GitHub Pages creation permissions could execute arbitrary commands on the server, potentially accessing sensitive repository data, user information, or using the server as a foothold for further attacks.

🟢

If Mitigated

With proper access controls limiting who can create GitHub Pages sites, the attack surface is significantly reduced, though any authorized user with this permission could still exploit the vulnerability.

🌐 Internet-Facing: HIGH
🏢 Internal Only: HIGH

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ✅ No
Complexity: MEDIUM

Exploitation requires authenticated access with GitHub Pages creation permissions. The vulnerability was discovered through GitHub's bug bounty program.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 3.0.3, 2.22.9, or 2.21.17

Vendor Advisory: https://docs.github.com/en/enterprise-server@3.0/admin/release-notes#3.0.3

Restart Required: Yes

Instructions:

1. Backup your GitHub Enterprise Server instance. 2. Upgrade to version 3.0.3, 2.22.9, or 2.21.17 depending on your current version. 3. Follow GitHub's upgrade documentation for your specific version. 4. Restart the server after upgrade completion.

🔧 Temporary Workarounds

Disable GitHub Pages

linux

Temporarily disable GitHub Pages feature to prevent exploitation while planning upgrade

ghe-config pages.enabled false
ghe-config-apply

Restrict GitHub Pages Permissions

all

Limit which users/organizations can create GitHub Pages sites to reduce attack surface

🧯 If You Can't Patch

  • Immediately restrict GitHub Pages creation permissions to only essential, trusted users
  • Implement network segmentation to isolate GitHub Enterprise Server from critical systems

🔍 How to Verify

Check if Vulnerable:

Check current GitHub Enterprise Server version via management console or SSH: ghe-version

Check Version:

ghe-version

Verify Fix Applied:

Verify version is 3.0.3, 2.22.9, or 2.21.17 or higher: ghe-version

📡 Detection & Monitoring

Log Indicators:

  • Unusual GitHub Pages build processes
  • Suspicious configuration changes in GitHub Pages settings
  • Unexpected process execution during GitHub Pages builds

Network Indicators:

  • Unusual outbound connections from GitHub Enterprise Server during GitHub Pages builds

SIEM Query:

source="github-enterprise" AND (event="pages_build" OR event="pages_config") AND status="success" | search suspicious_patterns

🔗 References

📤 Share & Export