Safeguard
Application Security•

CWE-527 Exposed Version Control Repository on a Web Server

A CVS or git folder left on a web server or in an archive exposes names, paths and source diffs. How to spot it and keep repositories out of production.

Safeguard Security Team
2 min read

CWE-527 covers a CVS, git or other repository stored in a directory, archive or other resource that is stored, transferred or made accessible to unauthorized actors.

How it happens

Version control tools keep metadata in subdirectories, such as a .git or CVS folder. If those folders land on a web server, or get packed into an archive that you hand out, the metadata goes with them. A typical cause is deploying by copying a working directory, or building a release zip from a checkout.

MITRE says the exposed data can include usernames, filenames, the path root, IP addresses and detailed diff data about how files changed. Diffs can show source snippets that were never meant to be public.

What an attacker gains

MITRE lists reading application data and reading files or directories. Old commits can contain secrets that were deleted later but remain in history. Paths and names give a map for further attacks.

How to find it

The record lists no detection methods. Simple checks from outside:

  • Request /.git/HEAD and /.git/config on your sites and see whether they return content.
  • Open each release archive and look for hidden version control folders.
  • Add a check to your build that fails if one appears in the output directory.
curl -s -o /dev/null -w "%{http_code}\n" https://example.com/.git/HEAD

A 200 response means the repository metadata is reachable.

How to fix it

MITRE's recommendations are to remove CVS directories and repositories from the production server, disable use of remote CVS repositories, and make sure the latest patches and updates are applied. The same logic applies to git.

  • Deploy built artifacts, not working copies.
  • Exclude .git and similar folders in packaging rules.
  • Block those paths in the web server configuration as a second line.
  • If a repository was exposed, treat any secret ever committed as compromised and rotate it.

Quick check

Why rotate secrets after an exposed repository?

History can hold secrets that were removed from current files but remain readable in old commits.

Sources

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.