Skip to content

stdbuf: refuse a libstdbuf path that cannot be represented in LD_PRELOAD - #13622

Open
sylvestre wants to merge 1 commit into
uutils:mainfrom
sylvestre:stdbuf-preload-path-separator
Open

stdbuf: refuse a libstdbuf path that cannot be represented in LD_PRELOAD#13622
sylvestre wants to merge 1 commit into
uutils:mainfrom
sylvestre:stdbuf-preload-path-separator

Conversation

@sylvestre

Copy link
Copy Markdown
Contributor

LD_PRELOAD is colon-separated with no escaping, so a path containing ':' gets split by the loader and its leading component loaded as a library. That path comes from $TMPDIR, so the component is attacker-chosen whenever TMPDIR crosses a privilege boundary (e.g. sudoers env_keep preserving TMPDIR while stripping LD_PRELOAD). With a directory named payload.so:x as TMPDIR, an attacker .so runs in the child before main(). GNU is unaffected: it uses a fixed path.

Fail with exit 125 instead of preloading a library we did not select.

LD_PRELOAD is colon-separated with no escaping, so a path containing ':' gets
split by the loader and its leading component loaded as a library. That path
comes from $TMPDIR, so the component is attacker-chosen whenever TMPDIR crosses
a privilege boundary (e.g. sudoers env_keep preserving TMPDIR while stripping
LD_PRELOAD). With a directory named `payload.so:x` as TMPDIR, an attacker .so
runs in the child before main(). GNU is unaffected: it uses a fixed path.

Fail with exit 125 instead of preloading a library we did not select.
@github-actions

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/cut/bounded-memory (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/tail/inotify-dir-recreate (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/tail/tail-n0f (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/tail/retry (passes in this run but fails in the 'main' branch)

@sylvestre
sylvestre requested a review from Ecordonnier July 28, 2026 20:51
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