Open
grub2: net/ethernet 报文头长度未校验导致越界读 #200
Lei-ChenAdd on  18 days ago
Lei-Chen
18 days ago Create

grub_net_recv_ethernet_packet()(grub-core/net/ethernet.c)在解析以太网帧前未校验 nb->data..nb->tail 的实际长度,直接读取以太网头、VLAN 标签、LLC 头和 SNAP 头。长度小于 14 字节或不足以容纳扩展头的截断帧会越界读取堆缓冲区,导致 GRUB 崩溃或信息泄露。该函数是 PXE / HTTP Boot / TFTP 的收包入口,攻击面来自链路上的 DHCP/PXE 服务器或可注入报文的本地网络。

上游修复 ed69a06504ecf07cf68732e3571a60d28a1ff365 在以太网头、VLAN、LLC、SNAP 四处增加长度校验,长度不足时丢弃报文:
https://gitlab.freedesktop.org/gnu-grub/grub/-/commit/ed69a06504ecf07cf68732e3571a60d28a1ff365

复现:向该函数传入小于 sizeof(struct etherhdr) 的 grub_net_buff(如截断以太网帧),ASan 或带边界检查的构建可观察到越界读;修复后短帧被直接丢弃。

影响分支:master、openEuler-26.09、openEuler-24.03-LTS-SP3,24.03 其余分支经核实后 /sync。补丁 backport-net-ethernet-validate-packet-length.patch 在各分支完成补丁链和构建验证。

无 CVE。

likedislike
LLei-Chen
18 days ago changed custom category from 任务 to 缺陷
openeuler-ci-botopeneuler-ci-botCollaborators
18 days ago Assign ouuleilei as responsible person
openeuler-ci-botopeneuler-ci-botCollaborators
18 days ago Assign overweight、zhuchunyi、zhangqiumiao、han_hui_hui、hello-leichen、shenyangyang as responsible person, remove original responsible person: ouuleilei
openeuler-ci-botopeneuler-ci-botCollaborators
18 days ago Modify description of issue
openeuler-ci-botopeneuler-ci-botCollaborators
18 days ago Assign ouuleilei as responsible person, remove original responsible person: overweight、zhuchunyi、zhangqiumiao、han_hui_hui、hello-leichen、shenyangyang
openeuler-ci-botopeneuler-ci-botCollaborators
18 days ago Added label: sig/sig-OS-Builder
openeuler-ci-bot
openeuler-ci-botCollaborators
18 days ago Comments:

Welcome To openEuler Community

Hey @hello-leichen , thanks for your contribution to the community.

Bot Usage Manual

I'm the Bot here serving you. You can find the instructions on how to interact with me at Here . That means you can comment below every pull request or issue to trigger Bot Commands. You can self-configure the PR merge rules for this repository. For more details, please refer to Here.

Contact Guide

If you have any questions, please contact the SIG: sig-OS-Builder ,
and any of the maintainers: @han_hui_hui, @overweight, @shenyangyang, @zhangqiumiao, @zhuchunyi ,
and any of the committers: @ouuleilei, @yue-yuankun, @zhangqiumiao .

likedislike
openeuler-ci-bot
openeuler-ci-botCollaborators
18 days ago Comments:

以下的要求不是强制性的, 未按模板评论时对issue无任何影响
issue处理注意事项:
1. 当前issue受影响的分支提交pr时, 须在pr描述中填写当前issue编号进行关联, 否则无法关闭当前issue;
2. 模板内容需要填写完整, 无论是受影响或者不受影响都需要填写完整内容,未引入的分支不需要填写, 否则无法关闭当前issue;
3. 以下为模板中需要填写完整的内容, 请复制到评论区回复, 注: 内容的标题名称(影响性分析说明, 缺陷严重等级, 受影响版本排查(受影响/不受影响), 修复是否涉及abi变化(是/否))不能省略,省略后defect-manager将无法正常解析填写内容.
评论区可能使用到的指令说明:

指令 指令说明 使用权限
/check-issue 触发defect-manager校验 不限
/reason xxx /reason +挂起或取消条件 不限

影响性分析说明:

缺陷严重等级:(Critical/High/Moderate/Low)

缺陷根因说明:

受影响版本排查(受影响/不受影响):

  1. openEuler-20.03-LTS-SP4:
  2. openEuler-22.03-LTS-SP4:
  3. openEuler-24.03-LTS-SP1:
  4. openEuler-24.03-LTS-SP3:
  5. openEuler-24.03-LTS-SP4:

abi变化(是/否):

  1. openEuler-20.03-LTS-SP4:
  2. openEuler-22.03-LTS-SP4:
  3. openEuler-24.03-LTS-SP1:
  4. openEuler-24.03-LTS-SP3:
  5. openEuler-24.03-LTS-SP4:

缺陷issue处理具体操作请参考:
https://atomgit.com/openeuler/cve-manager/blob/master/cve-vulner-manager/doc/md/defect-manager-manual.md
pr关联issue具体操作请参考:
https://docs.atomgit.com/docs/help/home/org_project/pullrequests/pr-related-issue

likedislike
openeuler-ci-botopeneuler-ci-botCollaborators
18 days ago Added label: DEFECT/UNFIXED
LLei-Chen
18 days ago Associated pull request
LLei-Chen
18 days ago Associated pull request
LLei-Chen
18 days ago Associated pull request
Lei-Chen
18 days ago Comments:

已提交 PR:

其余 24.03 分支(LTS、LTS-Next、SP1、SP2、SP4)已确认受影响,已通过 SP3 PR 的 /sync 排队同步。

影响性分析说明: grub_net_recv_ethernet_packet() 在检查接收帧长度之前解析 Ethernet/VLAN/LLC/SNAP 头;截断或构造的帧可导致堆越界读取,影响 PXE/HTTP Boot 网络路径。

