Service crashes on Windows Server 2016: "panic: sub-authority index out of range" in RidToString
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 82/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- go
- Lĩnh vực
- operating-systems, security
Hướng nghiên cứu
Bắt đầu trong pkg/sys/rid.go tại RidToString: thêm guard cho SubAuthorityCount bằng 0/SID không hợp lệ trả về UNKNOWN, cùng một unit test cho SID không có subauthority. Theo stack vào pkg/ps/snapshotter_windows.go (newProcState) và pkg/event/param_windows.go để xem ProcessTokenIntegrityLevel được giải mã như thế nào; chỉ điều tra phiên bản sự kiện Kernel-Process trên 14393 nếu sửa nguyên nhân gốc. Hoàn thành nghĩa là không panic và mức integrity là UNKNOWN trên Server 2016.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
On Windows Server 2016 (build 14393), the Fibratus 3.1.1 service crashes a few seconds after start, as soon as the first process events are processed. The service control manager restarts it and it crashes again each time. The same version runs normally on Windows 10 22H2.
level=info msg=starting [Security Telemetry Logger] trace processing source=etw/source.go:271
level=info msg=starting [NT Kernel Logger] trace processing source=etw/source.go:271
panic: sub-authority index out of range
goroutine 29 [running]:
golang.org/x/sys/windows.(*SID).SubAuthority(..., 0xff)
golang.org/x/[email protected]/windows/security_windows.go:272
github.com/rabbitstack/fibratus/pkg/sys.RidToString(...)
pkg/sys/rid.go:63
github.com/rabbitstack/fibratus/pkg/event.Param.String(...)
pkg/event/param_windows.go:80
github.com/rabbitstack/fibratus/pkg/event.(*Event).GetParamAsString(...)
pkg/event/event.go:349
github.com/rabbitstack/fibratus/pkg/ps.(*snapshotter).newProcState(...)
pkg/ps/snapshotter_windows.go:385
github.com/rabbitstack/fibratus/pkg/ps.(*snapshotter).Write(...)
pkg/ps/snapshotter_windows.go:161
github.com/rabbitstack/fibratus/internal/etw/processors.psProcessor.ProcessEvent(...)
internal/etw/processors/ps_windows.go:51
github.com/rabbitstack/fibratus/internal/etw/processors.(*Chain).ProcessEvent(...)
internal/etw/processors/chain.go:46
github.com/rabbitstack/fibratus/internal/etw.(*Consumer).ProcessEvent(...)
internal/etw/consumer.go:110
github.com/rabbitstack/fibratus/internal/etw.(*Trace).processEventCallback(...)
internal/etw/trace.go:414
newProcState reads ProcessTokenIntegrityLevel from the Microsoft-Windows-Kernel-Process process events (CreateProcessInternal / ProcessRundownInternal). On build 14393 the SID in that parameter has a SubAuthorityCount() of 0, so in RidToString
switch sid.SubAuthority(uint32(sid.SubAuthorityCount() - 1)) {
SubAuthorityCount() - 1 wraps around to 255 (0xff in the trace) and SubAuthority panics. A likely cause is that the event payload layout on this build differs from the one the parser expects, so the SID is read from the wrong offset.
How to reproduce it
- Install Fibratus 3.1.1 (MSI) on Windows Server 2016 Standard, build 14393.
- Start the
fibratusservice, or runfibratus run. - The service terminates within seconds with the panic above (System event log: Service Control Manager 7031, "The Fibratus service terminated unexpectedly").
Reproduced on two separate Server 2016 VMs.
Expected behavior
Fibratus keeps running. If the integrity-level SID can't be decoded, the integrity level should be reported as UNKNOWN (as RidToString already does for a nil SID) instead of crashing the service. A minimal guard:
func RidToString(sid *windows.SID) string {
if sid == nil || !sid.IsValid() || sid.SubAuthorityCount() == 0 {
return "UNKNOWN"
}
switch sid.SubAuthority(uint32(sid.SubAuthorityCount() - 1)) {
It may also be worth checking the Kernel-Process event version on 14393 so the SID is decoded correctly there.
Screenshots
N/A
Environment
- Fibratus version: 3.1.1 (MSI). The same code path is present in 3.0.0, 3.1.0 and on master (
pkg/sys/rid.go). 2.4.0 does not read the integrity level and is not affected. The code was introduced with "feat(process): Enrich processes with integrity level and token elevation info". - Configuration: the 3.1.1 default configuration, with the
eventsourcesection unchanged. Only the rule paths and the output (HTTP instead of console) differ. The crash happens in the process snapshotter, before any rule is evaluated. - OS: Windows Server 2016 Standard, version 10.0.14393, x64 (VMware VMs). Not affected: Windows 10 22H2 (Pro and Education).
Additional context
Happy to test a build with a fix on Server 2016.
- Ngôn ngữ chính
- Go
- Star
- 2.6k
- Fork
- 222
- Merge trung bình
- 16 giờ 23 phút
- Pull request đã merge (30 ngày)
- 11
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của rabbitstack/fibratus
-
CI: the test job has been red since September, and TestFsProcessor looks like a real mmap regressionĐang mởci
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 22/100
rabbitstack/fibratus#754 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ci rules type: enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
rabbitstack/fibratus#715 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
scope: hardering type: enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
rabbitstack/fibratus#713 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add `WMI` activity telemetryĐang mởneeds: config scope: events/telemetry type: feature
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
rabbitstack/fibratus#710 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
needs: config scope: events/telemetry type: feature
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
rabbitstack/fibratus#708 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của rabbitstack/fibratus
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
nebari-dev/llm-serving-pack#270 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area/controller
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
volcano-sh/kthena#2109 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
unbound-force/replicator#193 ·
Maintainer thường phản hồi trong vòng 2 ngày