Backup and state folders are written through junctions without a check
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start with Target() and the reparse-point check in clean/installer/src/wg_core/record.cpp, then read StateDir/BackupPath there and DoInstall at install.cpp:582-589, where EnsureDir and CopyChecked run. Add one helper that refuses when the state folder or its backup, previous and rr-config subfolders is a reparse point, and call it before the first write; RemoveTree in util.cpp already handles reparse points. Done when the core test with a junctioned backup folder is refused and the sentinel wronggpu.ini keeps its bytes.
索引モデルが issue の本文から書いたものです。
説明
This was found by reading the code. It has not been reproduced.
What happens
Target() refuses reparse points on every path component below the game folder (clean/installer/src/wg_core/record.cpp:171-188). The state folder is not checked. StateDir and BackupPath are a plain Join (record.cpp:21-23). DoInstall creates the state folder with EnsureDir(state) (clean/installer/src/wg_core/install.cpp:582). EnsureDir accepts an existing junction as a folder (clean/installer/src/wg_core/util.cpp:108-110). Backups are then written with CopyChecked(Target(...), BackupPath(...)) (install.cpp:588), which overwrites the destination (util.cpp:146-149). Nothing checks wronggpu-setup, wronggpu-setup\backup, previous\ or rr-config\ for reparse points. The same holds for SaveRecord, the uninstaller copy and profile.ini. The hash check at install.cpp:589 only checks the new copy.
So if one of those folders is a junction, a backup is written into the junction's target and can overwrite a file there.
When it can happen
Not for an ordinary player. WrongGPU creates wronggpu-setup itself and nothing makes it a junction. An unusual but innocent case: a player moved wronggpu-setup to another drive with mklink /J, then installed fresh while the target folder held files with matching names. Another program with write access to the game folder could plant a junction, but it could damage those files directly anyway.
This does not cross a privilege boundary. The elevated path is used only when the player cannot write the game folder. Planting a junction there already needs the rights that elevation grants. In a folder the player can write, no elevation happens. Low severity. Losing a file is the worst outcome, so this is worth hardening, but it is not a reachable path to data loss.
To do
- Add one helper. Before the first write, and in every operation that writes to the state folder, refuse if
StateDir(dir)orStateDir(dir)\backup(andprevious,rr-config) exists and is a reparse point. RemoveTreealready handles reparse points (util.cpp:153-155).- Caution: none for normal installs. A player who moved the folder with a junction on purpose gets a clear refusal.
Test
CPU-only. Make a temporary game folder with wronggpu-setup\backup as a junction to a folder holding a sentinel wronggpu.ini, plus a game wronggpu.ini. Run the install from the core tests. Assert it refuses and the sentinel's bytes are unchanged.
- 主要言語
- C++
- スター
- 12
- フォーク
- 2
- 平均マージ
- 3時間 10分
- マージ済み PR(30日)
- 171
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
phantoslayer21/wronggpu のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
phantoslayer21/wronggpu#275 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
phantoslayer21/wronggpu#274 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
phantoslayer21/wronggpu#241 ·
メンテナーはふだん 1 日以内に返信
-
bug build
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
phantoslayer21/wronggpu#234 ·
メンテナーはふだん 1 日以内に返信
-
bug build
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
phantoslayer21/wronggpu#233 ·
メンテナーはふだん 1 日以内に返信
phantoslayer21/wronggpu の issue をすべて見る
似ている issue
-
ai_p2
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
ClickHouse/ClickHouse#132519 ·
メンテナーはふだん 1 日以内に返信
-
[Bug]: VST3 getMidiControllerAssignment reads past midiControllerToParameter for program changeオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
juce-framework/JUCE#1810 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
petercorke/robotics-toolbox-python#952 ·
メンテナーはふだん 1 日以内に返信
-
NatronRenderer: a Python error in the script (-t / project script) doesn't change the exit statusオープンfunc:engine type:bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
NatronGitHub/Natron#1276 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 77/100
メンテナーはふだん 1 日以内に返信