Exploiting Version Control Systems

null meet Bangalore

29 August 2015

Abstract

This session will focus on how to exploit a scenario where Version control related data is publicly exposed.

what kind of juicy data can be extracted from the files as well as how you can leverage this for exploitation.

Slides

AI Generated Summary

AI Generated Content Disclaimer

Note: This summary is AI-generated and may contain inaccuracies, errors, or omissions. If you spot any issues, please contact the site owner for corrections. Errors or omissions are unintended.

“Exploiting Version Control Systems: Pillaging for Fun and Profit” is a presentation covering the exploitation of publicly exposed version control system (VCS) directories on web servers, showing how developers who deploy code via Git, SVN, or Mercurial can inadvertently expose their entire source code repository. The deck walks through VCS directory structures, predictable file paths for detection, available extraction tools, and live demos of extracting source code both with and without directory listing enabled.

Summary

The talk frames version control systems as the hip, developer way of deploying code, supporting auto-deployment on commit, which is exactly why exposed VCS directories are worth exploiting: it’s like a golden ticket, and auto-deployment, if available, makes it more hip. The VCS 101 table maps each system to its characteristic hidden folder: Git uses .git, SVN uses .svn, and Mercurial uses .hg, with Bazaar’s .bzr also mentioned.

Detection relies on predictable files: .git/HEAD for Git repositories, .hg/requires for Mercurial, and .bzr/README for Bazaar. The .gitignore file is presented as the robots.txt of VCS, since it reveals the file and directory names the developer wanted to exclude from version control. For quick bulk checks, the deck includes a shell script that reads a list of targets and probes each with curl for .svn/entries over HTTP and HTTPS (curl -k -I) and .svn/wc.db over both protocols, enabling rapid identification of exposed SVN repositories across multiple domains.

The tooling section lists three options with honest annotations: SVN-extractor (only SVN, placed on top because its author wrote it), DVCS-pillage (lacks SVN support), and dvcs-ripper (an alternative implementation that covers SVN too). The live demo section then covers the two common configurations: exploitation when directory listing is enabled on the web server, where browsing and downloading the repository is straightforward, and exploitation when directory listing is disabled, where knowledge of predictable file paths and tool-based reconstruction are required, including the SVN case. The deck closes with a quick-check recap and the contact slide.

Key Themes

Notable Points

  1. Takeaway: never deploy VCS metadata directories (.git, .svn, .hg) to production web servers; add explicit deny rules in your web server configuration to block access to these directories.
  2. Takeaway: during penetration tests, always probe for VCS directories by checking predictable paths like .git/HEAD, .svn/entries, .svn/wc.db, and .hg/requires on target web servers.
  3. Takeaway: use automated tools like svn-extractor, DVCS-pillage, or dvcs-ripper to reconstruct source code from exposed VCS directories, even when directory listing is disabled.
  4. Takeaway: check .gitignore files when discovered, as they reveal the names of files and directories the developer considered sensitive enough to exclude from version control.
  5. Takeaway: if using auto-deployment from VCS, ensure the deployment process strips VCS metadata or that web server rules prevent access to hidden directories.
  6. Takeaway: include VCS directory exposure checks in your standard security scanning and CI/CD pipeline to catch accidental deployments before they reach production.
  7. The bulk-check shell script loops over a target list and runs curl -I http://$p/.svn/entries, curl -k -I https://$p/.svn/entries, curl -I http://$p/.svn/wc.db, and curl -k -I https://$p/.svn/wc.db for each host.
  8. Tool capabilities as annotated on the slide: SVN-extractor covers only SVN, DVCS-pillage lacks SVN support, and dvcs-ripper is an alternative implementation covering SVN as well; the demo set ran both directory-listing-enabled and disabled scenarios plus a dedicated SVN walkthrough.

Notable Quotes

“The hip / developers way of deploying code”

“Its like a golden ticket”

“Auto-deployment if available makes it more hip.”

“SVN-extractor (Only SVN) (on top coz i wrote it)”

“NOTE: ALL DEMO’s are prepared while in sleep deprived state.”

Social chatter