Vulnerabilities in pkg:npm/@tauri-apps/cli

PACKAGE
Advisory Identifier: GHSA-2rcp-jvr4-r259
Advisory Summary

CVE-2023-46115 is a HIGH (CVSS 8.4) tauri's updater private keys possibly vulnerability (CWE-522: Insufficiently Protected Credentials) affecting Tauri cli libraries in the crates.io ecosystem. The issue involves tauri's updater private keys possibly leaked via vite environment variables. Remediation is available by upgrading affected packages to version 2.0.0-alpha.16, 1.5.6.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/@tauri-apps/cli

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/@tauri-apps/cli. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-2rcp-jvr4-r259 CVE-2023-46115 HIGH Tauri's Updater Private Keys Possibly Leaked via Vite Environment Variables

CVE-2023-46115 at a Glance

CVE Identifier CVE-2023-46115
GHSA Identifier GHSA-2rcp-jvr4-r259
Severity HIGH
CVSS v3.1 Base Score 8.4
CWE Classification CWE-522: Insufficiently Protected Credentials
Affected Product Tauri cli
Package Ecosystem crates.io
Published Date
Last Updated

Security Impact

CVSS: 8.4

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

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

How to Fix CVE-2023-46115

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

tauri-cli fixed: 2.0.0-alpha.16
Upgrade tauri-cli to 2.0.0-alpha.16
@tauri-apps/cli fixed: 2.0.0-alpha.16
npm install @tauri-apps/cli@2.0.0-alpha.16
@tauri-apps/cli fixed: 1.5.6
npm install @tauri-apps/cli@1.5.6
tauri-cli fixed: 1.5.6
Upgrade tauri-cli to 1.5.6
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 tauri-cli

How to Check if You Are Affected

To determine whether your application is affected by CVE-2023-46115, inspect your project dependencies for Tauri cli:

inspect dependencies for tauri-cli

