Skip to content

[Yun Tianming] install.sh: predictable /tmp stderr file (insta-setup-err.$$) follows symlinks #243

Description

@Fermionic-Lyu

Location: install.sh:242-253.

Kind: insecure temp file / symlink following.

Impact: SETUP_ERR="${TMPDIR:-/tmp}/insta-setup-err.$$" is pid-derived, not random, and 2>"$SETUP_ERR" follows symlinks. A local attacker who pre-creates /tmp/insta-setup-err.<pid> as a symlink to a file the installing user owns (~/.bashrc, ~/.ssh/authorized_keys) gets it truncated and filled with setup agent stderr. agents-staging.sh:33-34 already uses mktemp + trap for the same purpose.

Evidence:

SETUP_ERR="${TMPDIR:-/tmp}/insta-setup-err.$$"
if "$INSTALL_DIR/$BIN" setup agent $YFLAG $SETUP_ENV_ARGS 2>"$SETUP_ERR"; then

Fix would touch: install.sh only: SETUP_ERR="$(mktemp)" and trap 'rm -f "$SETUP_ERR"' EXIT.


Found by Yun Tianming: nightly sweep 2026-09-17-1000 at ecfe5168a32e. Report only; no code was changed for this finding.

🤖 Generated with Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions