Skip to content

linux-luminarium: avoid invalid find flag destinations - #297

Merged
zardus merged 1 commit into
pwncollege:mainfrom
starvingarc:fix/find-flag-destination
Oct 15, 2026
Merged

zardus merged 1 commit into
pwncollege:mainfrom
starvingarc:fix/find-flag-destination

Conversation

@starvingarc

Copy link
Copy Markdown
Contributor

Fixes #279.

The find initializer can choose /, write the flag back to /flag, and then delete that same file. Choosing a directory that already contains a flag directory instead raises IsADirectoryError and leaves the flag at /flag.

Filter both destinations before random selection. The extra condition only controls yield, so valid descendants remain eligible; no retry loop is needed.

Reproduction

Connected over SSH to the online finding files Practice container and verified that /challenge/.init was byte-for-byte identical to upstream at 8c92f5b. Its directory enumeration included / among 2,068 candidates. The synthetic input pwn.college{reproduction1309} produces seed 13091, which selected / with that directory ordering. Executing the unmodified initializer deleted the synthetic /flag without an exception. This was a constructed reproduction, not an observed failure with a platform-issued flag; the existing hidden flag was left untouched.

Validation

Executed the complete original and patched scripts in fresh temporary chroots inside the Practice container, using synthetic flags, real filesystem traversal, and the original RNG. The same inputs produced:

Case Before After
Root selected Flag deleted Flag relocated
Destination contains a flag directory IsADirectoryError Flag relocated
Ordinary destination Pass Pass
Valid descendant of a conflicting directory Pass Pass

Successful cases checked a single surviving flag, unchanged contents, mode 0644, removal of the original /flag, preservation of the conflicting directory, and continued eligibility of its valid descendant.

Python syntax, git diff --check, and the repository's secret-test encryption hook pass. The official Nix/pwnshop suite was not run because the required runtime is unavailable locally; the chroot checks above were an ad hoc regression harness, not additions to that suite.

@zardus
zardus merged commit 19e85c6 into pwncollege:main Oct 15, 2026
1 check passed
@zardus

zardus commented Oct 15, 2026

Copy link
Copy Markdown
Member

Thanks!

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.

[Luminarium] "commands": "find" edge cases can break the challenge

2 participants