Summary
Multiple Scaffolder actions and archive extraction utilities in Backstage were vulnerable to symlink-based path traversal, allowing operations to escape the intended workspace directory.
When an attacker can create and execute Scaffolder templates, they can abuse symlinks to read, delete, or write files outside the workspace, potentially exposing configuration files, system data, or secrets.
Affected context
This vulnerability affects Backstage deployments that:
- Use the Scaffolder functionality for templated automation, and
- Allow users (developers, CI agents, or integrations) to create or execute Scaffolder templates, and
- Rely on filesystem operations that are expected to be confined to a workspace directory.
The issue appears when filesystem operations (logging, deletion, archive extraction) follow attacker-controlled symlinks without enforcing directory boundaries or performing robust path validation.
Exploit preconditions
- Attack surface: Backstage Scaffolder actions and archive extraction utilities.
- Required access: Ability to:
- Create or modify Scaffolder templates, or
- Trigger execution of templates that consume attacker-controlled archive content or file paths.
- Trigger points:
debug:log(or similar) reading files that may be symlink targets.fs:deletedeleting files in locations derived from paths that may include symlinks.- Tar/zip extraction into the workspace where archives contain malicious symlinks pointing outside the workspace.
- Why exploitation is possible:
- Filesystem operations implicitly trust the resolved paths and do not verify that the effective target remains within the intended workspace directory.
- Symlinks created by or included in attacker-controlled inputs are followed by the runtime, enabling traversal outside the allowed directory scope.
Why this happens
The root cause lies in insufficient validation of file paths and symlink behavior before performing filesystem operations, mapping directly to:
- CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), and
- CWE-59: Improper Link Resolution Before File Access ('Link Following').
The implementation assumes that operations will remain inside a designated workspace, but it uses general-purpose filesystem APIs that transparently resolve symlinks.
Without explicitly resolving and checking canonical paths against an allowed base directory, symlinks in attacker-controlled locations (templates or archives) can point outside the workspace.
As a result, read, write, and delete operations can be redirected to unintended parts of the filesystem.
Potential impact
- Reading arbitrary files that the Backstage process can access (e.g.,
/etc/passwd, configuration files, API keys, or other secrets). - Deleting arbitrary files outside the intended workspace, potentially causing service disruption or data loss.
- Writing or overwriting files outside the workspace via archive extraction, which could lead to configuration tampering or introduction of malicious files.
- Leveraging file write capabilities to influence other services on the host (e.g., modifying config files, scripts, or data consumed by separate processes), depending on deployment and permissions.
General mitigation guidance
Effective mitigation focuses on enforcing strict filesystem boundaries and minimizing the trust placed in template and archive content:
- Enforce directory confinement:
- Resolve all file paths to their canonical (real) paths before use and verify they are descendants of a configured workspace or sandbox directory.
- Reject operations where the resolved path escapes the allowed base directory.
- Harden symlink handling:
- Explicitly disallow or sanitize symlinks in workspace directories that are influenced by user-controlled inputs (including template-generated content and extracted archives).
- Use extraction routines that support symlink-aware security checks (e.g., skipping symlinks or validating their targets).
- Apply least-privilege filesystem access:
- Run Backstage components under a dedicated account with the minimum filesystem permissions required for their function.
- In containerized deployments, restrict host mounts and expose only the directories that are strictly necessary.
- Constrain Scaffolder capabilities:
- Treat the ability to create or modify templates as a privileged operation, only granted to trusted users or tightly controlled automation.
- Restrict which actions and parameters can be used in templates, especially those that perform file operations.
- Defense-in-depth controls:
- Consider read-only mounts for sensitive configuration and system paths when compatible with your deployment model.
- Segregate high-value secrets and configuration data into dedicated, well-guarded stores rather than filesystem files accessible to application code.
How teams detect issues like this
Detection and assurance can leverage both code-level and operational techniques:
- Static analysis and code review:
- Search for filesystem operations that:
- Use user- or template-controlled paths, and
- Do not perform canonical path resolution and base-directory checks.
- Look for generic tar/zip extraction utilities that do not explicitly handle symlinks or validate extracted paths.
- Flag patterns where actions (like
debug:log,fs:delete, or custom file utilities) operate directly on template-supplied paths. - Policy and configuration review:
- Review Scaffolder templates for use of symlinks or for operations that can indirectly manipulate paths (e.g., archives, path concatenation, "debug" utilities).
- Audit permissions configuration to identify roles that can create or execute templates with file system side effects.
- Runtime monitoring:
- Monitor application logs and host auditing tools for file operations by the Backstage process outside expected workspace directories.
- Use host-based intrusion detection or container security tools to detect anomalous file access patterns and symlink-following behavior.
- Automated tooling:
- Integrate security linters or SAST tools that recognize path traversal and symlink-following anti-patterns in Node.js/TypeScript codebases.
- Periodically scan templates and build artifacts for unsafe filesystem usage as part of CI/CD pipelines.

