Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/documentation/modules/auxiliary/scanner/http/cgit_traversal.md
Views: 11784
Description
cgit before v1.2.1 has a directory traversal vulnerabiltiy when cgitrc
has the enable-http-clone
value set to 1. The directory traversal can be used to download files from the remote host. This module has been tested against cgit v1.1 running on Ubuntu 18.04.
Vulnerable Application
Installing cgit on Ubuntu 18.04 x64
sudo apt install cgit
# dependencies may have to be downloaded firstModify
/etc/cgitrc
to haveenable-http-clone=1
. Example attached.Add
.htaccess
file with rewrite rules to/usr/lib/cgit/
. Example attached.Add
cgit.conf
to/etc/apache2/conf-enabled/
. Example attached.Enable
rewrite.load
andcgi.load
in apache2.Create bare repo.
mkdir -p repo/test.git && cd repo/test.git && git init --bare
Example files were only used for testing and are not secure or usable in non-testing environments. These WILL make your system insecure, but will enable exploitation by this module.
Vulnerability Details from Project Zero
There is a directory traversal vulnerability in cgit_clone_objects(), reachable when the configuration flag enable-http-clone is set to 1 (default):
send_file() is a function that simply sends the data stored at the given filesystem path out over the network. git_path() partially rewrites the provided path and e.g. prepends the base path of the repository, but it does not sanitize the provided path to prevent directory traversal.
ctx.qry.path can come from querystring_cb(), which takes unescaped data from the querystring.
Options
REPO
Git repository on the remote server. Default is empty, ''
.
Verification Steps
./msfconsole -q
set rhosts <rhost>
set targeturi <uri>
set repo <repo>
run