uvでPythonパッケージの脆弱性監査(uv audit)とマルウェアチェック(UV_MALWARE_CHECK)を試してみた
Pythonの環境構築では uv がデファクトスタンダードになりつつあります。
uvは2026年6月に、2つのセキュリティ系機能をプレビュー追加しました。
Vulnerability and malware checks in uv@2026年6月8日公開
uv auditは、依存パッケージにある脆弱性や隔離の影響を受けていないかチェックするコマンドでpip-auditのuv版- 環境変数
UV_MALWARE_CHECK=1とすると、uv syncやuv addのたびに、マルウェアのアドバイザリを照会し、 インストールしようとしているパッケージがマルウェアのアドバイザリに載っていれば、処理を中断
uv のバージョン 0.11.25 でこの2つの機能を試してみます。
uv auditでパッケージを監査
脆弱なバージョンをわざと固定した検証用プロジェクトを作って、監査してみます。
$ cd /tmp
$ uv init uv-audit-test
$ cd uv-audit-test
$ uv add "aiohttp==3.14.0"
$ uv audit
uv auditはプレビュー機能で、そのまま実行するとexperimentalの警告が出ます。警告を消したいときだけ--preview-features auditを付けます。出力の先頭には、まずサマリ行が表示されます。
Found 9 known vulnerabilities and no adverse project statuses in 9 packages
続いて、パッケージごとの脆弱性が並びます。IDはGHSA / PYSEC / CVEの形式で、修正済みバージョンとアドバイザリのURLも付いてきます。
Vulnerabilities:
aiohttp 3.14.0 has 9 known vulnerabilities:
- GHSA-4fvr-rgm6-gqmc: aiohttp: HTTP/1 Pipelined Requests Queue Without Limit
Fixed in: 3.14.1
Advisory information: https://github.com/aio-libs/aiohttp/security/advisories/GHSA-4fvr-rgm6-gqmc
- GHSA-4m7w-qmgq-4wj5: aiohttp: TLS Server Hostname Override Is Ignored When Reusing HTTPS Connections
Fixed in: 3.14.1
Advisory information: https://github.com/aio-libs/aiohttp/security/advisories/GHSA-4m7w-qmgq-4wj5
- GHSA-xcgm-r5h9-7989: aiohttp: Incomplete websocket frame payloads bypass memory limits
Fixed in: 3.14.1
Advisory information: https://github.com/aio-libs/aiohttp/security/advisories/GHSA-xcgm-r5h9-7989
- PYSEC-2026-237: No summary provided
Fixed in: 3.14.1
Advisory information: https://github.com/aio-libs/aiohttp/security/advisories/GHSA-4m7w-qmgq-4wj5
...
脆弱性が見つかると、終了コードは1になります。
aiohttp を 3.14.1 に上げると、脆弱性報告はなくなります。
$ uv audit
Found no known vulnerabilities and no adverse project statuses in 9 packages
$ echo $?
0
UV_MALWARE_CHECK=1でマルウェア混入バージョンを検出
環境変数UV_MALWARE_CHECK=1で uv add や uv sync を実行すると、バージョンがマルウェアの影響を受けているかチェックします。
検証パッケージとして、2026年3月にサプライチェーン攻撃を受けた Telnyx Python SDK の 4.87.1 を利用します。
Telnyx Python SDK Security Notice: Malicious PyPI Versions Identified (March 2026)
侵害を受けたバージョンはパッケージレジストリ(PyPI)からは削除済みです。
$ UV_MALWARE_CHECK=1 uv add "telnyx==4.87.1"
× No solution found when resolving dependencies:
╰─▶ Because there is no version of telnyx==4.87.1 and your project depends on telnyx==4.87.1, we can conclude that your project's
requirements are unsatisfiable.
hint: If you want to add the package regardless of the failed resolution, provide the `--frozen` flag to skip locking and syncing
そのため、検証用 uv.lock ファイルを用意し、--frozen オプションを渡して解決をスキップしてロックファイルの情報を正としてインストールを試みます。
以下のような uv.lock を用意します。
version = 1
revision = 3
requires-python = ">=3.14"
[[package]]
name = "uv-mal-repro"
version = "0.1.0"
source = { virtual = "." }
dependencies = [
{ name = "telnyx" },
]
[package.metadata]
requires-dist = [{ name = "telnyx" }]
[[package]]
name = "telnyx"
version = "4.87.1"
source = { registry = "https://pypi.org/simple" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/00/00/telnyx-4.87.1-py3-none-any.whl", hash = "sha256:0000000000000000000000000000000000000000000000000000000000000000", size = 1000 },
]
続いて、以下のような pyproject.toml を用意します。
[project]
name = "uv-mal-repro"
version = "0.1.0"
requires-python = ">=3.14"
dependencies = ["telnyx==4.87.1"]
uv sync を実行すると、lock ファイルの wheels URLはダミーにも関わらず、マルウェアが検知され、エラー終了しています。
マルウェアチェックがダウンロードより前に走り、パッケージ名とバージョンを OSV へ照会するからです。
$ UV_MALWARE_CHECK=1 uv sync --frozen
Using CPython 3.14.4
Creating virtual environment at: .venv
warning: Malware checks are experimental and may change without warning. Pass `--preview-features malware-check` to disable this warning.
warning: Malware detected in locked dependencies:
- `telnyx==4.87.1`: MAL-2026-2254 (https://osv.dev/vulnerability/MAL-2026-2254)
error: Malware detected in one or more dependencies that would be installed; aborting sync. Set `UV_MALWARE_CHECK=0` to bypass this
check.
$ echo $?
2
脆弱性データはどこから来るのか
uv が照合している Open Source Vulnerabilities(OSV) は、いろいろな言語のエコシステムを横断して脆弱性アドバイザリを集めている分散型のデータベースです。マルウェア用のMAL advisoryも、同じくOSVが持っています。
uv audit の PYSEC-2026-237 や GHSA-4fvr-rgm6-gqmc といった出力結果からわかるように、OSVは Python Packaging Advisory Database(PYSEC) や GitHub Advisory Database(GHSA) を含む複数のソースから脆弱性情報を集めています。
まとめ
Pythonのパッケージ管理ツールuvにプレビュー追加された、脆弱性監査のuv auditとマルウェアチェックのUV_MALWARE_CHECK=1 を紹介しました。
GitHub側はDependabot等にまかせ、クライアント側で、uv のエコシステムに閉じて脆弱性やマルウェアを監査できるのは便利です。
ロードマップを見ると、 uv.lock 以外の requirements.txt 対応や、OSV以外の脆弱性データベースの追加も検討されているようです。今後の発展に期待です。