Analyze the terminal output to locate any version of Tauri cli in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.0.0-alpha.16), 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-522: Insufficiently Protected Credentials, where the product transmits or stores authentication credentials, but it uses an insecure method that is susceptible to unauthorized interception and/or retrieval. In Tauri cli, 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 This advisory is not describing a vulnerability in the Tauri code base itself but a commonly used misconfiguration which could lead to leaking of the private key and updater key password into bundled Tauri applications using the Vite frontend in a specific configuration. The Tauri documentation used an insecure example configuration in the [Vite guide](https://tauri.app/v1/guides/getting-started/setup/vite/) to showcase how to use Tauri together with Vite. Copying the following snippet `envPrefix: ['VITE_', 'TAURI_'],` from this guide into the `vite.config.ts` of a Tauri project possibly leads to bundling the `TAURI_PRIVATE_KEY` and `TAURI_KEY_PASSWORD` into the Vite frontend code and therefore leaking this value to the debug built of a Tauri application. The value is automatically bundled into debug builds but for production builds it is not embedded, as long as it is not directly referenced in the frontend code. Vite statically replaces these values in production builds. This reduces the amount of affected applications to a very small amount of affected applications. To verify if you are affected you can search for the private key value or the `TAURI_PRIVATE_KEY` variable inside the release build frontend assets (`dist/`). > Example: `grep -r "TAURI_PRIVATE_KEY" dist/` Using only the `envPrefix: ['VITE_'],` or any other framework than Vite means you are not impacted by this advisory. ### Patches The documentation has been patched but as the root cause is not in Tauri itself the issue is not fixed by updating Tauri. The `vite.config.ts` configuration of the project needs to be adapted. We recommend rotating your updater private key if you are affected by this (requires Tauri CLI >=1.5.5). After updating the envPrefix configuration, generate a new private key with `tauri signer generate`, saving the new private key and updating the updater's `pubkey` value on `tauri.conf.json` with the new public key. To update your existing application, the next application build must be signed with the older private key in order to be accepted by the existing application. ### Workarounds The `envPrefix: ['VITE_'],`should be used and the desired `TAURI` variables manually added. Respective these variables could be added `TAURI_PLATFORM`, `TAURI_ARCH`, `TAURI_FAMILY`, `TAURI_PLATFORM_VERSION`, `TAURI_PLATFORM_TYPE` and `TAURI_DEBUG` without leaking sensitive information. We urge affected users to implement the workaround as the `1.x` branch will not receive a general prevention fix as it would break systems. ### References The issue was originally disclosed in our discord [here](https://discord.com/channels/616186924390023171/1164260301655523409). The affected guide is [https://tauri.app/v1/guides/getting-started/setup/vite/](https://tauri.app/v1/guides/getting-started/setup/vite/). > Update: We lowered the severity from high to low, as the likelihood of impact was found to only affect a **very limited** amount of applications. > Update2: We changed the affected versions to make clear that after `2.0.0-alpha.16` or `1.5.6` the potentially vulnerable recommendation was no longer visible on our website and should not affect projects by default. A lot of users were confused and we believe this advisory reached the necessary user base.

CVE-2023-46115 Affected Tauri cli Versions

4 component(s)
Fixed Versions:
2.0.0-alpha.161.5.6
Product / Package Ecosystem Affected Versions Fixed Version
tauri-cli
crates.io
≥ 2.0.0-alpha.0
< 2.0.0-alpha.16
2.0.0-alpha.16
@tauri-apps/cli
npm
≥ 2.0.0-alpha.0
< 2.0.0-alpha.16
2.0.0-alpha.16
@tauri-apps/cli
npm
≥ 1.0.0
< 1.5.6
1.5.6
tauri-cli
crates.io
≥ 1.0.0
< 1.5.6
1.5.6

References

Frequently Asked Questions

What is CVE-2023-46115?
CVE-2023-46115 is a security vulnerability in Tauri cli involving Tauri's Updater Private Keys Possibly Leaked via Vite Environment Variables under CWE-522: Insufficiently Protected Credentials.
Which Tauri cli versions are affected?
Affected versions include releases prior to 2.0.0-alpha.16, 1.5.6 across affected packages: tauri-cli, @tauri-apps/cli.
What version fixes CVE-2023-46115?
Upgrading to 2.0.0-alpha.16, 1.5.6 (or the latest patched release for your respective branch) resolves the vulnerability.
Is tauri-cli affected?
Yes, tauri-cli is affected in releases prior to 2.0.0-alpha.16, 1.5.6. Upgrade your dependency to 2.0.0-alpha.16, 1.5.6 or later.
Is @tauri-apps/cli affected?
Yes, @tauri-apps/cli is affected in releases prior to 2.0.0-alpha.16, 1.5.6. Upgrade your dependency to 2.0.0-alpha.16, 1.5.6 or later.
What is the CVSS score of CVE-2023-46115?
CVE-2023-46115 has a CVSS v3.1 base score of 8.4 (HIGH) with vector string CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:N.
What CWE is associated with CVE-2023-46115?
CVE-2023-46115 is classified under CWE-522: Insufficiently Protected Credentials (The product transmits or stores authentication credentials, but it uses an insecure method that is susceptible to unauthorized interception and/or retrieval.).
How can I check crates.io dependencies for CVE-2023-46115?
Run the dependency tree command: 'inspect dependencies for tauri-cli'. 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-2rcp-jvr4-r259",
  "modified" : "2023-12-19T19:08:00Z",
  "published" : "2023-10-20T15:18:52Z",
  "aliases" : [ "CVE-2023-46115" ],
  "summary" : "Tauri's Updater Private Keys Possibly Leaked via Vite Environment Variables",
  "details" : "### Impact\n\nThis advisory is not describing a vulnerability in the Tauri code base itself but a commonly used misconfiguration which could lead to leaking of the private key and updater key password into bundled Tauri applications using the Vite frontend in a specific configuration.\n\nThe Tauri documentation used an insecure example configuration in the [Vite guide](https://tauri.app/v1/guides/getting-started/setup/vite/) to showcase how to use Tauri together with Vite. \n\nCopying the following snippet `envPrefix: ['VITE_', 'TAURI_'],` from this guide into the `vite.config.ts` of a Tauri project possibly leads to bundling the `TAURI_PRIVATE_KEY` and `TAURI_KEY_PASSWORD` into the Vite frontend code and therefore leaking this value to the debug built of a Tauri application.\n\nThe value is automatically bundled into debug builds but for production builds it is not embedded, as long as it is not directly referenced in the frontend code. Vite statically replaces these values in production builds. This reduces the amount of affected applications to a very small amount of affected applications.\n\nTo verify if you are affected you can search for the private key value or the `TAURI_PRIVATE_KEY` variable inside the release build frontend assets (`dist/`).\n\n> Example: `grep -r \"TAURI_PRIVATE_KEY\" dist/`\n\nUsing only the `envPrefix: ['VITE_'],` or any other framework than Vite means you are not impacted by this advisory.\n\n### Patches\n\nThe documentation has been patched but as the root cause is not in Tauri itself the issue is not fixed by updating Tauri.\nThe `vite.config.ts` configuration of the project needs to be adapted.\n\nWe recommend rotating your updater private key if you are affected by this (requires Tauri CLI >=1.5.5). After updating the envPrefix configuration, generate a new private key with `tauri signer generate`, saving the new private key and updating the updater's `pubkey` value on `tauri.conf.json` with the new public key. To update your existing application, the next application build must be signed with the older private key in order to be accepted by the existing application.\n\n### Workarounds\n\nThe `envPrefix: ['VITE_'],`should be used and the desired `TAURI` variables manually added.\nRespective these variables could be added `TAURI_PLATFORM`, `TAURI_ARCH`, `TAURI_FAMILY`, `TAURI_PLATFORM_VERSION`, `TAURI_PLATFORM_TYPE` and `TAURI_DEBUG` without leaking sensitive information.\n\nWe urge affected users to implement the workaround as the `1.x` branch will not receive a general prevention fix as it would break systems.\n\n### References\nThe issue was originally disclosed in our discord [here](https://discord.com/channels/616186924390023171/1164260301655523409).\nThe affected guide is [https://tauri.app/v1/guides/getting-started/setup/vite/](https://tauri.app/v1/guides/getting-started/setup/vite/).\n\n\n> Update: We lowered the severity from high to low, as the likelihood of impact was found to only affect a **very limited** amount of applications.\n\n> Update2: We changed the affected versions to make clear that after `2.0.0-alpha.16` or `1.5.6` the potentially vulnerable recommendation was no longer visible on our website and should not affect projects by default. A lot of users were confused and we believe this advisory reached the necessary user base.\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "tauri-cli"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0-alpha.0"
      }, {
        "fixed" : "2.0.0-alpha.16"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@tauri-apps/cli"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0-alpha.0"
      }, {
        "fixed" : "2.0.0-alpha.16"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@tauri-apps/cli"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.0.0"
      }, {
        "fixed" : "1.5.6"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "tauri-cli"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.0.0"
      }, {
        "fixed" : "1.5.6"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/tauri-apps/tauri/security/advisories/GHSA-2rcp-jvr4-r259"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-46115"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/tauri-apps/tauri/commit/8b166e9bf82e69ddb3200a3a825614980bd8d433"
  }, {
    "type" : "WEB",
    "url" : "https://discord.com/channels/616186924390023171/1164260301655523409"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/tauri-apps/tauri"
  }, {
    "type" : "WEB",
    "url" : "https://tauri.app/v1/guides/getting-started/setup/vite"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-200", "CWE-522" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-10-20T15:18:52Z",
    "nvd_published_at" : "2023-10-20T00:15:16Z"
  }
}