# GHSA-2g8g-63j4-9w3r: RCE vulnerability affecting v1beta3 templates in @backstage/plugin-scaffolder-backend

> An attacker with write access to scaffolder templates can achieve remote code execution on the backend by injecting malicious code into template definitions.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 1 Dec 2021

## What is GHSA-2g8g-63j4-9w3r?

GHSA-2g8g-63j4-9w3r is a code injection vulnerability in @backstage/plugin-scaffolder-backend, published on 1 Dec 2021. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

The templating library used by the scaffolder backend assumes that templates are trusted which is an undesired property of the scaffolder-backend. This has now been mitigated by sandboxing the template code execution.

### Impact
A malicious actor with write access to a registered scaffolder template could manipulate the template in a way that allows for remote code execution on the scaffolder-backend instance. This was only exploitable in the template yaml definition itself and not by user input data.

### Patches
This is vulnerability is patched in version `0.15.14` of `@backstage/plugin-scaffolder-backend`.

### For more information
If you have any questions or comments about this advisory:

* Open an issue in the [Backstage repository](https://github.com/backstage/backstage)
* Visit our chat, linked to in [Backstage README](https://github.com/backstage/backstage)

## Which versions are affected by GHSA-2g8g-63j4-9w3r?

2 open source packages ship an affected version, including @backstage/plugin-scaffolder-backend.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `@backstage/plugin-scaffolder-backend` | npm | All versions | 0.15.14 |
| `@backstage/plugin-scaffolder-backend` | npm | All versions | 0.15.14 |

## How do I fix GHSA-2g8g-63j4-9w3r?

Upgrade @backstage/plugin-scaffolder-backend to 0.15.14 or later.

## Is GHSA-2g8g-63j4-9w3r being exploited?

There is no known exploitation of GHSA-2g8g-63j4-9w3r in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-2g8g-63j4-9w3r and fix it if it is affected.

What it is: GHSA-2g8g-63j4-9w3r is a code injection vulnerability in @backstage/plugin-scaffolder-backend, published on 1 Dec 2021. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-2g8g-63j4-9w3r in the wild and no public exploit code.

Affected packages and fixed versions:
- @backstage/plugin-scaffolder-backend (npm): affected all versions; fixed in 0.15.14
- @backstage/plugin-scaffolder-backend (npm): affected all versions; fixed in 0.15.14

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-2g8g-63j4-9w3r/ (Markdown: https://insights.sbomify.com/GHSA-2g8g-63j4-9w3r/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-2g8g-63j4-9w3r

---
From sbomify Insights: https://insights.sbomify.com/GHSA-2g8g-63j4-9w3r/
Summaries are generated and may contain mistakes; the official description above is the record.
