Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ Full table of contents
testing/index
development-tools/index
core-team/index
security-and-threat-model/index
Comment thread
sethmlarson marked this conversation as resolved.
internals
versions

Expand Down
152 changes: 152 additions & 0 deletions security-and-threat-model/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
=========================
Security and threat model
=========================

The majority of Python Security Response Team (PSRT)
members are volunteers. Therefore, you must respect this volunteered time
by following this security policy. Repeated failure to
Comment on lines +5 to 7
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tying "respect their time" to the volunteer aspect feels a bit off to me. Maintainers that have a carve out in their day job for this work deserve the same consideration.

Could we drop the conditional framing? Maybe something like "PSRT members balance this work against many other responsibilities. Please be thoughtful about the time and attention your report requires."

respect the security policy will result in future reports
being rejected or being banned from the `python` GitHub organization, regardless of technical merit.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
being rejected or being banned from the `python` GitHub organization, regardless of technical merit.
being rejected or being banned from the ``python`` GitHub organization, regardless of technical merit.

Also, please wrap lines.


Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From @emmatyping:

Oh, I see that there is a section about it below. Perhaps moving it up would be better?

What types of bugs are vulnerabilities?
---------------------------------------

Not all bugs are vulnerabilities. To avoid causing
duplicate work for PSRT members all potential reports
must be evaluated against the relevant threat models
prior to being submitted to the PSRT.
Comment on lines +14 to +17
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Not all bugs are vulnerabilities. To avoid causing
duplicate work for PSRT members all potential reports
must be evaluated against the relevant threat model(s)
prior to being submitted to the PSRT.
Not all bugs are vulnerabilities, and Python is intentionally a highly capable tool
used for a wide variety of tasks in a wide variety of contexts.
Every formally disclosed security vulnerability has an immediate and significant
impact on our users, and so we seriously consider whether it is in our
users' best interests for a bug to be identified as a security vulnerability.
If you believe your issue deserves to potentially cause an emergency response
in thousands of organizations around the world,
please maximize your chances of us agreeing with you by reviewing this threat model
and ensuring that your report meets our criteria for a notifiable vulnerability
(in other words, it gets a CVE ID),
and that your report is clear enough for the PSRT to evaluate it.
To be clear, we consider that a CVE is a notification for our users,
and not a "reward" for reporters. The PSRT is the CNA for Python,
and is the sole decision maker for whether an issue is notifiable.

Possibly a bit dramatic, but feel free to tone it down 😉

Copy link
Copy Markdown
Member

@StanFromIreland StanFromIreland May 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"this threat model" - since it doesn’t exist yet, I think this change should be postponed.

Maybe mark it as .. important::?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We immediately go on to describe the assumptions we make, which is close enough to being a threat model that I think we can just call it that. For practical purposes, that's all that really matters.


Vulnerabilities must be exploitable from code, configurations,
pre-conditions, and deployments that might feasibly exist in
the real world. For example, a vulnerability only affecting code
that does not make sense in a production program
will not be accepted as a vulnerability.

Documented functionality will not be considered a vulnerability.
For example, :mod:`pickle`, :mod:`marshal``, :mod:`shelve``, :mod:`eval``,
and :mod:`exec` are documented to execute arbitrary Python code that is supplied
as data. The :mod:`ctypes` module is documented to enable modifying arbitrary locations in memory.

Vulnerabilities must not depend on malicious control of:

* what Python code is executed by the interpreter
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This probably needs clarifying, since if someone remotely persuades a runtime to execute their arbitrary code, that would be a vulnerability.

Perhaps we just want to say something like this instead of the bullet list?

Vulnerabilities must not depend on malicious control of Python's launch conditions, including command line arguments, environment variables, or modifications to files on the target system. We assume that, at the time Python is executed, the environment is as intended by the legitimate user, and any malicious variation from this cannot be mitigated by Python itself.

* locations where code is loaded prior to execution (such as current working
directory, ``PYTHONPATH``)
* configuration files
* environment variables
* command line options
* installed packages or modules
* `.pth files <https://docs.python.org/3/library/site.html>`__
* caches or ``.pyc`` files

