tests: cover the `registry` fixed-width value guards added in #9220
メンテナーはふだん 3 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start in osquery/tables/system/windows/registry.cpp: the value buffer is allocated to lpData bytes in queryKey (~line 340), the REG_LINK conversion is around line 372, and the DWORD/QWORD guards are around lines 395-427. Write malformed values into a temporary key with RegSetValueEx, read them back through the table, and check that the short-payload cases return empty data without over-reading. Done means the four listed cases pass on Windows, and the optional ERROR_MORE_DATA case is either covered or explicitly skipped.
索引モデルが issue の本文から書いたものです。
説明
Summary
PR #9220 fixed genuine over-reads in osquery/tables/system/windows/registry.cpp but shipped without regression tests (the affected paths are Windows-only, which the PR notes). This issue tracks adding that coverage, to bring it in line with the other bounds-check PRs in the same hardening series.
Background
queryKey allocates the value buffer to exactly lpData bytes (registry.cpp, ~line 340). Before #9220:
- A
REG_QWORDvalue shorter than 8 bytes caused an over-read of up to 7 bytes (*((unsigned long long*)bpDataBuff.get())). REG_LINKdata, whichRegGetValueWdoes not null-terminate, was read as an unboundedwchar_t*string.
The PR guards REG_DWORD / REG_DWORD_BIG_ENDIAN on lpData >= sizeof(DWORD) and REG_QWORD on lpData >= sizeof(ULONGLONG) (~lines 395-427), and builds the REG_LINK string length-bounded from lpData / sizeof(wchar_t) (~line 372). The fixes verify by inspection, but nothing pins them.
Suggested tests
Malformed values can be written into a temporary key (e.g. RegSetValueEx with REG_QWORD type and a 1-byte payload) and then read back through the table, so no production-code hook should be needed:
REG_QWORDwithlpData < sizeof(ULONGLONG)— query succeeds without reading past the buffer;datais empty.REG_DWORDandREG_DWORD_BIG_ENDIANwithlpData < sizeof(DWORD)— same expectation.REG_LINKwith no NUL withinlpData— conversion stops atlpData / sizeof(wchar_t)characters.- Optional: a value that grows between the size query and the data read (the
ERROR_MORE_DATApath).
References
- PR #9220
osquery/tables/system/windows/registry.cpp(buffer allocation ~line 340;REG_LINK~372; DWORD/QWORD guards ~395-427)
Found during a post-merge review of recently merged hardening PRs.
- 主要言語
- C++
- スター
- 23.8k
- フォーク
- 2.7k
- 平均マージ
- 6日 11時間
- マージ済み PR(30日)
- 69
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
osquery/osquery のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 3 日以内に返信
-
usb_devices: usb_address and usb_port are wrong for bus/device numbers 8–99 on Linux (zero-padded udev values parsed as octal)対応中かも @mjatin2007 が 6 日前に担当しました。 オープンLinux virtual tables
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 3 日以内に返信
-
Update the expired Slack invite link in README再び着手できるかも @ayushkrsingh946 が 40 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンmaintainer task
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
osquery/osquery#9215 · コメント 4 件 ·
メンテナーはふだん 3 日以内に返信
-
fix(docs): debugging guide incorrectly says invalid configuration blocks daemon startup対応中かも @nightcityblade が 54 日前に担当しました。 オープンconfiguration documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
osquery/osquery#9143 · コメント 1 件 ·
メンテナーはふだん 3 日以内に返信
-
scheduled_tasks.hidden returns the task's Enabled state instead of Hidden (Windows)対応中かも @a-bonfim-tech が 67 日前に担当しました。 オープンbug triage virtual tables Windows
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
メンテナーはふだん 3 日以内に返信
osquery/osquery の issue をすべて見る
似ている issue
-
Make the HTTP server's keep-alive and headers timeouts configurable対応中かも @mattgodbolt が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
compiler-explorer/compiler-explorer#9902 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
Nixtla/statsforecast#1371 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
[Bug]: pip install -U cudaq-qec fails with a conflict that names cudaq-qec itself対応中かも @fedonman が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
task
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
SparseLinearAlgebra/spla#316 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信