# GHSA-7ww5-4wqc-m92c: containerd allows RAPL to be accessible to a container

> Attackers with container access can read RAPL power data to perform side-channel attacks against AES-NI and KASLR, bypassing kernel mitigations.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Local or same network only
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 19 Dec 2023
- **Also known as:** GO-2023-2412

## What is GHSA-7ww5-4wqc-m92c?

GHSA-7ww5-4wqc-m92c is a vulnerability in github.com/containerd/containerd, published on 19 Dec 2023. It can only be exploited from the same machine or local network, with no action from the victim.

### Official description

# /sys/devices/virtual/powercap accessible by default to containers

Intel's RAPL (Running Average Power Limit) feature, introduced by the Sandy Bridge microarchitecture, provides software insights into hardware energy consumption. To facilitate this, Intel introduced the powercap framework in Linux kernel 3.13, which reads values via relevant MSRs (model specific registers) and provides unprivileged userspace access via `sysfs`. As RAPL is an interface to access a hardware feature, it is only available when running on bare metal with the module compiled into the kernel.

By 2019, it was realized that in some cases unprivileged access to RAPL readings could be exploited as a power-based side-channel against security features including AES-NI (potentially inside a SGX enclave) and KASLR (kernel address space layout randomization). Also known as the [PLATYPUS attack](https://platypusattack.com/), Intel assigned [CVE-2020-8694](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-8694) and [CVE-2020-8695](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-8695), and AMD assigned [CVE-2020-12912](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-12912).

Several mitigations were applied; Intel reduced the sampling resolution via a microcode update, and the Linux kernel [prevents access by non-root users](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=949dd0104c496fa7c14991a23c03c62e44637e71) since 5.10. However, this kernel-based mitigation does not apply to many container-based scenarios:
* Unless using user namespaces, root inside a container has the same level of privilege as root outside the container, but with a slightly more narrow view of the system
* `sysfs` is mounted inside containers read-only; however only read access is needed to carry out this attack on an unpatched CPU

While this is not a direct vulnerability in container runtimes, defense in depth and safe defaults are valuable and preferred, especially as this poses a risk to multi-tenant container environments. This is provided by masking `/sys/devices/virtual/powercap` in the default mount configuration, and adding an additional set of rules to deny it in the default AppArmor profile.

While `sysfs` is not the only way to read from the RAPL subsystem, other ways of accessing it require additional capabilities such as `CAP_SYS_RAWIO` which is not available to containers by default, or `perf` paranoia level less than 1, which is a non-default kernel tunable.

## References

* https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-8694
* https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-8695
* https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-12912
* https://platypusattack.com/
* https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=949dd0104c496fa7c14991a23c03c62e44637e71
* https://web.eece.maine.edu/~vweaver/projects/rapl/

## Which versions are affected by GHSA-7ww5-4wqc-m92c?

5 open source packages ship an affected version, including github.com/containerd/containerd.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/containerd/containerd` | Go | All versions | 1.6.26, 1.7.11 |
| `github.com/containerd/containerd` | Go | All versions | 1.6.26 |
| `github.com/containerd/containerd` | Go | All versions | 1.6.26 |
| `github.com/containerd/containerd` | Go | From 1.7.0 | 1.7.11 |
| `github.com/containerd/containerd` | Go | From 1.7.0 | 1.7.11 |

## How do I fix GHSA-7ww5-4wqc-m92c?

Upgrade github.com/containerd/containerd to a fixed version for your release line: 1.6.26 or 1.7.11.

## Is GHSA-7ww5-4wqc-m92c being exploited?

There is no known exploitation of GHSA-7ww5-4wqc-m92c in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-7ww5-4wqc-m92c and fix it if it is affected.

What it is: GHSA-7ww5-4wqc-m92c is a vulnerability in github.com/containerd/containerd, published on 19 Dec 2023. It can only be exploited from the same machine or local network, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-7ww5-4wqc-m92c in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/containerd/containerd (Go): affected all versions; fixed in 1.6.26, 1.7.11
- github.com/containerd/containerd (Go): affected all versions; fixed in 1.6.26
- github.com/containerd/containerd (Go): affected all versions; fixed in 1.6.26
- github.com/containerd/containerd (Go): affected from 1.7.0; fixed in 1.7.11
- github.com/containerd/containerd (Go): affected from 1.7.0; fixed in 1.7.11

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-7ww5-4wqc-m92c/ (Markdown: https://insights.sbomify.com/GHSA-7ww5-4wqc-m92c/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-7ww5-4wqc-m92c

---
From sbomify Insights: https://insights.sbomify.com/GHSA-7ww5-4wqc-m92c/
Summaries are generated and may contain mistakes; the official description above is the record.
