Skip to content

tmpdir: fix insecure temporary directory vulnerability (CVE-2025-71176)#14343

Merged
bluetech merged 1 commit intopytest-dev:mainfrom
bluetech:cve-2025-71176-simple
Apr 7, 2026
Merged

tmpdir: fix insecure temporary directory vulnerability (CVE-2025-71176)#14343
bluetech merged 1 commit intopytest-dev:mainfrom
bluetech:cve-2025-71176-simple

Conversation

@bluetech
Copy link
Copy Markdown
Member

This is my proposed alternative to #13669 as discussed in the issue. I think we should go with the simple fix for now. I think this one should be safe to backport.

A previous fix for insecure temporary directory issue c49100c wasn't sufficient because it followed symlinks.

Stop following symlinks, and reject if a symlink; we know it shouldn't be.

Fix #14279.

[0] https://www.openwall.com/lists/oss-security/2026/01/21/5

@bluetech bluetech added the backport 9.0.x apply to PRs at any point; backports the changes to the 9.0.x branch label Mar 31, 2026
A previous fix for insecure temporary directory issue
c49100c wasn't sufficient because it
followed symlinks.

Stop following symlinks, and reject if a symlink; we know it shouldn't
be.

Fix pytest-dev#14279.

[0] https://www.openwall.com/lists/oss-security/2026/01/21/5
@bluetech bluetech force-pushed the cve-2025-71176-simple branch from 7479218 to 7161cfe Compare March 31, 2026 15:21
@psf-chronographer psf-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Mar 31, 2026
Copy link
Copy Markdown
Member

@nicoddemus nicoddemus left a comment

Choose a reason for hiding this comment

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

LGTM!

@bluetech bluetech merged commit 95d8423 into pytest-dev:main Apr 7, 2026
33 checks passed
@bluetech bluetech deleted the cve-2025-71176-simple branch April 7, 2026 14:43
@patchback
Copy link
Copy Markdown

patchback Bot commented Apr 7, 2026

Backport to 9.0.x: 💚 backport PR created

✅ Backport PR branch: patchback/backports/9.0.x/95d8423bd24992deea5b9df32555fa1741679e2c/pr-14343

Backported as #14363

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback Bot pushed a commit that referenced this pull request Apr 7, 2026
tmpdir: fix insecure temporary directory vulnerability (CVE-2025-71176)
(cherry picked from commit 95d8423)
bluetech added a commit that referenced this pull request Apr 7, 2026
…5d8423bd24992deea5b9df32555fa1741679e2c/pr-14343

