Skip to content

Harden wallpaper reads against special-file DoS - #503

Open
zyads wants to merge 1 commit into
pop-os:masterfrom
zyads:harden-wallpaper-read
Open

Harden wallpaper reads against special-file DoS#503
zyads wants to merge 1 commit into
pop-os:masterfrom
zyads:harden-wallpaper-read

Conversation

@zyads

@zyads zyads commented Jul 31, 2026

Copy link
Copy Markdown

UserData::load_wallpapers_as_user reads each wallpaper with a plain fs::read on 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/zero reads 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 with cargo check -p cosmic-greeter-daemon.

🤖 Generated with Claude Code


  • I have disclosed use of any AI generated code in my commit messages.
    • If you are using an LLM, and do not fully understand the changes it is making to the code base, do not create a PR.
    • In our experience, AI generated code often results in overly complex code that lacks enough context for a proper fix or feature inclusion. This results in considerably longer code reviews. Due to this, AI authored or partially authored PRs may be closed without comment.
  • I understand these changes in full and will be able to respond to review comments.
  • My change is accurately described in the commit message.
  • My contribution is tested and working as described.
  • I have read the Developer Certificate of Origin and certify my contribution under its conditions.

@zyads zyads changed the title Harden wallpaper reads against special-file DoS (FIFO/device path hangs greeter) Harden wallpaper reads against special-file DoS Jul 31, 2026
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
zyads force-pushed the harden-wallpaper-read branch from 7ae02e5 to da127cd Compare July 31, 2026 03:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant