SlideShare a Scribd company logo
#OpenFest
    Ripping web accessible .git files
(or how to get the source when its not open source)




           Vlatko Kosturjak, Diverto
                  https://twitter.com/k0st
Agenda
●   Introduction
●   Finding repos
●   Cloning them
●   How to get the source when its not open source
●   How to Profit




                                    5 minutes
You found .git?
Want source?
● Get the repo:
mkdir git-test
cd git-test
wget --mirror --include-directories=/.git
http://www.target.com/.git
● Get files
cd www.target.com
git reset --hard
●   Profit!

         http://www.skullsecurity.org/blog/2012/using-git-clone-to-get-pwn3d
Problem




Directory browsing disabled
No tool available to detect
●   Most of the web/network scanners will not find this
    ●   No awareness
●   Tools looks only this
    ●   .git/ => 403
●   They should actually look
    ●   .git/logs/HEAD => 200
    ●   .git/config => 200
    ●   .git/index => 200
    ●   ...
Nmap NSE comes to rescue
●   Have to use latest SVN version
    ●   Script is not in 6.01
●   It looks all relevant git files
    ●   .git/logs/HEAD
    ●   .git/config
    ●   ...
●   nmap -sS -PS80,81,443,8080,8081
    -p80,81,443,8080,8081 --script=http-git <target>

              PORT      STATE SERVICE
              80/tcp    open   http
              | http-git:
              |    Potential Git repository found at XX.XX.XX.XX:XX/.git/ (found 5 of 6
              expected files)
DVCS-Pillage
●   It will rip the .git files when directory browsing
    disabled
    ●   By Adam Baldwin
●   Accessible from URL:
    ●   https://github.com/evilpacket/DVCS-Pillage
●   Have few problems
    ●   Hmm...
Problems...
●   Current methods
    ●   Not complete tree download method
        –   Packed refs
        –   git ls-files –stage method
    ●   No support for branches
    ●   No support for other than http
●   Time to code my own tool
    ●   Want whole tree
    ●   Branches
    ●   Support old protocols
DVCS-rip
●   It will rip the .git files when directory browsing disabled
●   It will rip ALL files and checkout repository for you
    ●   Not partial
    ●   git fsck trick
●   Support for
    ●   Branches
    ●   Any protocol (http/https/...)
●   Accessible from URL:
    ●   https://github.com/kost/dvcs-ripper
DVCS-rip
●   How to run?
●   Example run:
    ●   rip-git.pl -v -u http://www.example.com/.git/
●   It will automatically do "git checkout -f"
●   Profit!
Evolving




Good example of open source collaboration between projects
Questions? Comments? Feedbacks?

                    @k0st
                            This is zero



Acknowledgements:
Adam Baldwin,
Ron Bowes,
Alex Weber,
...

More Related Content

ODP
Wonderful world of (distributed) SCM or VCS
PDF
Porting your favourite cmdline tool to Android
PDF
RootedCON 2017 - Docker might not be your friend. Trojanizing Docker images
PDF
COSCUP 2016 - ROS + Gazebo機器人模擬器工作坊
ODP
about Debian "squeeze" @201002 OSC Tokyospring
PDF
Local Community for Debian (2013 Taiwan miniDebConf)
PDF
Golang workshop
PDF
Package manages and Puppet - PuppetConf 2015
Wonderful world of (distributed) SCM or VCS
Porting your favourite cmdline tool to Android
RootedCON 2017 - Docker might not be your friend. Trojanizing Docker images
COSCUP 2016 - ROS + Gazebo機器人模擬器工作坊
about Debian "squeeze" @201002 OSC Tokyospring
Local Community for Debian (2013 Taiwan miniDebConf)
Golang workshop
Package manages and Puppet - PuppetConf 2015

What's hot (20)

PDF
Desarrollo web backend: Spring Boot, MongoDB y Azure
PDF
Puppet Camp LA 2/19/2015
PDF
Does Cowgirl Dream of Red Swirl?
PDF
Chef Conf 2015: Package Management & Chef
PDF
A Look at Command Line Swift
PDF
CloudOpen North America 2013: Vagrant & CFEngine
PDF
find & improve some bottleneck in Debian project (DebConf14 LT)
PDF
SouthEast LinuxFest 2015 - intro to git
PDF
Chromium OS Introduction
PDF
8-9-10=Jessie,Stretch,Buster
PDF
Open source applications softwares
PDF
Drupal Development : Tools, Tips, and Tricks
PDF
OpenStack Swift on virtualbox
PDF
Docker on Windows
PDF
Docker & PHP - Practical use case
PDF
Null Xposed Framework internals and writing modules
PDF
Cape Cod Web Technology Meetup - 3
PDF
WAF protections and bypass resources
PDF
Openwrt startup
PPTX
Docker italia fatti un container tutto tuo
Desarrollo web backend: Spring Boot, MongoDB y Azure
Puppet Camp LA 2/19/2015
Does Cowgirl Dream of Red Swirl?
Chef Conf 2015: Package Management & Chef
A Look at Command Line Swift
CloudOpen North America 2013: Vagrant & CFEngine
find & improve some bottleneck in Debian project (DebConf14 LT)
SouthEast LinuxFest 2015 - intro to git
Chromium OS Introduction
8-9-10=Jessie,Stretch,Buster
Open source applications softwares
Drupal Development : Tools, Tips, and Tricks
OpenStack Swift on virtualbox
Docker on Windows
Docker & PHP - Practical use case
Null Xposed Framework internals and writing modules
Cape Cod Web Technology Meetup - 3
WAF protections and bypass resources
Openwrt startup
Docker italia fatti un container tutto tuo
Ad

