Mercurial repository found

Description

Mercurial metadata directory (.hg) was found in this folder. An attacker can extract sensitive information by requesting the hidden metadata directory that version control tool Mercurial creates. The metadata directories are used for development purposes to keep track of development changes to a set of source code before it is committed back to a central repository (and vice-versa). When code is rolled to a live server from a repository, it is supposed to be done as an export rather than as a local working copy, and hence this problem.

Remediation

Remove these files from production systems or restrict access to the .hg directory. To deny access to all the .hg folders you need to add the following lines in the appropriate context (either global config, or vhost/directory, or from .htaccess):

<Directory ~ "\.hg">
Order allow,deny
Deny from all
</Directory>

References
Severity
Classification
Tags
  • Information Disclosure  Test Files  Dev Files