Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Recognize and mitigate ntoskrnl's return stack buffer clearing idiom

Đang mở
#8,403 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
cpp

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

State: Awaiting Triage

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:

  1. Load ntoskrnl.exe (omega wheel directs safely).
  2. Jump to KiFlushCurrentRsb.
  3. Wait for analysis to finish, then look at the functions immediately after KiFlushCurrentRsb to see whether any generated excessive updates.
  4. Jump to 0x140ab5739, and look at the value for current_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.

Ngôn ngữ chính
C++
Star
1.3k
Fork
298
Merge trung bình
4 ngày 13 giờ
Pull request đã merge (30 ngày)
20

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Vector35/binaryninja-api

Tất cả issue của Vector35/binaryninja-api

Issue tương tự

Thêm issue về C++

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.