What Is security.txt?

When security researchers discover a vulnerability in your web service, how do they contact you? Without a clear, published contact method, they may give up, disclose publicly, or find the wrong person. security.txt solves this problem.

Standardized in RFC 9116, security.txt is a plain text file hosted at /.well-known/security.txt (or /security.txt) that provides a consistent, machine-readable location for security contact information and vulnerability disclosure policies.

Why It Matters

Security researchers are increasingly professionalized, and many won't disclose vulnerabilities to organizations that make it difficult to report them. A clearly published security.txt:

  • Removes friction for researchers trying to do the right thing
  • Reduces the chance of accidental or malicious public disclosure
  • Demonstrates security maturity to partners, auditors, and regulators
  • Helps automated security tools identify the right contacts during incident response

Anatomy of a security.txt File

Here is a well-structured example:

Contact: mailto:security@example.com
Contact: https://example.com/security/report
Expires: 2026-12-31T23:59:59Z
Encryption: https://example.com/pgp-key.txt
Acknowledgments: https://example.com/security/hall-of-fame
Policy: https://example.com/security/policy
Preferred-Languages: en, es
Canonical: https://example.com/.well-known/security.txt

Required and Recommended Fields

FieldRequired?Description
ContactYesHow to report a vulnerability. Can be email, URL, or phone. Multiple entries allowed.
ExpiresYesWhen this file should be considered stale. Prevents outdated info from being trusted.
EncryptionRecommendedURL to a PGP key for encrypted communication.
AcknowledgmentsRecommendedLink to a page crediting reporters.
PolicyRecommendedLink to your full vulnerability disclosure policy.
CanonicalRecommendedThe authoritative URL of this file, preventing confusion from copies.
Preferred-LanguagesOptionalLanguages your security team can respond in.

Signing Your security.txt

RFC 9116 strongly recommends signing your security.txt file with PGP. This prevents attackers from modifying your contact information to redirect vulnerability reports away from you. A signed file has a PGP signature block wrapping the content:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Contact: mailto:security@example.com
Expires: 2026-12-31T23:59:59Z
...
-----BEGIN PGP SIGNATURE-----
[signature data]
-----END PGP SIGNATURE-----

Researchers who validate the signature know the file is authentic and hasn't been tampered with.

Writing an Effective Disclosure Policy

The Policy field links to your full disclosure policy page. A good policy should address:

  1. Scope — Which systems and domains are in scope for testing
  2. Out of scope — What researchers should NOT test (e.g., production user data, DoS attacks)
  3. Response timeline — How quickly you acknowledge reports and provide updates
  4. Safe harbor — Legal protection for good-faith researchers
  5. Recognition — Whether you offer a bug bounty or public acknowledgment

Deploying security.txt

Deployment is straightforward. Place the file at /.well-known/security.txt and optionally also at /security.txt for compatibility. Serve it as text/plain; charset=utf-8.

Set a reminder to update the Expires field before it lapses — an expired security.txt is almost worse than none, as it signals neglect.

Tools to Help

  • securitytxt.org — Official generator tool
  • gpg --armor --clearsign security.txt — Sign with your PGP key
  • Various security scanning tools automatically check for and validate security.txt

Setting up security.txt takes less than an hour and signals to the security community that your organization takes responsible disclosure seriously. It's one of the easiest, highest-value security posture improvements any web service can make.