# 資安漏洞

依公布年份列出影響 Rust 標準庫（std）與工具鏈（rustc、cargo、rustdoc）的所有已知漏洞；摘要為官方原文，「影響範圍」與「修正於」都換算成 Rust 版本號。

想知道某個版本受哪些漏洞影響，請看該版本頁的「已知漏洞」；檢查專案相依的第三方 crate 有沒有漏洞，用 `cargo install cargo-audit` 後執行 `cargo audit`（資料來自 RustSec）。

## 社群資安討論（Hacker News）

近一年 Hacker News 上與 Rust 標準庫、工具鏈資安相關的討論，依日期排序；有對應官方漏洞編號的會一併列出。標題與連結為原文，內容以官方公告為準。

| 日期 | 標題 | 分數／留言 | 官方編號 |
| --- | --- | --- | --- |
| 2026-03-21 | [Security Advisory for Cargo](https://blog.rust-lang.org/2026/03/21/cve-2026-33056/)（[討論](https://news.ycombinator.com/item?id=47469957)） | 11／0 | CVE-2026-33056 |

## 2026

| 編號 | 元件 | 摘要（官方原文） | 影響範圍 | 修正於 |
| --- | --- | --- | --- | --- |
| [CVE-2025-15661](https://www.cve.org/CVERecord?id=CVE-2025-15661) | cargo | Cargo: apply patches for CVE-2025-15661, CVE-2026-55199, and CVE-2026-55200 to libssh2 | 未公布 | [1.96.1](/rust-1-96) |
| [CVE-2026-55199](https://www.cve.org/CVERecord?id=CVE-2026-55199) | cargo | Cargo: apply patches for CVE-2025-15661, CVE-2026-55199, and CVE-2026-55200 to libssh2 | 未公布 | [1.96.1](/rust-1-96) |
| [CVE-2026-55200](https://www.cve.org/CVERecord?id=CVE-2026-55200) | cargo | Cargo: apply patches for CVE-2025-15661, CVE-2026-55199, and CVE-2026-55200 to libssh2 | 未公布 | [1.96.1](/rust-1-96) |
| [CVE-2026-5222](https://github.com/rust-lang/cargo/security/advisories/GHSA-p688-r7jv-fm6f) | cargo | Cargo can be coerced to share credentials between registries | 早於 1.96.0 | [1.96.0](/rust-1-96) |
| [CVE-2026-5223](https://github.com/rust-lang/cargo/security/advisories/GHSA-jq42-7mfv-hm57) | cargo | Crates in third party registries can override the cached source of other crates | 早於 1.96.0 | [1.96.0](/rust-1-96) |
| [CVE-2026-40200](https://www.cve.org/CVERecord?id=CVE-2026-40200) | vendored | Apply patches for CVE-2026-6042 and CVE-2026-40200 to vendored musl | 未公布 | [1.95.0](/rust-1-95) |
| [CVE-2026-6042](https://www.cve.org/CVERecord?id=CVE-2026-6042) | vendored | Apply patches for CVE-2026-6042 and CVE-2026-40200 to vendored musl | 未公布 | [1.95.0](/rust-1-95) |
| [CVE-2026-33055](https://www.cve.org/CVERecord?id=CVE-2026-33055) | cargo | Cargo: update tar to 0.4.45 This resolves CVE-2026-33055 and CVE-2026-33056. Users of crates.io are not affected. See blog for more details. | 未公布 | [1.94.1](/rust-1-94) |
| [CVE-2026-33056](https://www.cve.org/CVERecord?id=CVE-2026-33056) | cargo | Cargo: update tar to 0.4.45 This resolves CVE-2026-33055 and CVE-2026-33056. Users of crates.io are not affected. See blog for more details. | 未公布 | [1.94.1](/rust-1-94) |

## 2025

| 編號 | 元件 | 摘要（官方原文） | 影響範圍 | 修正於 |
| --- | --- | --- | --- | --- |
| [CVE-2025-11233](https://github.com/rust-lang/rust/security/advisories/GHSA-rv9c-3mvf-cw9h) | std | Rust standard library didn't detect all path separators on Cygwin | 1.87.0 起，早於 1.89.0 | [1.89.0](/rust-1-89) |

## 2024

| 編號 | 元件 | 摘要（官方原文） | 影響範圍 | 修正於 |
| --- | --- | --- | --- | --- |
| [CVE-2024-43402](https://github.com/rust-lang/rust/security/advisories/GHSA-2xg3-7mm6-98jj) | std | `std::process::Command` batch files argument escaping could be bypassed with trailing whitespace or periods | 早於 1.81.0 | [1.81.0](/rust-1-81) |
| [CVE-2024-24576](https://github.com/rust-lang/rust/security/advisories/GHSA-q455-m56c-85mh) | std | `std::process::Command` did not properly escape arguments of batch files on Windows | 早於 1.77.2 | [1.77.2](/rust-1-77) |

## 2023

| 編號 | 元件 | 摘要（官方原文） | 影響範圍 | 修正於 |
| --- | --- | --- | --- | --- |
| [CVE-2023-40030](https://github.com/rust-lang/cargo/security/advisories/GHSA-wrrj-h57r-vx9p) | cargo | Malicious dependencies can inject arbitrary JavaScript into cargo-generated timing reports | 1.60.0 起，早於 1.72.0 | [1.72.0](/rust-1-72) |
| [CVE-2023-38497](https://github.com/rust-lang/cargo/security/advisories/GHSA-j3xp-wfr4-hx87) | cargo | Cargo not respecting umask when extracting crate archives | 早於 1.71.1 | [1.71.1](/rust-1-71) |
| [CVE-2022-46176](https://github.com/rust-lang/cargo/security/advisories/GHSA-r5w3-xm58-jv6j) | cargo | Cargo did not verify SSH host keys | 早於 1.66.1 | [1.66.1](/rust-1-66) |

## 2022

| 編號 | 元件 | 摘要（官方原文） | 影響範圍 | 修正於 |
| --- | --- | --- | --- | --- |
| [CVE-2022-36113](https://github.com/rust-lang/cargo/security/advisories/GHSA-rfj2-q3h3-hm5j) | cargo | Extracting malicious crates can corrupt arbitrary files | 早於 1.64.0 | [1.64.0](/rust-1-64) |
| [CVE-2022-36114](https://github.com/rust-lang/cargo/security/advisories/GHSA-2hvr-h6gw-qrxp) | cargo | Extracting malicious crates can fill the file system | 早於 1.64.0 | [1.64.0](/rust-1-64) |
| [CVE-2022-21658](https://github.com/rust-lang/rust/security/advisories/GHSA-r9cc-f5pr-p3j2) | std | Race condition in std::fs::remove_dir_all | 早於 1.58.1 | [1.58.1](/rust-1-58) |

## 2021

| 編號 | 元件 | 摘要（官方原文） | 影響範圍 | 修正於 |
| --- | --- | --- | --- | --- |
| [CVE-2021-42574](https://github.com/rust-lang/rust/security/advisories/GHSA-rcv6-wg5m-24v6) | rustc | rustc and bidirectional-override codepoints in source code | 早於 1.56.1 | [1.56.1](/rust-1-56) |
| [CVE-2021-31162](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-31162) | std | Double free in Vec::from_iter specialization when drop panics | 1.48.0 起，早於 1.52.0 | [1.52.0](/rust-1-52) |
| [CVE-2021-28878](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-28878) | std | Zip may call __iterator_get_unchecked twice with the same index | 1.14.0 起，早於 1.52.0 | [1.52.0](/rust-1-52) |
| [CVE-2021-28879](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-28879) | std | Zip can cause buffer overflow when a consumed Zip iterator is used again | 1.14.0 起，早於 1.52.0 | [1.52.0](/rust-1-52) |
| [CVE-2021-28876](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-28876) | std | Panic safety issue in Zip specialization | 1.14.0 起，早於 1.52.0 | [1.52.0](/rust-1-52) |
| [CVE-2021-28875](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-28875) | std | Logic bug in Read can cause buffer overflow in read_to_end() | 1.20.0 起，早於 1.50.0 | [1.50.0](/rust-1-50) |
| [CVE-2021-28877](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-28877) | std | TrustedRandomAccess specialization composes incorrectly for nested iter::Zips | 1.11.0 起，早於 1.51.0 | [1.51.0](/rust-1-51) |

## 2020

| 編號 | 元件 | 摘要（官方原文） | 影響範圍 | 修正於 |
| --- | --- | --- | --- | --- |
| [CVE-2020-36323](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-36323) | std | API soundness issue in join() implementation of \[Borrow\<str\>\] | 1.28.0 起，早於 1.52.0 | [1.52.0](/rust-1-52) |
| [CVE-2020-36318](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-36318) | std | VecDeque::make_contiguous may duplicate the contained elements | 1.48.0 起，早於 1.49.0 | [1.49.0](/rust-1-49) |
| [CVE-2020-36317](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-36317) | std | String::retain allows safely creating invalid strings when abusing panic | 1.26.0 起，早於 1.49.0 | [1.49.0](/rust-1-49) |
| [CVE-2020-1967](https://www.cve.org/CVERecord?id=CVE-2020-1967) | vendored | Updated openssl-src to 1.1.1g for CVE-2020-1967. | 未公布 | [1.43.1](/rust-1-43) |
| [CVE-2021-29922](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29922) | std | Improper Input Validation of octal literals in `std::net` | 早於 1.53.0 | [1.53.0](/rust-1-53) |

## 2019

| 編號 | 元件 | 摘要（官方原文） | 影響範圍 | 修正於 |
| --- | --- | --- | --- | --- |
| [CVE-2019-16760](https://github.com/rust-lang/rust/security/advisories/GHSA-phjm-8x66-qw4r) | cargo | Cargo prior to Rust 1.26.0 may download the wrong dependency | 早於 1.26.0 | [1.26.0](/rust-1-26) |
| [CVE-2019-12083](https://groups.google.com/forum/#!topic/rustlang-security-announcements/aZabeCMUv70) | std | Memory safety vulnerabilities arising from `Error::type_id` | 1.34.0 起，早於 1.34.2 | [1.34.2](/rust-1-34) |

## 2018

| 編號 | 元件 | 摘要（官方原文） | 影響範圍 | 修正於 |
| --- | --- | --- | --- | --- |
| [CVE-2018-1000810](https://groups.google.com/forum/#!topic/rustlang-security-announcements/CmSuTm-SaU0) | std | Buffer overflow vulnerability in str::repeat() | 1.26.0 起，早於 1.29.1 | [1.29.1](/rust-1-29) |
| [CVE-2019-1010299](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-1010299) | std | vec_deque::Iter has unsound Debug implementation | 1.18.0 起，早於 1.30.0 | [1.30.0](/rust-1-30) |
| [CVE-2018-1000657](https://github.com/rust-lang/rust/issues/44800) | std | Buffer overflow vulnerability in VecDeque::reserve() | 1.3.0 起，早於 1.22.0 | [1.22.0](/rust-1-22) |
| [CVE-2018-1000622](https://groups.google.com/forum/#!topic/rustlang-security-announcements/4ybxYLTtXuM) | rustdoc | Uncontrolled search path element vulnerability in rustdoc plugins | 早於 1.27.1 | [1.27.1](/rust-1-27) |
| [CVE-2018-25008](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-25008) | std | Insufficient synchronization in `Arc::get_mut` | 1.3.0 起，早於 1.29.0 | [1.29.0](/rust-1-29) |

## 2017

| 編號 | 元件 | 摘要（官方原文） | 影響範圍 | 修正於 |
| --- | --- | --- | --- | --- |
| [CVE-2017-20004](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-20004) | std | MutexGuard\<Cell\<i32\>\> must not be Sync | 早於 1.19.0 | [1.19.0](/rust-1-19) |

## 2015

| 編號 | 元件 | 摘要（官方原文） | 影響範圍 | 修正於 |
| --- | --- | --- | --- | --- |
| [CVE-2015-20001](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2015-20001) | std | Panic safety violation in BinaryHeap | 早於 1.2.0 | [1.2.0](/rust-1-2) |

## 資料來源

- [rust-lang/rust 安全公告](https://github.com/rust-lang/rust/security/advisories)
- [rust-lang/cargo 安全公告](https://github.com/rust-lang/cargo/security/advisories)
- [RustSec Advisory Database：rust/](https://github.com/rustsec/advisory-db/tree/main/rust)（標準庫與工具鏈）
- [Rust 安全政策](https://www.rust-lang.org/policies/security)
- [Hacker News](https://news.ycombinator.com)（透過 hn.algolia.com 搜尋 API）
