Fedora Account System
Red Hat Associate
Red Hat Customer
Summary hermeto's pnpm backend does not check whether the repository's .npmrc is a symlink. If a repository ships .npmrc as a symlink to a file outside the source tree, hermeto copies that file's contents into .build-config.json in its output directory. Anyone who can get a change into the source repository, such as a pull request author, can read any file the hermeto process can read, including credentials present in the environment hermeto runs in. Details _prepare_npmrc_for_hermetic_build reads .npmrc without checking that it resolves inside the source directory, and symlinks are preserved when hermeto copies the source tree. The target file's contents end up in .build-config.json in the output directory. hermeto reports success with no warning. hermeto inject-files later writes the modified .npmrc back to the same path, so the write follows the symlink too. The target file gets its original content plus two registry= lines appended. This is mild corruption, the leak above is the real problem. The pnpm-lock.yaml read uses the same unchecked path pattern. Affected versions: the .npmrc handling was added in commit b894a9af, released as experimental x-pnpm in 0.56.0 and as stable pnpm in 0.57.0. All releases since are affected, and it is unfixed on main. Proof of concept Reproduced with the hermeto 0.64.0 container image. Source repository (src/): package.json: {"name":"poc","version":"1.0.0"} pnpm-lock.yaml: lockfileVersion: '9.0' settings: autoInstallPeers: true excludeLinksFromLockfile: false importers: .: {} .npmrc committed as a symlink (git preserves symlinks): .npmrc -> /root/.git-credentials Run: # stand-in for a CI pipeline that places git credentials in $HOME before running hermeto printf 'https://oauth2:ghp_PIPELINE_GIT_TOKEN@github.com\n' > /root/.git-credentials hermeto fetch-deps --source src --output out pnpm out/.build-config.json contains the credential: { "environment_variables": [ {"name": "PNPM_CONFIG_TRUST_LOCKFILE", "value": "true"} ], "project_files": [ { "abspath": "/work/src/.npmrc", "template": "https://oauth2:ghp_PIPELINE_GIT_TOKEN@github.com\n\nregistry=file://${output_dir}/deps/pnpm/npm/\n@jsr:registry=file://${output_dir}/deps/pnpm/jsr/\n" }, { "abspath": "/work/src/pnpm-lock.yaml", "template": "lockfileVersion: '9.0'\n..." } ] } hermeto logged All dependencies fetched successfully \\o/. Only two files in the repository are needed and no external server is involved. The symlink can point to any file the hermeto process can read, not only credentials. Impact Possibility of leaking credentials and other files. Hermeto scope. Any file readable by the hermeto process can be copied into .build-config.json in the output directory. What is reachable depends on the deployment: a local run exposes the invoking user's files, a containerized CI run exposes whatever is mounted into the container, typically credentials used to fetch private sources (e.g. git credentials in $HOME, a .netrc). Project pipeline scope. The output directory is passed to the image build, which runs the same project's Containerfile. A Containerfile under the attacker's control can read the leaked secret and bake it into the image or send it out over the network. To get there, an attacker needs a .npmrc symlink in a project whose CI prefetches pnpm dependencies with secrets present. The realistic way is a pull request, and it only works if the pipeline builds pull requests without review or maintainer approval, since the symlink and its target path are visible in the diff. Getting a project with such a symlink onboarded to a pipeline is highly unlikely. Supply chain scope. hermeto reads .npmrc only from the package directories listed in the input, never from downloaded dependencies. A third party can only reach this if project A includes their project B as a git submodule, prefetches it as a pnpm package, and pins it to a malicious commit. Highly unlikely. References GHSA-wx26-fvpq-v9rp: hermeto RPM, arbitrary file write from the same class of unchecked source path. CVE-2026-24056 / GHSA-m733-5w8f-5ggw: pnpm itself, symlink traversal in file: and git dependencies exposing local files. CVSS Score (based on GitHub): 6.5