# GHSA-w2j5-3rcx-vx7x: Sysctls applied to containers with host IPC or host network namespaces can affect the host

> A bug in CRI-O allows users with host network or IPC access to modify host sysctls, potentially escalating privileges or bypassing security controls.

- **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:** 15 Mar 2022
- **Also known as:** GO-2022-0363

## What is GHSA-w2j5-3rcx-vx7x?

GHSA-w2j5-3rcx-vx7x is a vulnerability in github.com/cri-o/cri-o, published on 15 Mar 2022. It can only be exploited from the same machine or local network, with no action from the victim.

### Official description

### Impact
Before setting the sysctls for a pod, the pods namespaces must be unshared (created). However, in cases where the pod is using a host network or IPC namespace, a bug in CRI-O caused the namespace creating tool [pinns](https://github.com/cri-o/cri-o/tree/main/pinns/) to configure the sysctls of the host. This allows a malicious user to set sysctls on the host, assuming they have access to hostNetwork and hostIPC.

Any CRI-O cluster after CRI-O 1.18 that drops the infra container
1.22 and 1.23 clusters drop infra container by default, and are thus vulnerable by default.

### Patches
CRI-O versions 1.24.0, 1.23.1, 1.22.2, 1.21.5, 1.20.6, 1.19.5 all have the patches.

### Workarounds
Users can set `manage_ns_lifecycle` to false, which causes the sysctls to be configured by the OCI runtime, which typically filter these cases. This option is available in 1.20 and 1.19. Newer versions don't have this option.
An admission webhook could also be created to deny pods that use host IPC or network namespaces and also attempt to configure sysctls related to that namespace.

### For more information
If you have any questions or comments about this advisory:
* Open an issue in [the CRI-O repo](http://github.com/cri-o/cri-o/issues)
* To make a report, email your vulnerability to the private
[cncf-crio-security@lists.cncf.io](mailto:cncf-crio-security@lists.cncf.io) list
with the security details and the details expected for [all CRI-O bug
reports](https://github.com/cri-o/cri-o/blob/main/.github/ISSUE_TEMPLATE/bug-report.yml).

## Which versions are affected by GHSA-w2j5-3rcx-vx7x?

11 open source packages ship an affected version, including github.com/cri-o/cri-o.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/cri-o/cri-o` | Go | From 1.18.0 | 1.19.5, 1.20.6, 1.21.5, 1.22.2, 1.23.1 |
| `github.com/cri-o/cri-o` | Go | From 1.18.0 | 1.19.5 |
| `github.com/cri-o/cri-o` | Go | From 1.18.0 | 1.19.5 |
| `github.com/cri-o/cri-o` | Go | From 1.20.0 | 1.20.6 |
| `github.com/cri-o/cri-o` | Go | From 1.20.0 | 1.20.6 |
| `github.com/cri-o/cri-o` | Go | From 1.21.0 | 1.21.5 |
| `github.com/cri-o/cri-o` | Go | From 1.21.0 | 1.21.5 |
| `github.com/cri-o/cri-o` | Go | From 1.22.0 | 1.22.2 |
| `github.com/cri-o/cri-o` | Go | From 1.22.0 | 1.22.2 |
| `github.com/cri-o/cri-o` | Go | From 1.23.0 | 1.23.1 |
| `github.com/cri-o/cri-o` | Go | From 1.23.0 | 1.23.1 |

## How do I fix GHSA-w2j5-3rcx-vx7x?

Upgrade github.com/cri-o/cri-o to a fixed version for your release line: 1.19.5, 1.20.6, 1.21.5 or 1.22.2.

## Is GHSA-w2j5-3rcx-vx7x being exploited?

There is no known exploitation of GHSA-w2j5-3rcx-vx7x in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-w2j5-3rcx-vx7x and fix it if it is affected.

What it is: GHSA-w2j5-3rcx-vx7x is a vulnerability in github.com/cri-o/cri-o, published on 15 Mar 2022. 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-w2j5-3rcx-vx7x in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/cri-o/cri-o (Go): affected from 1.18.0; fixed in 1.19.5, 1.20.6, 1.21.5, 1.22.2, 1.23.1
- github.com/cri-o/cri-o (Go): affected from 1.18.0; fixed in 1.19.5
- github.com/cri-o/cri-o (Go): affected from 1.18.0; fixed in 1.19.5
- github.com/cri-o/cri-o (Go): affected from 1.20.0; fixed in 1.20.6
- github.com/cri-o/cri-o (Go): affected from 1.20.0; fixed in 1.20.6
- github.com/cri-o/cri-o (Go): affected from 1.21.0; fixed in 1.21.5
- github.com/cri-o/cri-o (Go): affected from 1.21.0; fixed in 1.21.5
- github.com/cri-o/cri-o (Go): affected from 1.22.0; fixed in 1.22.2
- github.com/cri-o/cri-o (Go): affected from 1.22.0; fixed in 1.22.2
- github.com/cri-o/cri-o (Go): affected from 1.23.0; fixed in 1.23.1
- github.com/cri-o/cri-o (Go): affected from 1.23.0; fixed in 1.23.1

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-w2j5-3rcx-vx7x/ (Markdown: https://insights.sbomify.com/GHSA-w2j5-3rcx-vx7x/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-w2j5-3rcx-vx7x

---
From sbomify Insights: https://insights.sbomify.com/GHSA-w2j5-3rcx-vx7x/
Summaries are generated and may contain mistakes; the official description above is the record.