Vulnerabilities that affect availability (such as DoS, ReDoS) must be
triggerable with data inputs that are reasonably sized for the use-case.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe: "...Otherwise if that is not the case and the module has an explicit warning they can be reported publicly"

Availability vulnerabilities must also demonstrate an "upward" change in posture
for the attacker, rather than a "lateral" change in posture.
This is to avoid handling performance improvements as security vulnerabilities.

Vulnerabilities in dependencies of Python (such as zlib, Tcl/Tk, or OpenSSL)
are not vulnerabilities in Python unless Python's use of the dependency
interferes with secure use of the dependency.
For example, Python is not vulnerable because it bundles a vulnerable
version of zlib, users are expected to upgrade their own dependencies.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comma splice. Also, is this right? Seems like we often take security upgrades of bundled dependencies such as expat.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly we also bundle the deps on some platforms (Windows), so our sources (cpython-*-deps) need to be updated in the event of a security vulnerability.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the idea is that we do not currently create patch releases when a dependency has a security vulnerability, or mitigate against vulnerable system dependencies.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plus users can't be expected to upgrade a bundled dependency, so the sentence needs a bit of reframing.

"For example, a vulnerability in the bundled copy of zlib in Python is a vulnerability in zlib, not Python."

I don't think we need to mention "users can upgrade their own dependencies". Maybe we need a written policy somewhere else on how we choose to release updates to our binary distros in light of bundled libraries though? Not here I don't think.


The complete threat model for Python and standard library modules
is available in the Threat Model section of the Python Developer Guide.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that a reference to this page?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That page doesn’t exist yet, so let's not reference it.


What versions of Python are accepting reports?
----------------------------------------------

Python accepts security vulnerabilities and will
assign CVE IDs for `supported Python versions`_ that have a status of
`"bugfix" or "security" <python-status>`_. Versions that are not yet
stable (status of `"feature" or "prerelease" <python-status>`_) are not
eligible for CVE IDs. If the vulnerability exclusively exists in
non-stable versions, then the issue should be handled as a public bug issue.
Comment on lines +65 to +66
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
eligible for CVE IDs. If the vulnerability exclusively exists in
non-stable versions, then the issue should be handled as a public bug issue.
eligible for CVE IDs. If the vulnerability only exists in prerelease
versions (alphas, betas, RCs), then the issue should be reported as a regular bug.


Sometimes features may be marked as
"experimental" in Python, even in a stable Python version.
These features are not eligible for security vulnerabilities.
Instead open a public GitHub issue.

If a vulnerability is platform-dependent, check if the platform is
`supported per :pep:`11`.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`supported per :pep:`11`.
supported per :pep:`11`.

Vulnerabilities that exclusively affect unsupported platforms
may not be accepted.

.. _supported Python versions: https://devguide.python.org/versions/
.. _python-status: https://devguide.python.org/versions/#status-key
Comment on lines +77 to +78
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use :ref:s, if these pages/sections ever move it saves the hassle of fixing links.


What to include and how to structure a vulnerability report?
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non-blocking, maybe followups: Should we request that people include a practical exploit proof of concept or not?

Also: The recently realized theme around "if it was discovered using a publicly available LLM, we may request that it be worked on in public because we should assume a bunch of others have also discovered it and not reported it - or soon will" might be something to codify in here. But probably as a followup a bit later?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, there are reports that absolutely need a PoC, and others that are just made way more complex when reporters try to create one. So I don't think we can have a clear rule on that one, unfortunately. "Include a PoC if it's not obvious how it may be exploited, and we may request one if you don't but we need it"? I don't like that wording, but it's basically the reality.

On tools, "if it was discovered using a publicly available tool, we may request ..." is probably fine. If someone just fires up an open source fuzzer or a new public linter and finds something, it's kinda fair to assume it's not secret. LLMs aren't really that special here, they're just much more versatile than the scanning tools we had before (and more hype, and easier to set up, somehow).

------------------------------------------------------------

