Harden wallpaper reads against special-file DoS - #503
Open
zyads wants to merge 1 commit into
Open
Conversation
UserData::load_wallpapers_as_user read wallpapers with a plain fs::read on a path taken from the user's own cosmic-bg config. A user could point it at a FIFO (blocks open forever) or a device like /dev/zero (unbounded read, OOM). Since the greeter loads every user's config at the login/lock screen, one user could deny the login screen to the whole machine. Read through a helper that opens O_NONBLOCK, requires a regular file, and caps the read size. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
zyads
force-pushed
the
harden-wallpaper-read
branch
from
July 31, 2026 03:12
7ae02e5 to
da127cd
Compare
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.
UserData::load_wallpapers_as_userreads each wallpaper with a plainfs::readon a path taken from that user's own cosmic-bg config, and the greeter daemon loads every user's config at the login/lock screen. Pointing that path at a FIFO blocks the read forever, and a device like/dev/zeroreads without bound until the daemon is OOM-killed, so a single unprivileged user can deny the graphical login/lock screen to the whole machine.Read wallpapers through a helper that opens with
O_NONBLOCK, requires a regular file, and caps the read at 256 MiB, mirroring the defensive handling already applied to the AccountsService icon read. Verified withcargo check -p cosmic-greeter-daemon.🤖 Generated with Claude Code