Repository navigation
Description
Summary
The GitHub-hosted RHEL 10 larger-runner image (partner image, public preview) ships with a large number of world-writable system paths, a world-readable runner home and /opt/hca, and the runner's XDG_RUNTIME_DIR in /etc/environment. The ssh crypto-policy breakage that bootc-host-setup/ci/workarounds.sh repairs (repair_rhel_openssh_policy, #60 thread) is, by inference, one symptom of the same stray recursive chmod. This issue collects what we know so we can file it upstream. Evidence and inference are kept apart below.
Evidence (observed)
RHEL 10.2 runner, rhel10-x86_64-16c-64g, image version 20260922.11.1 (from /etc/environment), snapshot taken before any hardening, in devspace run 36490604912. Logs: https://gist.github.com/cgwalters-bot/84da54240d4877d95751d96696b0dadd
- 35,236 world-writable non-sticky files and directories on local filesystems: 24,070 under
/usr/share, 11,154 under/opt/runner-cache, plus/opt,/opt/hca(2),/opt/primer,/imagegeneration,/imagegeneration/imagedata.jsonand 6 under/home/packer. Modes are 0777 for directories and binaries, 0666 for plain files (e.g./opt/runner-cache/externals/node20/include/node/zlib.h: 0666). - The unprivileged
runneruser can write to/usr/sharethrough the world bit. /home/runnerand/opt/hcaare 0755;/home/runner/actions-runner/.credentialsand/opt/hca/.settingsare 0644, andnobodycan read both./etc/environmentcontainsXDG_RUNTIME_DIR=/run/user/1001, the runner's own runtime dir, which overrides whatpam_systemdsets for other users' sessions (same as XDG_RUNTIME_DIR is set system-wide in /etc/environment, breaking sessions of other users actions/runner-images#14649 on Ubuntu).- The runner processes' umask is 0022 (shell and
Runner.Worker), so this is not a leaked "umask 000"; the modes come from an explicit chmod at image build time. - On the RHEL 10 stock partner image the OpenSSH crypto policy target
/usr/share/crypto-policies/DEFAULT/openssh.txtis rejected byssh -G("Bad owner or permissions on /etc/crypto-policies/back-ends/openssh.config"), whichworkarounds.shrepairs with chown/chmod 0644 + restorecon. ssh refuses group/world-writable config files, which a blanket 777 on/usr/sharewould cause. (cgwalters-devspace-sandbox#2 also had to drop a group write bit on this include.)
Sources: cgwalters-forge/actions#6 (PR body, "Testing"), cgwalters-forge/cgwalters-devspace-sandbox#2 (description and comments; research gists https://gist.github.com/cgwalters-bot/f932edce0622dba38e1b9018c01c6c31 and https://gist.github.com/cgwalters-bot/2368b70fa941386025467421ce38b5b6, which cover run0/sandbox behavior and the runner's enforcement limits rather than the chmod itself).
Hosted Ubuntu 24.04 has the same shape (observed in cgwalters-forge/actions#6 CI, https://github.com/cgwalters-forge/actions/actions/runs/36633185151): the same chmod -R 777 pattern on /usr/share, /opt and /usr/local/bin, a 0755 /opt/hca, XDG_RUNTIME_DIR in /etc/environment; 793,421 paths had world write removed, and 1,032,050 were checked afterwards.
Where the chmod likely comes from
The public Ubuntu image build in actions/runner-images has exactly this, in images/ubuntu/scripts/build/configure-system.sh (at 57b93f2):
chmod -R 777 /usr/share
chmod -R 777 /opt
and further ones: install-nodejs.sh (chmod -R 777 /usr/local/bin, /usr/local/lib/node_modules), configure-environment.sh (chmod -R 777 $AGENT_TOOLSDIRECTORY), install-actions-cache.sh (/opt/actionarchivecache), install-java-tools.sh (/usr/lib/jvm), install-haskell.sh. The same set exists under images/ubuntu-slim. The XDG line is tracked in actions/runner-images#14649 (open).
The RHEL image is not in actions/runner-images: its tree has only macos, ubuntu, ubuntu-slim and windows, and no script there mentions RHEL.
Inference (not verified)
- The RHEL image appears to share GitHub's hosted-runner image tooling or at least its post-generation step. Circumstantial matches with the Ubuntu build: the
/imagegenerationdirectory (withimagedata.json),/home/packer(packer build),ImageOS/ImageVersionin/etc/environmentin the runner-images format and theYYYYMMDD.N.Nversion,/opt/runner-cache, and the identicalXDG_RUNTIME_DIRline. The/opt/hca(hosted compute agent) and/opt/primerpaths are the VM-side agents of GitHub's hosted fleet. - The world-writable set on RHEL is concentrated in
/usr/shareand/opt, the same two roots asconfigure-system.sh. We did not see/usr/local/binin the top-level counts on RHEL (it does not hold node there), so that one is an Ubuntu-only observation. - So the likeliest explanation is a build or post-generation step shared with the Ubuntu images, not something Red Hat's base image does. We have no access to the RHEL build scripts, so this is a hypothesis.
Unverified: "same as the Azure 1P image"
The claim that this image is the same as the Azure first-party RHEL image is unverified. We found no public statement of it: the GitHub changelog and the Red Hat blog say only that the host OS environment is built and signed by Red Hat and scanned for vulnerabilities. If the world-writable paths and the broken crypto-policy permissions are absent on a stock RHEL 10 Azure VM (marketplace image), that is evidence the damage is added by the GitHub runner build and not by the base image. Pending @cgwalters's test on a stock RHEL Azure VM; suggested check is the find / -xdev -perm -0002 ! -perm -1000 \( -type f -o -type d \) count, stat /home/runner /opt/hca and ssh -G localhost.
Current workaround
bootc-host-setup/ci/workarounds.sh(repair_rhel_openssh_policy): only repairs the crypto-policies target, and only after the exactssh -Gdiagnostic.cgwalters-forge/actionssecure-host-setup(secure-host-setup: Add an action closing a runner image to other users cgwalters-forge/actions#6): scans/, removes world write from everything it finds (keeping job-user access through an ACL), makes/home/runnerand/opt/hca0700, and rewrites/etc/environmentwithoutXDG_RUNTIME_DIR. Takes about 2.5s on RHEL (34-35k paths) and about 4-6 minutes on hosted Ubuntu (793k paths).bootc-host-setupdoes not currently apply the broader hardening; it is only needed for jobs that run untrusted code as another user or that care about the host not being writable by all local users.
Draft upstream report (actions/runner-images, or GitHub support for the partner image)
RHEL 10 runner image: world-writable system paths, world-readable runner credentials, per-user XDG_RUNTIME_DIR in /etc/environment
On the RHEL 10 larger-runner partner image (
rhel10-x86_64-16c-64g, image version 20260922.11.1), a fresh job sees:
- 35,236 files and directories that are world-writable and not sticky (24,070 under
/usr/share, 11,154 under/opt/runner-cache, also/opt,/opt/hca,/opt/primer,/imagegeneration). Any local user can replace system files, e.g. add a polkit rule, and become root./home/runnerand/opt/hcaare 0755, and/home/runner/actions-runner/.credentialsand/opt/hca/.settingsare 0644, so any local account can read the runner credentials./etc/environmentsetsXDG_RUNTIME_DIR=/run/user/1001, breaking sessions of other users (see #14649).- The ssh crypto-policy file under
/usr/share/crypto-policiesends up with permissions thatssh -Grejects.The process umask is 0022, so these look like a recursive
chmod -R 777at image build time, matchingimages/ubuntu/scripts/build/configure-system.sh(chmod -R 777 /usr/share,chmod -R 777 /opt). Is the RHEL image built with the same post-generation step? Please drop the blanket chmod (jobs that need to write the tool cache can use a group or ACL), make the runner home and/opt/hcamode 0700, and stop settingXDG_RUNTIME_DIRglobally. Detection one-liner:sudo find / -xdev ! -perm -1000 -perm -0002 \( -type f -o -type d \) | wc -l.
Generated-by: https://github.com/cgwalters/#llms
Activity