Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

der: ASN.1 REAL (f64) decoder panics on short binary-encoding value (index out of bounds)

已关闭 适合新手
#2,482 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
rust

调研方向

从 der/src/asn1/real.rs 中 f64 的 DecodeValue 实现开始,跟踪报告中描述的二进制编码分支。检查如何处理 0x80 这样仅有一个字节的值,然后运行相关的 DER REAL 解码器测试。若格式错误的短内容返回错误而不是触发 panic,即表示完成;报告没有指定具体的测试文件。

由索引模型根据 Issue 内容生成。

描述

Note: this was originally privately disclosed by @tonghuaroot as GHSA-27m6-7r55-vwr2. I am posting it publicly because it's in an off-by-default obscure feature that no one uses, and because we continue to receive duplicate LLM-generated reports about it.

The ASN.1 REAL decoder in the der crate (impl DecodeValue for f64, der/src/asn1/real.rs) validates only a minimum on the value content
length (header.length() == Length::ZERO) and then, for the binary-encoding branch, reads fixed byte offsets (bytes[1], and bytes[2] for the
two-octet exponent form) out of the attacker-controlled value content without confirming the content is long enough to hold the exponent field.

A DER REAL value whose content is the single byte 0x80 reaches bytes[1] on a length-1 slice and triggers an index out of bounds panic
instead of returning Err. Any code that calls f64::from_der / f64::decode (or decodes a struct containing an f64) on untrusted bytes.

I will further add that accepting this feature at all was likely a mistake given the security/crypto-oriented nature of this library. It should probably be removed entirely in the next breaking release.

主要语言
Rust
星标
343
派生
195
平均合并
1 天 17 小时
30 天内合并 PR
24

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

RustCrypto/formats 的其他 Issue

查看 RustCrypto/formats 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。