Skip to content
Heist/ feed
Back to feed
UnratedFix available

Multiple issues involving quote API

Type: advisorySources: OSV

## Issue 1: Failure to quote characters Affected versions of this crate allowed the bytes `{` and `\xa0` to appear unquoted and unescaped in command arguments. If the output of `quote` or `join` is passed to a shell, then what should be a single command argument could be interpreted as multiple arguments. This does not *directly* allow arbitrary command execution (you can't inject a command substitution or similar). But depending on the command you're running, being able to inject multiple arguments where only one is expected could lead to undesired consequences, potentially including arbitrary command execution. The flaw was corrected in version 1.2.1 by escaping additional characters. Updating to 1.3.0 is recommended, but 1.2.1 offers a more minimal fix if desired. Workaround: Check for the bytes `{` and `\xa0` in `quote`/`join` input or output. (Note: `{` is problematic because it is used for glob expansion. `\xa0` is problematic because it's treated as a word separator in [specific environments][solved-xa0].) ## Issue 2: Dangerous API w.r.t. nul bytes Version 1.3.0 deprecates the `quote` and `join` APIs in favor of `try_quote` and `try_join`, which behave the same except that they have `Result` return type, returning `Err` if the input contains nul bytes. Strings containing nul bytes generally cannot be used in Unix command arguments or environment variables, and most shells cannot handle nul bytes even internally. If you try to pass one anyway, then the results might be

Products
shlex
Affected versions
Not specified
Fixed versions
1.3.0
CVEs
CVE-2024-58266
Confirmed fixed CVEs
Not specified
Updated in this feed
30 Oct 2026, 08:42 UTC · Revision 1

Source evidence

Multiple issues involving quote API

core-osv · Original source

Published 21 Jan 2024, 12:00 UTC

## Issue 1: Failure to quote characters Affected versions of this crate allowed the bytes `{` and `\xa0` to appear unquoted and unescaped in command arguments. If the output of `quote` or `join` is passed to a shell, then what should be a single command argument could be interpreted as multiple arguments. This does not *directly* allow arbitrary command execution (you can't inject a command substitution or similar). But depending on the command you're running, being able to inject multiple arguments where only one is expected could lead to undesired consequences, potentially including arbitrary command execution. The flaw was corrected in version 1.2.1 by escaping additional characters. Updating to 1.3.0 is recommended, but 1.2.1 offers a more minimal fix if desired. Workaround: Check for the bytes `{` and `\xa0` in `quote`/`join` input or output. (Note: `{` is problematic because it is used for glob expansion. `\xa0` is problematic because it's treated as a word separator in [specific environments][solved-xa0].) ## Issue 2: Dangerous API w.r.t. nul bytes Version 1.3.0 deprecates the `quote` and `join` APIs in favor of `try_quote` and `try_join`, which behave the same except that they have `Result` return type, returning `Err` if the input contains nul bytes. Strings containing nul bytes generally cannot be used in Unix command arguments or environment variables, and most shells cannot handle nul bytes even internally. If you try to pass one anyway, then the results might be

osv:RUSTSEC-2024-0006

shlex

Fixed versions: 1.3.0

Complete source record
{
  "id": "267ed046f2e39d555df7ff99c60964ae220f9bc4d3560e0999f7fa314f0a6120",
  "url": "https://osv.dev/vulnerability/RUSTSEC-2024-0006",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "Multiple issues involving quote API",
    "summary": "## Issue 1: Failure to quote characters Affected versions of this crate allowed the bytes `{` and `\\xa0` to appear unquoted and unescaped in command arguments. If the output of `quote` or `join` is passed to a shell, then what should be a single command argument could be interpreted as multiple arguments. This does not *directly* allow arbitrary command execution (you can't inject a command substitution or similar). But depending on the command you're running, being able to inject multiple arguments where only one is expected could lead to undesired consequences, potentially including arbitrary command execution. The flaw was corrected in version 1.2.1 by escaping additional characters. Updating to 1.3.0 is recommended, but 1.2.1 offers a more minimal fix if desired. Workaround: Check for the bytes `{` and `\\xa0` in `quote`/`join` input or output. (Note: `{` is problematic because it is used for glob expansion. `\\xa0` is problematic because it's treated as a word separator in [specific environments][solved-xa0].) ## Issue 2: Dangerous API w.r.t. nul bytes Version 1.3.0 deprecates the `quote` and `join` APIs in favor of `try_quote` and `try_join`, which behave the same except that they have `Result` return type, returning `Err` if the input contains nul bytes. Strings containing nul bytes generally cannot be used in Unix command arguments or environment variables, and most shells cannot handle nul bytes even internally. If you try to pass one anyway, then the results might be ",
    "evidence": "osv:RUSTSEC-2024-0006",
    "products": [
      {
        "name": {
          "value": "shlex",
          "evidence": "/affected/0/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [
          {
            "value": "1.3.0",
            "evidence": "/affected/0/ranges"
          }
        ],
        "affected_versions": []
      }
    ],
    "severity": "unknown",
    "structured": {
      "id": "RUSTSEC-2024-0006",
      "aliases": [
        "CVE-2024-58266",
        "GHSA-r7qv-8r2h-pg27",
        "RUSTSEC-2024-0006"
      ],
      "affected": [
        {
          "ranges": [
            {
              "type": "SEMVER",
              "events": [
                {
                  "introduced": "0.0.0-0"
                },
                {
                  "fixed": "1.3.0"
                }
              ]
            }
          ],
          "package": {
            "name": "shlex",
            "purl": "pkg:cargo/shlex",
            "ecosystem": "crates.io"
          },
          "database_specific": {
            "cvss": null,
            "source": "https://github.com/rustsec/advisory-db/blob/osv/crates/RUSTSEC-2024-0006.json",
            "categories": [
              "code-execution",
              "file-disclosure"
            ],
            "informational": null
          },
          "ecosystem_specific": {
            "affects": {
              "os": [],
              "arch": [],
              "functions": [
                "shlex::bytes::join",
                "shlex::bytes::quote",
                "shlex::join",
                "shlex::quote"
              ]
            },
            "affected_functions": null
          }
        }
      ],
      "modified": "2026-10-12T18:00:05.115853645Z",
      "provider": "osv",
      "references": [
        "https://crates.io/crates/shlex",
        "https://rustsec.org/advisories/RUSTSEC-2024-0006.html",
        "https://github.com/comex/rust-shlex/commit/4a0724b0b62ef715467875b040a890ce75a8a829"
      ],
      "provider_metadata": {
        "license": "CC0-1.0"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2024-58266",
        "evidence": "/aliases"
      }
    ],
    "security_relevant": true,
    "severity_evidence": null
  },
  "source_id": "core-osv",
  "document_id": 306349,
  "published_at": "2024-01-21T12:00:00+00:00"
}