Repository navigation
Refuse to open a pre-existing log file - #2068
Merged
Merged
Conversation
On macOS, release builds log to /tmp/Moonlight-<epoch>.log. /tmp is shared by all users and the file name is predictable, so another local user could plant symlinks at upcoming log names and have Moonlight truncate and overwrite any file the victim can write to. The log was also created world-readable. Open the log with QIODevice::NewOnly (O_CREAT|O_EXCL) so an existing file or symlink is never opened, and create it readable only by the owner on Qt 6.3+. If the open fails we keep logging to stderr, as we already did for any other open failure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On macOS, release builds log to
/tmp/Moonlight-<epoch>.log./tmpis shared between users and the name is predictable. Another local user can plant symlinks at upcoming log names, and Moonlight will then truncate and write through them into any file the victim can write. The log was also created world-readable.This opens the log with
QIODevice::NewOnly(O_CREAT|O_EXCL), so an existing file or symlink is never opened. On Qt 6.3+ the file is also created with owner-only permissions. If the open fails we keep logging to stderr, as before.Tested (macOS, Qt 6.12, release build):
-rw-------.🤖 Generated with Claude Code