# CVE-2022-23465: SwiftTerm vulnerable to arbitrary command execution

> Attackers can execute arbitrary commands by injecting malicious escape sequences into terminal window titles, affecting users of the SwiftTerm library.

- **Severity:** High 7.1 (`CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:L/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Local or same network only
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 2 Dec 2022
- **Updated:** 23 Apr 2025
- **Also known as:** GHSA-jq43-q8mx-r7mq

## What is CVE-2022-23465?

CVE-2022-23465 is a high-severity command injection vulnerability in migueldeicaza SwiftTerm, published on 2 Dec 2022. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

### Official description

SwiftTerm is a Xterm/VT100 Terminal emulator. Prior to commit a94e6b24d24ce9680ad79884992e1dff8e150a31, an attacker could modify the window title via a certain character escape sequence and then insert it back to the command line in the user's terminal, e.g. when the user views a file containing the malicious sequence, which could allow the attacker to execute arbitrary commands. Version a94e6b24d24ce9680ad79884992e1dff8e150a31 contains a patch for this issue. There are no known workarounds available.

Weakness: CWE-94 (Improper Control of Generation of Code)

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

2 open source packages ship an affected version, including github.com/migueldeicaza/SwiftTerm. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/migueldeicaza/SwiftTerm` | SwiftURL | All versions | 1.2.0 |
| `github.com/migueldeicaza/SwiftTerm` | SwiftURL | All versions | 1.2.0 |

Products: Swiftterm Project Swiftterm.

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

Upgrade github.com/migueldeicaza/SwiftTerm to 1.2.0 or later.

## Is CVE-2022-23465 being exploited?

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

## Fix prompt for AI coding agents

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

What it is: CVE-2022-23465 is a high-severity command injection vulnerability in migueldeicaza SwiftTerm, published on 2 Dec 2022. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2022-23465 in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/migueldeicaza/SwiftTerm (SwiftURL): affected all versions; fixed in 1.2.0
- github.com/migueldeicaza/SwiftTerm (SwiftURL): affected all versions; fixed in 1.2.0

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

## Sources

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

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