For your vulnerability report to be handled efficiently by
the PSRT, the report must include certain information and
be formatted correctly:

* For the initial report and follow-up communications, avoid
overly long, verbose, or excessive structure (such as headers or tables).
Ideally reports should be a few sentences describing the vulnerability and
a proof-of-concept script that reproduces the issue.
* When reporting large numbers or "batches" of vulnerabilities or
searching for potential vulnerabilities using an LLM, you as a reporter must
verify the validity of all reports prior to submission to the PSRT.
PSRT members WILL NOT spend time confirming the validity of reports, only
whether a valid bug report is a vulnerability or not.
Comment on lines +94 to +95
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is maybe confusingly worded. We probably should verify a vulnerability is a vulnerability.

* Do not include severity or CVSS information in your initial report,
this information will be determined by the PSRT.
* Ideally, include a minimal patch with the mitigation for the report.
* If the vulnerability only affects certain Python versions, optionally
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: Should we include some text saying the reporter should also attempt to reproduce the problem on the main branch and include the result of that? Ideally having figured out what already merged change fixed the problem?

include the versions of Python that are affected.
Comment on lines +100 to +101
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* If the vulnerability only affects certain Python versions, optionally
include the versions of Python that are affected.
* Always include the versions of Python that were tested,
and indicate which were found to be vulnerable.

* Reports that do not contain a potential security vulnerability (such as spam
or requesting compliance or due-diligence work)
will be discarded without a reply.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* Submit as plain-text only, including attachments.
  No PDFs, binaries, or other files that cannot be safely reviewed.
  If your proof-of-concept depends on a specially constructed binary file,
  please include a script to construct it rather than the file itself.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest adding "notebooks," we always get those :-/

How to submit a vulnerability report?
-------------------------------------

Submit all potential security vulnerability reports for CPython
to GitHub Security Advisories
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be cautious with this wording, we don't want reports sent to GitHub itself.

by `opening a new ticket <GHSA>`__.
Do not open a public GitHub issue to report a security vulnerability.
For all other projects (such as pip, python.org and tools) or if you're
not sure where to send your report, send an email to
`security@python.org <mailto:security@python.org>`__.

Here's what to expect for how a vulnerability report will be handled:

* Reporter reports the vulnerability privately to the PSRT.
* If the PSRT determines the report isn't a vulnerability, the issue
can be opened in the public issue tracker.
* If the PSRT determines the report is a vulnerability, the PSRT will
accept your report and a CVE ID will be assigned by the PSF CNA.
* Once a public pull request containing a fix is merged to CPython,
the advisory and CVE record will be published with attribution.

For more information about how the PSRT handles vulnerabilities,
`consult the Python Developer Guide <https://devguide.python.org/developer-workflow/psrt/#triaging-a-vulnerability-report>`__.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a :ref:, it is more future proof if the page moves.


PSF Code of Conduct
-------------------

Well-being and safety of the Python Security Response Team members is
prioritized over the technical merit of vulnerability reports.
Despite communications being private, vulnerability reporting is subject
to the `PSF Code of Conduct`_. Violations will be reported to the Code of Conduct
team with undisclosed vulnerability information removed, if applicable.

.. _GHSA: https://github.com/python/cpython/security/advisories/new
.. _PSF Code of Conduct: https://policies.python.org/python.org/code-of-conduct/

CVE Numbering Authority (CNA)
-----------------------------

The Python and pip projects are scoped under the
`Python Software Foundation CVE Numbering Authority <CNA>`__
(CNA). This means you must submit all security
vulnerability reports to the PSRT to receive
a CVE ID for Python or pip. To reach the PSF
Comment on lines +148 to +149
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
vulnerability reports to the PSRT to receive
a CVE ID for Python or pip. To reach the PSF
vulnerability reports to the PSRT for a CVE ID
to be issued for Python or pip. To reach the PSF

CNA contact directly, send an email to
`cna@python.org <mailto:cna@python.org>`__.

.. _CNA: https://www.python.org/cve-numbering-authority/
Loading