Recognize and mitigate ntoskrnl's return stack buffer clearing idiom
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- cpp
調査の方向性
Load ntoskrnl.exe and begin at KiFlushCurrentRsb, then inspect the immediately following functions and current_function.stack_adjustment at 0x140ab5739. Reproduce the excessive updates and confirm that the repeated return-stack-buffer clearing pattern no longer produces an implausibly large stack adjustment or hits the function update limit.
索引モデルが issue の本文から書いたものです。
説明
Version and Platform (required):
- Binary Ninja Version: 5.4.10362-dev Ultimate, bbfabaed
- OS: macos
- OS Version: 26.5.2
- CPU Architecture: arm64
Bug Description:
ntoskrnl.exe has a bunch of functions that look like this:
140ab5703 int64_t sub_140ab5703()
140ab5703 0* 4883c408 add rsp, 0x8
140ab5707 -8 e8eeffffff call sub_140ab56fa {sub_140ab570c}
{ Falls through into sub_140ab570c }
140ab570c int64_t sub_140ab570c()
140ab570c 0* 4883c408 add rsp, 0x8
140ab5710 -8 e8eeffffff call sub_140ab5703 {sub_140ab5715}
{ Falls through into sub_140ab5715 }
140ab5715 int64_t sub_140ab5715()
140ab5715 0* 4883c408 add rsp, 0x8
140ab5719 -8 e8eeffffff call sub_140ab570c {sub_140ab571e}
{ Falls through into sub_140ab571e }
140ab571e int64_t sub_140ab571e()
140ab571e 0* 4883c408 add rsp, 0x8
140ab5722 -8 e8eeffffff call sub_140ab5715 {sub_140ab5727}
{ Falls through into sub_140ab5727 }
These are called by KiFlushCurrentRsb and eventually bottom out in:
140ab5742 int64_t sub_140ab5742(int64_t arg1 @ 0x8)
140ab5742 0* 4883c408 add rsp, 0x8
140ab5746 -8 0faee8 lfence
140ab5749 -8 480fba242409 bt qword [rsp {arg1}], 0x9
140ab574f -8 7301 jae 0x140ab5752
140ab5751 -8 fb sti
140ab5752 -8* 4883c410 add rsp, 0x10
140ab5756 -18 c3 retn {arg_18}
This code appears to be a mitigation for a variant of Spectre 2 known as SpectreRSB.
The repeated add rsp, 0x8 / call pattern results in core computing diverging values for each functions' stack adjustment, that eventually leads to some number of them tripping the function update limit.
Steps To Reproduce:
- Load ntoskrnl.exe (
omega wheel directs safely). - Jump to
KiFlushCurrentRsb. - Wait for analysis to finish, then look at the functions immediately after
KiFlushCurrentRsbto see whether any generated excessive updates. - Jump to
0x140ab5739, and look at the value forcurrent_function.stack_adjustment. It should not be excessively large (i.e.,OffsetWithConfidence(value=377666247104, confidence=191)is bad).
Additional Information:
I noticed this while looking into what functions within ntoskrnl.exe are responsible for generating the most updates. These functions stood out since they hit the update count limit.
Since this is a Spectre mitigation, it's possible we'll see similar patterns within other kernels for x86_64 operating systems.
- 主要言語
- C++
- スター
- 1.3k
- フォーク
- 298
- 平均マージ
- 5日 5時間
- マージ済み PR(30日)
- 19
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Vector35/binaryninja-api のほかの issue
-
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
Vector35/binaryninja-api#8540 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
Vector35/binaryninja-api#8516 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
Vector35/binaryninja-api#8503 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
Vector35/binaryninja-api#8446 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
Vector35/binaryninja-api#8444 ·
Vector35/binaryninja-api の issue をすべて見る
似ている issue
-
難易度 1/5 1〜3時間 初心者へのやさしさ 92/100
autowarefoundation/autoware_universe#13413 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
automated-analysis bug memory-safety
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
-
Sensor initialization takes very long when `--initial-sim-time` is set to current UNIX timestamp オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
gazebosim/gz-sensors#662 · コメント 1 件 ·