缺陷严重等级: Moderate

缺陷根因说明: 网络接收路径先按固定偏移读取各层头部,再校验长度,缺少前置的包长检查。

受影响版本排查(受影响/不受影响):

  1. openEuler-20.03-LTS-SP4: 受影响(本次未提交 PR,后续单独回移)
  2. openEuler-22.03-LTS-SP4: 受影响(本次未提交 PR,后续单独回移)
  3. openEuler-24.03-LTS: 受影响(由 SP3 PR /sync 同步)
  4. openEuler-24.03-LTS-Next: 受影响(由 SP3 PR /sync 同步)
  5. openEuler-24.03-LTS-SP1: 受影响(由 SP3 PR /sync 同步)
  6. openEuler-24.03-LTS-SP2: 受影响(由 SP3 PR /sync 同步)
  7. openEuler-24.03-LTS-SP3: 受影响(PR #639)
  8. openEuler-24.03-LTS-SP4: 受影响(由 SP3 PR /sync 同步)
  9. openEuler-26.09: 受影响(PR #640)
  10. master: 受影响(PR #641)

abi变化(是/否):

  1. openEuler-20.03-LTS-SP4: 否
  2. openEuler-22.03-LTS-SP4: 否
  3. openEuler-24.03-LTS: 否
  4. openEuler-24.03-LTS-Next: 否
  5. openEuler-24.03-LTS-SP1: 否
  6. openEuler-24.03-LTS-SP2: 否
  7. openEuler-24.03-LTS-SP3: 否
  8. openEuler-24.03-LTS-SP4: 否
  9. openEuler-26.09: 否
  10. master: 否
likedislike
Lei-Chen
18 days ago Comments:

/check-issue

likedislike
openeuler-ci-bot
openeuler-ci-botCollaborators
18 days ago Comments:

@ouuleilei 经过defect-manager解析,已分析的内容如下表所示:

状态 需分析 内容
已分析 1.影响性分析说明 grub_net_recv_ethernet_packet()在检查接收帧长度之前解析Ethernet/VLAN/LLC/SNAP头;截断或构造的帧可导致堆越界读取,影响PXE/HTTPBoot网络路径。
已分析 2.缺陷严重等级 Moderate
已分析 3.缺陷根因定位 网络接收路径先按固定偏移读取各层头部,再校验长度,缺少前置的包长检查。
已分析 4.受影响版本排查 openEuler-20.03-LTS-SP4:受影响,openEuler-22.03-LTS-SP4:受影响,openEuler-24.03-LTS:受影响,openEuler-24.03-LTS-Next:受影响,openEuler-24.03-LTS-SP1:受影响,openEuler-24.03-LTS-SP2:受影响,openEuler-24.03-LTS-SP3:受影响,openEuler-24.03-LTS-SP4:受影响,openEuler-26.09:受影响
已分析 5.abi变化 openEuler-20.03-LTS-SP4:否,openEuler-22.03-LTS-SP4:否,openEuler-24.03-LTS:否,openEuler-24.03-LTS-Next:否,openEuler-24.03-LTS-SP1:否,openEuler-24.03-LTS-SP2:否,openEuler-24.03-LTS-SP3:否,openEuler-24.03-LTS-SP4:否,openEuler-26.09:否

请确认分析内容的准确性,确认无误后,您可以进行后续步骤,否则您可以继续分析

likedislike
Lei-Chen
14 days ago Comments:

对应 PR 已主动撤回;后续按“同一仓库/分支汇总 3–5 个上游补丁”的方式重新整理后再提交。

likedislike
LLei-Chen
14 days ago Close issue
openeuler-ci-botopeneuler-ci-botCollaborators
14 days ago changed custom state from 待办的 to 已完成
openeuler-ci-botopeneuler-ci-botCollaborators
14 days ago changed custom state from 已完成 to 待办的
openeuler-ci-botopeneuler-ci-botCollaborators
14 days ago Reopen issue
openeuler-ci-bot
openeuler-ci-botCollaborators
14 days ago Comments:

@ouuleilei
关闭issue前,需要将受影响的分支在合并pr时关联上当前issue编号: #200
受影响分支: openEuler-20.03-LTS-SP4/openEuler-22.03-LTS-SP4/openEuler-24.03-LTS-SP1/openEuler-24.03-LTS-SP3/openEuler-24.03-LTS-SP4
具体操作参考: https://docs.atomgit.com/docs/help/home/org_project/pullrequests/pr-related-issue

likedislike
LLei-Chen
14 days ago Close issue
openeuler-ci-botopeneuler-ci-botCollaborators
14 days ago changed custom state from 待办的 to 已完成
openeuler-ci-botopeneuler-ci-botCollaborators
14 days ago changed custom state from 已完成 to 待办的
openeuler-ci-botopeneuler-ci-botCollaborators
14 days ago Reopen issue
openeuler-ci-bot
openeuler-ci-botCollaborators
14 days ago Comments:

@ouuleilei
关闭issue前,需要将受影响的分支在合并pr时关联上当前issue编号: #200
受影响分支: openEuler-20.03-LTS-SP4/openEuler-22.03-LTS-SP4/openEuler-24.03-LTS-SP1/openEuler-24.03-LTS-SP3/openEuler-24.03-LTS-SP4
具体操作参考: https://docs.atomgit.com/docs/help/home/org_project/pullrequests/pr-related-issue

likedislike
LLei-Chen
8 days ago Change title to "grub2: net/ethernet 报文头长度未校验导致越界读", originally titled "grub2: net/ethernet 解析报文头部未校验长度导致越界读取".
LLei-Chen
8 days ago Modify description of issue
huijing_zhanghuijing_zhang
3 days ago Associated pull request