CVE-2022-23465: Github.com/migueldeicaza/SwiftTerm SwiftTerm Code Injection Vulnerability Vulnerability

HIGH
Advisory Identifier: GHSA-jq43-q8mx-r7mq
CVSS 7.1
CWE-94
Published
Advisory Summary

CVE-2022-23465 is a HIGH (CVSS 7.1) swiftterm code injection vulnerability vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Github.com/migueldeicaza/SwiftTerm libraries in the SwiftURL ecosystem. The issue involves swiftterm code injection vulnerability. Remediation is available by upgrading affected packages to version 1.2.0.

CVE-2022-23465 at a Glance

CVE Identifier CVE-2022-23465
GHSA Identifier GHSA-jq43-q8mx-r7mq
Severity HIGH
CVSS v3.1 Base Score 7.1
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product Github.com/migueldeicaza/SwiftTerm
Package Ecosystem SwiftURL
Published Date
Last Updated

Security Impact

CVSS: 7.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:L/A:N).

Attack Vector Local (AV:L)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2022-23465

To remediate this vulnerability, upgrade all affected Github.com/migueldeicaza/SwiftTerm dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/migueldeicaza/SwiftTerm fixed: 1.2.0
Upgrade github.com/migueldeicaza/SwiftTerm to 1.2.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/migueldeicaza/SwiftTerm

How to Check if You Are Affected

To determine whether your application is affected by CVE-2022-23465, inspect your project dependencies for Github.com/migueldeicaza/SwiftTerm:

inspect dependencies for github.com/migueldeicaza/SwiftTerm

Analyze the terminal output to locate any version of Github.com/migueldeicaza/SwiftTerm in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.2.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In Github.com/migueldeicaza/SwiftTerm, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact 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. ### Credit These bugs were found and disclosed by David Leadbeater <dgl@dgl.cx> (@dgl at Github.com) ### Patches Fixed in version ce596e0dc8cdb288bc7ed5c6a59011ee3a8dc171 ### Workarounds There are no workarounds available ### References Similar exploits to this existed in the past, for terminal emulators: https://nvd.nist.gov/vuln/detail/CVE-2003-0063 https://nvd.nist.gov/vuln/detail/CVE-2008-2383 Additional background and information is also available: https://marc.info/?l=bugtraq&m=104612710031920&w=2 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=510030

CVE-2022-23465 Affected Github.com/migueldeicaza/SwiftTerm Versions

1 component(s)
Fixed Versions:
1.2.0
Product / Package Ecosystem Affected Versions Fixed Version
github.com/migueldeicaza/SwiftTerm
SwiftURL
< 1.2.0
1.2.0

References

Frequently Asked Questions

What is CVE-2022-23465?
CVE-2022-23465 is a security vulnerability in Github.com/migueldeicaza/SwiftTerm involving SwiftTerm Code Injection vulnerability under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which Github.com/migueldeicaza/SwiftTerm versions are affected?
Affected versions include releases prior to 1.2.0 across affected packages: github.com/migueldeicaza/SwiftTerm.
What version fixes CVE-2022-23465?
Upgrading to 1.2.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/migueldeicaza/SwiftTerm affected?
Yes, github.com/migueldeicaza/SwiftTerm is affected in releases prior to 1.2.0. Upgrade your dependency to 1.2.0 or later.
What is the CVSS score of CVE-2022-23465?
CVE-2022-23465 has a CVSS v3.1 base score of 7.1 (HIGH) with vector string CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:L/A:N.
What CWE is associated with CVE-2022-23465?
CVE-2022-23465 is classified under CWE-94: Improper Control of Generation of Code ('Code Injection') (The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.).
How can I check SwiftURL dependencies for CVE-2022-23465?
Run the dependency tree command: 'inspect dependencies for github.com/migueldeicaza/SwiftTerm'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-jq43-q8mx-r7mq",
  "modified" : "2024-02-09T00:34:39Z",
  "published" : "2023-07-14T21:58:43Z",
  "aliases" : [ "CVE-2022-23465" ],
  "summary" : "SwiftTerm Code Injection vulnerability",
  "details" : "### Impact\n\nAttacker 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.\n\n### Credit\nThese bugs were found and disclosed by David Leadbeater <dgl@dgl.cx> (@dgl at Github.com)\n\n### Patches\n\nFixed in version ce596e0dc8cdb288bc7ed5c6a59011ee3a8dc171\n\n### Workarounds\n\nThere are no workarounds available\n\n### References\n\nSimilar exploits to this existed in the past, for terminal emulators:\n\nhttps://nvd.nist.gov/vuln/detail/CVE-2003-0063\nhttps://nvd.nist.gov/vuln/detail/CVE-2008-2383\n\nAdditional background and information is also available:\n\nhttps://marc.info/?l=bugtraq&m=104612710031920&w=2\nhttps://bugs.debian.org/cgi-bin/bugreport.cgi?bug=510030\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "SwiftURL",
      "name" : "github.com/migueldeicaza/SwiftTerm"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.2.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/migueldeicaza/SwiftTerm/security/advisories/GHSA-jq43-q8mx-r7mq"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-23465"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/migueldeicaza/SwiftTerm/commit/a94e6b24d24ce9680ad79884992e1dff8e150a31"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/migueldeicaza/SwiftTerm"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-94" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-07-14T21:58:43Z",
    "nvd_published_at" : "2022-12-02T23:15:16Z"
  }
}