Viewers also liked (7)

PPT
Creative accounting (1)
PDF
Creative accounting tutor master
PPT
Creative accounting
PPT
Financial Accounting
PDF
2015 Upload Campaigns Calendar - SlideShare
PPTX
What to Upload to SlideShare
PDF
Getting Started With SlideShare
Creative accounting (1)
Creative accounting tutor master
Creative accounting
Financial Accounting
2015 Upload Campaigns Calendar - SlideShare
What to Upload to SlideShare
Getting Started With SlideShare
Ad

Similar to Ripping web accessible .git files (20)

PDF
Git Money
PDF
LasCon 2014 DevOoops
PPTX
January 2022: Central Iowa Linux Users Group: Git
PPT
Introduction to git
PDF
What the git? - SAP Inside Track Munich 2016
PDF
Git Tutorial
PPTX
Devoops: DoJ Annual Cybersecurity Training Symposium Edition 2015
PPTX
Git'in on Windows
PPTX
Git'in in 15
PPT
Introduction to Git
PDF
Intro to Git
PDF
Using GIT
PDF
Learning git
PPTX
Mini-training: Let’s Git It!
PPTX
Git.From thorns to the stars
PDF
Loading...git
PPT
git fast & minimal
PPTX
Version controll.pptx
ODP
Git slides
PDF
Whether you should migrate to git
Git Money
LasCon 2014 DevOoops
January 2022: Central Iowa Linux Users Group: Git
Introduction to git
What the git? - SAP Inside Track Munich 2016
Git Tutorial
Devoops: DoJ Annual Cybersecurity Training Symposium Edition 2015
Git'in on Windows
Git'in in 15
Introduction to Git
Intro to Git
Using GIT
Learning git
Mini-training: Let’s Git It!
Git.From thorns to the stars
Loading...git
git fast & minimal
Version controll.pptx
Git slides
Whether you should migrate to git

Ripping web accessible .git files

  • 1. #OpenFest Ripping web accessible .git files (or how to get the source when its not open source) Vlatko Kosturjak, Diverto https://twitter.com/k0st
  • 2. Agenda ● Introduction ● Finding repos ● Cloning them ● How to get the source when its not open source ● How to Profit 5 minutes
  • 4. Want source? ● Get the repo: mkdir git-test cd git-test wget --mirror --include-directories=/.git http://www.target.com/.git ● Get files cd www.target.com git reset --hard ● Profit! http://www.skullsecurity.org/blog/2012/using-git-clone-to-get-pwn3d
  • 6. No tool available to detect ● Most of the web/network scanners will not find this ● No awareness ● Tools looks only this ● .git/ => 403 ● They should actually look ● .git/logs/HEAD => 200 ● .git/config => 200 ● .git/index => 200 ● ...
  • 7. Nmap NSE comes to rescue ● Have to use latest SVN version ● Script is not in 6.01 ● It looks all relevant git files ● .git/logs/HEAD ● .git/config ● ... ● nmap -sS -PS80,81,443,8080,8081 -p80,81,443,8080,8081 --script=http-git <target> PORT STATE SERVICE 80/tcp open http | http-git: | Potential Git repository found at XX.XX.XX.XX:XX/.git/ (found 5 of 6 expected files)
  • 8. DVCS-Pillage ● It will rip the .git files when directory browsing disabled ● By Adam Baldwin ● Accessible from URL: ● https://github.com/evilpacket/DVCS-Pillage ● Have few problems ● Hmm...
  • 9. Problems... ● Current methods ● Not complete tree download method – Packed refs – git ls-files –stage method ● No support for branches ● No support for other than http ● Time to code my own tool ● Want whole tree ● Branches ● Support old protocols
  • 10. DVCS-rip ● It will rip the .git files when directory browsing disabled ● It will rip ALL files and checkout repository for you ● Not partial ● git fsck trick ● Support for ● Branches ● Any protocol (http/https/...) ● Accessible from URL: ● https://github.com/kost/dvcs-ripper
  • 11. DVCS-rip ● How to run? ● Example run: ● rip-git.pl -v -u http://www.example.com/.git/ ● It will automatically do "git checkout -f" ● Profit!
  • 12. Evolving Good example of open source collaboration between projects
  • 13. Questions? Comments? Feedbacks? @k0st This is zero Acknowledgements: Adam Baldwin, Ron Bowes, Alex Weber, ...