# CVE-2022-36633: Improper token validation leading to code execution in Teleport

> Attackers can achieve remote code execution via command injection in Teleport's SSH agent installation link handling.

- **Severity:** High 8.8 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 24 Aug 2022
- **Updated:** 3 Aug 2024
- **Also known as:** GHSA-6xf3-5hp7-xqqg

## What is CVE-2022-36633?

CVE-2022-36633 is a high-severity command injection vulnerability in n/a, published on 24 Aug 2022. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

Teleport 9.3.6 is vulnerable to Command injection leading to Remote Code Execution. An attacker can craft a malicious ssh agent installation link by URL encoding a bash escape with carriage return line feed. This url encoded payload can be used in place of a token and sent to a user in a social engineering attack. This is fully unauthenticated attack utilizing the trusted teleport server to deliver the payload.

Weakness: CWE-78 (Improper Neutralization of Special Elements used in an OS Command)

## Which versions are affected by CVE-2022-36633?

6 open source packages ship an affected version, including github.com/gravitational/teleport. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/gravitational/teleport` | Go | All versions | 8.3.17 |
| `github.com/gravitational/teleport` | Go | All versions | 8.3.17 |
| `github.com/gravitational/teleport` | Go | From 10.0.0 | 10.1.2 |
| `github.com/gravitational/teleport` | Go | From 10.0.0 | 10.1.2 |
| `github.com/gravitational/teleport` | Go | From 9.0.0 | 9.3.13 |
| `github.com/gravitational/teleport` | Go | From 9.0.0 | 9.3.13 |

Products: Goteleport Teleport.

## How do I fix CVE-2022-36633?

Upgrade github.com/gravitational/teleport to a fixed version for your release line: 8.3.17, 10.1.2 or 9.3.13.

## Is CVE-2022-36633 being exploited?

There is no known exploitation of CVE-2022-36633 in the wild and no public exploit code.

Public exploit code:

- Teleport v10.1.1 - Remote Code Execution (RCE) (exploitdb)

## Other vulnerabilities in n/a

- [CVE-2021-41393](https://insights.sbomify.com/CVE-2021-41393/): Security feature bypass in n/a (critical 9.8)
- [CVE-2022-38599](https://insights.sbomify.com/CVE-2022-38599/): Information disclosure in n/a (medium 6.5)
- [CVE-2021-41395](https://insights.sbomify.com/CVE-2021-41395/): Other in n/a (medium 6.5)
- [CVE-2021-41394](https://insights.sbomify.com/CVE-2021-41394/): Supply chain in n/a (medium 5.3)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2022-36633 and fix it if it is affected.

What it is: CVE-2022-36633 is a high-severity command injection vulnerability in n/a, published on 24 Aug 2022. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2022-36633 in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/gravitational/teleport (Go): affected all versions; fixed in 8.3.17
- github.com/gravitational/teleport (Go): affected all versions; fixed in 8.3.17
- github.com/gravitational/teleport (Go): affected from 10.0.0; fixed in 10.1.2
- github.com/gravitational/teleport (Go): affected from 10.0.0; fixed in 10.1.2
- github.com/gravitational/teleport (Go): affected from 9.0.0; fixed in 9.3.13
- github.com/gravitational/teleport (Go): affected from 9.0.0; fixed in 9.3.13

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/CVE-2022-36633/ (Markdown: https://insights.sbomify.com/CVE-2022-36633/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2022-36633
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2022-36633
- OSV: https://osv.dev/vulnerability/CVE-2022-36633

---
From sbomify Insights: https://insights.sbomify.com/CVE-2022-36633/
Summaries are generated and may contain mistakes; the official description above is the record.
