Skip to main content
MediumSupply chainOWASP A05:2021CWE-200

How to fix: Python Requirements File Exposed

A requirements.txt, Pipfile, or Pipfile.lock was found at a public URL. Python dependency files reveal the exact package versions installed, enabling attackers to find known CVEs in your dependencies.

Why it matters

Pinned dependency versions in requirements.txt allow attackers to cross-reference against public CVE databases to find exploitable vulnerabilities in your installed packages.

Dependency manifests should be development-only artifacts. Production web servers should never serve these files. They're commonly exposed when deploying directly from a repository or when static file serving is too permissive.

How to fix it

  1. 1Deny access to requirements.txt, Pipfile, Pipfile.lock, setup.py, and pyproject.toml in your web server config.
  2. 2Ensure your deployment process copies only the necessary application files, not the entire repository.
  3. 3Add these files to your web application's security headers or path-based access controls.

Code examples

Nginx deny rule

nginx
location ~* /(requirements\.txt|Pipfile(\.lock)?|setup\.py|pyproject\.toml|Gemfile(\.lock)?) {
  deny all;
  return 404;
}

References

Detected automatically by VulnRadar. The check id is supply-chain-requirements-exposed, stable across every scan so you can filter or diff on it.

See every supply chain check

Questions

How severe is Python Requirements File Exposed?
VulnRadar rates this medium severity in the supply chain category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
Does VulnRadar check for this automatically?
Yes. It runs as part of every scan under the check id supply-chain-requirements-exposed, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does Python Requirements File Exposed map to?
It maps to CWE-200. In the OWASP Top 10 it falls under A05:2021.

Missing a check?

The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.

Propose a checkHow a check is built

Scan your own site for python requirements file exposed

VulnRadar runs this check and hundreds more against a URL in seconds. No agent to install, just paste a URL.

Or scan this site as a demoRead the docs

How to fix: Python Requirements File Exposed | VulnRadar