[PR #14343/95d8423b backport][9.0.x] tmpdir: fix insecure temporary directory vulnerability (CVE-2025-71176)
luketainton pushed a commit to luketainton/repos_epage that referenced this pull request Apr 13, 2026
This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [pytest](https://github.com/pytest-dev/pytest) ([changelog](https://docs.pytest.org/en/stable/changelog.html)) | `9.0.2` → `9.0.3` | ![age](https://developer.mend.io/api/mc/badges/age/pypi/pytest/9.0.3?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/pytest/9.0.2/9.0.3?slim=true) |

---

### pytest has vulnerable tmpdir handling
[CVE-2025-71176](https://nvd.nist.gov/vuln/detail/CVE-2025-71176) / [GHSA-6w46-j5rx-g56g](GHSA-6w46-j5rx-g56g)

<details>
<summary>More information</summary>

#### Details
pytest through 9.0.2 on UNIX relies on directories with the `/tmp/pytest-of-{user}` name pattern, which allows local users to cause a denial of service or possibly gain privileges.

#### Severity
- CVSS Score: 6.8 / 10 (Medium)
- Vector String: `CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:L`

#### References
- [https://nvd.nist.gov/vuln/detail/CVE-2025-71176](https://nvd.nist.gov/vuln/detail/CVE-2025-71176)
- [https://github.com/pytest-dev/pytest/issues/13669](https://github.com/pytest-dev/pytest/issues/13669)
- [https://github.com/pytest-dev/pytest/pull/14343](https://github.com/pytest-dev/pytest/pull/14343)
- [https://github.com/pytest-dev/pytest/commit/95d8423bd24992deea5b9df32555fa1741679e2c](https://github.com/pytest-dev/pytest/commit/95d8423bd24992deea5b9df32555fa1741679e2c)
- [https://github.com/pytest-dev/pytes](https://github.com/pytest-dev/pytes)
- [https://github.com/pytest-dev/pytest/releases/tag/9.0.3](https://github.com/pytest-dev/pytest/releases/tag/9.0.3)
- [https://www.openwall.com/lists/oss-security/2026/01/21/5](https://www.openwall.com/lists/oss-security/2026/01/21/5)

This data is provided by [OSV](https://osv.dev/vulnerability/GHSA-6w46-j5rx-g56g) and the [GitHub Advisory Database](https://github.com/github/advisory-database) ([CC-BY 4.0](https://github.com/github/advisory-database/blob/main/LICENSE.md)).
</details>

---

### Release Notes

<details>
<summary>pytest-dev/pytest (pytest)</summary>

### [`v9.0.3`](https://github.com/pytest-dev/pytest/releases/tag/9.0.3)

[Compare Source](pytest-dev/pytest@9.0.2...9.0.3)

### pytest 9.0.3 (2026-04-07)

#### Bug fixes

- [#&#8203;12444](pytest-dev/pytest#12444): Fixed `pytest.approx` which now correctly takes into account `~collections.abc.Mapping` keys order to compare them.

- [#&#8203;13634](pytest-dev/pytest#13634): Blocking a `conftest.py` file using the `-p no:` option is now explicitly disallowed.

  Previously this resulted in an internal assertion failure during plugin loading.

  Pytest now raises a clear `UsageError` explaining that conftest files are not plugins and cannot be disabled via `-p`.

- [#&#8203;13734](pytest-dev/pytest#13734): Fixed crash when a test raises an exceptiongroup with `__tracebackhide__ = True`.

- [#&#8203;14195](pytest-dev/pytest#14195): Fixed an issue where non-string messages passed to <span class="title-ref">unittest.TestCase.subTest()</span> were not printed.

- [#&#8203;14343](pytest-dev/pytest#14343): Fixed use of insecure temporary directory (CVE-2025-71176).

#### Improved documentation

- [#&#8203;13388](pytest-dev/pytest#13388): Clarified documentation for `-p` vs `PYTEST_PLUGINS` plugin loading and fixed an incorrect `-p` example.
- [#&#8203;13731](pytest-dev/pytest#13731): Clarified that capture fixtures (e.g. `capsys` and `capfd`) take precedence over the `-s` / `--capture=no` command-line options in `Accessing captured output from a test function <accessing-captured-output>`.
- [#&#8203;14088](pytest-dev/pytest#14088): Clarified that the default `pytest_collection` hook sets `session.items` before it calls `pytest_collection_finish`, not after.
- [#&#8203;14255](pytest-dev/pytest#14255): TOML integer log levels must be quoted: Updating reference documentation.

#### Contributor-facing changes

- [#&#8203;12689](pytest-dev/pytest#12689): The test reports are now published to Codecov from GitHub Actions.
  The test statistics is visible [on the web interface](https://app.codecov.io/gh/pytest-dev/pytest/tests).

  \-- by `aleguy02`

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - ""
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMTMuMCIsInVwZGF0ZWRJblZlciI6IjQzLjExMy4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJzZWN1cml0eSJdfQ==-->

Reviewed-on: https://git.tainton.uk/repos/epage/pulls/217
Co-authored-by: renovate[bot] <renovate-bot@git.tainton.uk>
Co-committed-by: renovate[bot] <renovate-bot@git.tainton.uk>
736-c41-2c1-e464fc974 pushed a commit to Swiss-Armed-Forces/Loom that referenced this pull request Apr 19, 2026
This MR contains the following updates:

| Package | Type | Update | Change | OpenSSF |
|---|---|---|---|---|
| [identify](https://github.com/pre-commit/identify) | dev | patch | `2.6.18` → `2.6.19` | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/pre-commit/identify/badge)](https://securityscorecards.dev/viewer/?uri=github.com/pre-commit/identify) |
| [pytest](https://github.com/pytest-dev/pytest) ([changelog](https://docs.pytest.org/en/stable/changelog.html)) | test | patch | `9.0.2` → `9.0.3` | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/pytest-dev/pytest/badge)](https://securityscorecards.dev/viewer/?uri=github.com/pytest-dev/pytest) |

---

### Release Notes

<details>
<summary>pre-commit/identify (identify)</summary>

### [`v2.6.19`](pre-commit/identify@v2.6.18...v2.6.19)

[Compare Source](pre-commit/identify@v2.6.18...v2.6.19)

</details>

<details>
<summary>pytest-dev/pytest (pytest)</summary>

### [`v9.0.3`](https://github.com/pytest-dev/pytest/releases/tag/9.0.3)

[Compare Source](pytest-dev/pytest@9.0.2...9.0.3)

### pytest 9.0.3 (2026-04-07)

#### Bug fixes

- [#&#8203;12444](pytest-dev/pytest#12444): Fixed `pytest.approx` which now correctly takes into account `~collections.abc.Mapping` keys order to compare them.

- [#&#8203;13634](pytest-dev/pytest#13634): Blocking a `conftest.py` file using the `-p no:` option is now explicitly disallowed.

  Previously this resulted in an internal assertion failure during plugin loading.

  Pytest now raises a clear `UsageError` explaining that conftest files are not plugins and cannot be disabled via `-p`.

- [#&#8203;13734](pytest-dev/pytest#13734): Fixed crash when a test raises an exceptiongroup with `__tracebackhide__ = True`.

- [#&#8203;14195](pytest-dev/pytest#14195): Fixed an issue where non-string messages passed to <span class="title-ref">unittest.TestCase.subTest()</span> were not printed.

- [#&#8203;14343](pytest-dev/pytest#14343): Fixed use of insecure temporary directory (CVE-2025-71176).

#### Improved documentation

- [#&#8203;13388](pytest-dev/pytest#13388): Clarified documentation for `-p` vs `PYTEST_PLUGINS` plugin loading and fixed an incorrect `-p` example.
- [#&#8203;13731](pytest-dev/pytest#13731): Clarified that capture fixtures (e.g. `capsys` and `capfd`) take precedence over the `-s` / `--capture=no` command-line options in `Accessing captured output from a test function <accessing-captured-output>`.
- [#&#8203;14088](pytest-dev/pytest#14088): Clarified that the default `pytest_collection` hook sets `session.items` before it calls `pytest_collection_finish`, not after.
- [#&#8203;14255](pytest-dev/pytest#14255): TOML integer log levels must be quoted: Updating reference documentation.

#### Contributor-facing changes

- [#&#8203;12689](pytest-dev/pytest#12689): The test reports are now published to Codecov from GitHub Actions.
  The test statistics is visible [on the web interface](https://app.codecov.io/gh/pytest-dev/pytest/tests).

  \-- by `aleguy02`

</details>

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMjkuMCIsInVwZGF0ZWRJblZlciI6IjQzLjEyOS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJyZW5vdmF0ZSJdfQ==-->

See merge request swiss-armed-forces/cyber-command/cea/loom!481

Co-authored-by: Loom MR Pipeline Trigger <group_103951964_bot_9504bb8dead6d4e406ad817a607f24be@noreply.gitlab.com>
pull Bot pushed a commit to Stars1233/tt-metal that referenced this pull request Apr 28, 2026
### Summary

Fix security vulnerabilities by bumping python dependencies.

pytest through 9.0.2 on UNIX relies on directories with the
`/tmp/pytest-of-{user}` name pattern, which allows local users to cause
a denial of service or possibly gain privileges.
[tenstorrent#14343](pytest-dev/pytest#14343): Fixed use
of insecure temporary directory (CVE-2025-71176).

Pillow did not limit the amount of GZIP-compressed data read when
decoding a FITS image, making it vulnerable to decompression bomb
attacks. A specially crafted FITS file could cause unbounded memory
consumption, leading to denial of service (OOM crash or severe
performance degradation).
Fix CVE number python-pillow/Pillow#9430

nbconvert has an Arbitrary File Read/Write via Path Traversal
nbconvert allows arbitrary file writes to locations outside the intended
output directory when processing notebooks containing crafted cell
attachment filenames. The ExtractAttachmentsPreprocessor passes
attachment filenames directly to the filesystem without sanitization,
enabling path traversal attacks. This vulnerability provides complete
control over both the destination path and file extension.

lxml: Default configuration of iterparse() and ETCompatXMLParser()
allows XXE to local files. lxml 6.1.0 changes the default to
resolve_entities='internal', thus disallowing local file access by
default. See `CVE-2026-41066`.

### CI Status
_Auto-generated on every push. Badges update live. Click a badge to
filter runs by this branch._

-
[![](https://github.com/tenstorrent/tt-metal/actions/workflows/sanity-tests.yaml/badge.svg?branch=vlad/bump-python-dependencies)](https://github.com/tenstorrent/tt-metal/actions/workflows/sanity-tests.yaml?query=branch:vlad/bump-python-dependencies)
-
[![](https://github.com/tenstorrent/tt-metal/actions/workflows/runtime-sanity-tests.yaml/badge.svg?branch=vlad/bump-python-dependencies)](https://github.com/tenstorrent/tt-metal/actions/workflows/runtime-sanity-tests.yaml?query=branch:vlad/bump-python-dependencies)
-
[![](https://github.com/tenstorrent/tt-metal/actions/workflows/blackhole-post-commit.yaml/badge.svg?branch=vlad/bump-python-dependencies)](https://github.com/tenstorrent/tt-metal/actions/workflows/blackhole-post-commit.yaml?query=branch:vlad/bump-python-dependencies)
-
[![](https://github.com/tenstorrent/tt-metal/actions/workflows/tt-metal-l2-nightly.yaml/badge.svg?branch=vlad/bump-python-dependencies)](https://github.com/tenstorrent/tt-metal/actions/workflows/tt-metal-l2-nightly.yaml?query=branch:vlad/bump-python-dependencies)
-
[![](https://github.com/tenstorrent/tt-metal/actions/workflows/all-model-tests.yaml/badge.svg?branch=vlad/bump-python-dependencies)](https://github.com/tenstorrent/tt-metal/actions/workflows/all-model-tests.yaml?query=branch:vlad/bump-python-dependencies)
-
[![](https://github.com/tenstorrent/tt-metal/actions/workflows/pipeline-select.yaml/badge.svg?branch=vlad/bump-python-dependencies)](https://github.com/tenstorrent/tt-metal/actions/workflows/pipeline-select.yaml?query=branch:vlad/bump-python-dependencies)
-
[![](https://github.com/tenstorrent/tt-metal/actions/workflows/pipeline-select-t3k.yaml/badge.svg?branch=vlad/bump-python-dependencies)](https://github.com/tenstorrent/tt-metal/actions/workflows/pipeline-select-t3k.yaml?query=branch:vlad/bump-python-dependencies)
-
[![](https://github.com/tenstorrent/tt-metal/actions/workflows/pipeline-select-galaxy.yaml/badge.svg?branch=vlad/bump-python-dependencies)](https://github.com/tenstorrent/tt-metal/actions/workflows/pipeline-select-galaxy.yaml?query=branch:vlad/bump-python-dependencies)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport 9.0.x apply to PRs at any point; backports the changes to the 9.0.x branch bot:chronographer:provided (automation) changelog entry is part of PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants