CVE-2024-35222: Tauri IFrames Bypass Origin Checks For Vulnerability

MODERATE
Advisory Identifier: GHSA-57fm-592m-34r7
CVSS 5.9
CWE-284
Published
Advisory Summary

CVE-2024-35222 is a MODERATE (CVSS 5.9) iframes bypass origin checks for vulnerability (CWE-284: Improper Access Control) affecting Tauri libraries in the crates.io ecosystem. The issue involves iframes bypass origin checks for tauri api access control. Remediation is available by upgrading affected packages to version 1.6.7, 2.0.0-beta.20.

CVE-2024-35222 at a Glance

CVE Identifier CVE-2024-35222
GHSA Identifier GHSA-57fm-592m-34r7
Severity MODERATE
CVSS v3.1 Base Score 5.9
CWE Classification CWE-284: Improper Access Control
Affected Product Tauri
Package Ecosystem crates.io
Published Date
Last Updated

Security Impact

CVSS: 5.9

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

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

How to Fix CVE-2024-35222

To remediate this vulnerability, upgrade all affected Tauri 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 fixed: 1.6.7
Upgrade tauri to 1.6.7
tauri fixed: 2.0.0-beta.20
Upgrade tauri to 2.0.0-beta.20
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

How to Check if You Are Affected

To determine whether your application is affected by CVE-2024-35222, inspect your project dependencies for Tauri:

inspect dependencies for tauri

Analyze the terminal output to locate any version of Tauri in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.6.7), 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-284: Improper Access Control, where the product does not restrict or incorrectly restricts access to a resource from an unauthorized actor. In Tauri, 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 Remote origin iFrames in Tauri applications can access the Tauri IPC endpoints without being explicitly allowed in the [`dangerousRemoteDomainIpcAccess`](https://v1.tauri.app/api/config/#securityconfig.dangerousremotedomainipcaccess) in v1 and in the [`capabilities`](https://v2.tauri.app/security/capabilities/#remote-api-access) in v2. This bypasses the origin check and allows iFrames to access the IPC endpoints exposed to the parent window. For this to be exploitable, an attacker must have script execution (e.g. XSS) in a script-enabled iFrame of a Tauri application. ## Patches The patches include changes to wry and the behaviour of Tauri applications using iFrames. Previously, we injected the Tauri IPC initialization script into iFrames on MacOS, which was unintended. This is now also disabled to be consistent with all other supported operating systems. This means that the Tauri invoke functionality is no longer accessible from iFrames, except on Windows when the origin of the Tauri window and the origin of the iFrame are the same. We have also added a new protection mechanism to the IPC layer to protect against iFrames directly using the WebView IPC functionality (e.g. via `window.ipc.postMessage`). This introduces an invoke key (`__TAURI_INVOKE_KEY__`) which is used to prevent frames that have not been initialized by the Tauri core from sending messages to the Tauri IPC. This key is **not** used to protect against compromised Tauri windows or WebViews and is **only** intended to block IPC access from sub-frames. Unauthorized messages to the Tauri IPC from an iFrame or other non-initialized context will log a warning and the potentially malicious IPC call will be ignored. ## Workarounds These workarounds should only be considered if you are unable to upgrade to the patched Tauri version in time. As a workaround for v1 Tauri applications, we recommend using a dedicated window for untrusted origins instead of iFrames, or disabling script execution within the iFrame. For v2 Tauri applications targeting Linux, it is possible to use either a dedicated window or [multiple WebViews](https://github.com/tauri-apps/tauri/tree/dev/examples/multiwebview) in the main window to simulate iFrame behavior. On other platforms, it is only possible to use dedicated windows or disable script execution inside the iFrame, as described for v1. ## References If you have any questions or comments about this advisory: Open an issue in tauri or Email us at [security@tauri.app](mailto:security@tauri.app) The original submissions from the reporter: > ### Context > > This is following up on the comments here: https://github.com/tauri-apps/tauri/issues/8316, and here: https://discord.com/channels/616186924390023171/1227969106091966475. I was asked to submit my findings as a vulnerability report. > > Firstly, thank you to all of you from the core team that helped out and guided me through understanding this issue! Huge fan of Tauri, and I'm excited to see it succeed! > > ### Summary > > In short, **any iframe you add in your Tauri frontend will get access to Tauri APIs, even in isolation mode**. > > Any embedded iframe that you don't own will be able to invoke the same APIs your app does. While isolation mode allows for finer grained control of what Tauri APIs can be called, it is not possible to determine if a request is coming your own app, or from a potentially malicious iframe. > > This means your app could be open to malicious iframe being able to execute any command your app can, and there doesn't seem to be a mechanism to filter these out. > > ### Details > > I'm not an expert in Tauri source code, so I can't be sure I'm on the right track here, but I assume this has to do with how the webview is bootstrapped with the Tauri APIs. > > I know there's various handlers that get set, such as opening `target="_blank"` links via a shell command, and of course setting `invoke` and other such APIs. Sounds like the issue is somewhere there and the APIs are being injected where they shouldn't. > > Technically it seems that an attacker couldn't actually receive a response from the command it executes. Tauri IPC can't route the response back to the invoking iframe, but the action is still executed, with the response just being dropped. You see these messages in the logs: > > ``` > [Warning] [TAURI] Couldn't find callback id 3399436348 in window. This happens when the app is reloaded while Rust is running an asynchronous operation. > ``` > > ### PoC > > Repository with reproduction steps: https://github.com/begleynk/tauri-sandbox-iframe-escape-poc > > Building on that POC, here is a video of a Codepen iframe running inside an isolation mode Tauri app, invoking the same "Greet" command the frontend is invoking. > > https://github.com/tauri-apps/tauri/assets/1065208/8efd5f9d-3116-4068-b98b-6ace7de9261c > > This is done with the following code running inside Codepen: > > ```javascript > window.__TAURI_INVOKE__("greet", { name: "From CodePen" }) > ``` > > ### Impact > > Valid commands with potentially unwanted consequences ("delete project", "transfer credits", etc.) could be invoked by an attacker that controls the content of an iframe running inside a Tauri app.

CVE-2024-35222 Affected Tauri Versions

2 component(s)
Fixed Versions:
1.6.72.0.0-beta.20
Product / Package Ecosystem Affected Versions Fixed Version
tauri
crates.io
< 1.6.7
1.6.7
tauri
crates.io
≥ 2.0.0-beta.0
< 2.0.0-beta.20
2.0.0-beta.20

References

Frequently Asked Questions

What is CVE-2024-35222?
CVE-2024-35222 is a security vulnerability in Tauri involving iFrames Bypass Origin Checks for Tauri API Access Control under CWE-284: Improper Access Control.
Which Tauri versions are affected?
Affected versions include releases prior to 1.6.7, 2.0.0-beta.20 across affected packages: tauri.
What version fixes CVE-2024-35222?
Upgrading to 1.6.7, 2.0.0-beta.20 (or the latest patched release for your respective branch) resolves the vulnerability.
Is tauri affected?
Yes, tauri is affected in releases prior to 1.6.7, 2.0.0-beta.20. Upgrade your dependency to 1.6.7, 2.0.0-beta.20 or later.
What is the CVSS score of CVE-2024-35222?
CVE-2024-35222 has a CVSS v3.1 base score of 5.9 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:H/I:L/A:L.
What CWE is associated with CVE-2024-35222?
CVE-2024-35222 is classified under CWE-284: Improper Access Control (The product does not restrict or incorrectly restricts access to a resource from an unauthorized actor.).
How can I check crates.io dependencies for CVE-2024-35222?
Run the dependency tree command: 'inspect dependencies for tauri'. 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-57fm-592m-34r7",
  "modified" : "2024-05-23T16:06:39Z",
  "published" : "2024-05-23T14:11:24Z",
  "aliases" : [ "CVE-2024-35222" ],
  "summary" : "iFrames Bypass Origin Checks for Tauri API Access Control",
  "details" : "## Impact\n\nRemote origin iFrames in Tauri applications can access the Tauri IPC endpoints without being explicitly allowed in the [`dangerousRemoteDomainIpcAccess`](https://v1.tauri.app/api/config/#securityconfig.dangerousremotedomainipcaccess) in v1 and in the [`capabilities`](https://v2.tauri.app/security/capabilities/#remote-api-access) in v2.\nThis bypasses the origin check and allows iFrames to access the IPC endpoints exposed to the parent window.\n\nFor this to be exploitable, an attacker must have script execution (e.g. XSS) in a script-enabled iFrame of a Tauri application.\n\n## Patches\n\nThe patches include changes to wry and the behaviour of Tauri applications using iFrames. Previously, we injected the Tauri IPC initialization script into iFrames on MacOS, which was unintended. This is now also disabled to be consistent with all other supported operating systems.\n\nThis means that the Tauri invoke functionality is no longer accessible from iFrames, except on Windows when the origin of the Tauri window and the origin of the iFrame are the same.\n\nWe have also added a new protection mechanism to the IPC layer to protect against iFrames directly using the WebView IPC functionality (e.g. via `window.ipc.postMessage`).\nThis introduces an invoke key (`__TAURI_INVOKE_KEY__`) which is used to prevent frames that have not been initialized by the Tauri core from sending messages to the Tauri IPC.\nThis key is **not** used to protect against compromised Tauri windows or WebViews and is **only** intended to block IPC access from sub-frames.\n\nUnauthorized messages to the Tauri IPC from an iFrame or other non-initialized context will log a warning and the potentially malicious IPC call will be ignored.\n\n## Workarounds\n\nThese workarounds should only be considered if you are unable to upgrade to the patched Tauri version in time.\n\nAs a workaround for v1 Tauri applications, we recommend using a dedicated window for untrusted origins instead of iFrames, or disabling script execution within the iFrame.\n\nFor v2 Tauri applications targeting Linux, it is possible to use either a dedicated window or [multiple WebViews](https://github.com/tauri-apps/tauri/tree/dev/examples/multiwebview) in the main window to simulate iFrame behavior.\nOn other platforms, it is only possible to use dedicated windows or disable script execution inside the iFrame, as described for v1.\n\n## References\n\nIf you have any questions or comments about this advisory:\n\nOpen an issue in tauri or\nEmail us at [security@tauri.app](mailto:security@tauri.app)\n\nThe original submissions from the reporter:\n\n> ### Context\n> \n> This is following up on the comments here: https://github.com/tauri-apps/tauri/issues/8316, and here: https://discord.com/channels/616186924390023171/1227969106091966475. I was asked to submit my findings as a vulnerability report.\n> \n> Firstly, thank you to all of you from the core team that helped out and guided me through understanding this issue! Huge fan of Tauri, and I'm excited to see it succeed!\n> \n> ### Summary\n> \n> In short, **any iframe you add in your Tauri frontend will get access to Tauri APIs, even in isolation mode**.\n> \n> Any embedded iframe that you don't own will be able to invoke the same APIs your app does. While isolation mode allows for finer grained control of what Tauri APIs can be called, it is not possible to determine if a request is coming your own app, or from a potentially malicious iframe.\n> \n> This means your app could be open to malicious iframe being able to execute any command your app can, and there doesn't seem to be a mechanism to filter these out.\n> \n> ### Details\n> \n> I'm not an expert in Tauri source code, so I can't be sure I'm on the right track here, but I assume this has to do with how the webview is bootstrapped with the Tauri APIs.\n> \n> I know there's various handlers that get set, such as opening `target=\"_blank\"` links via a shell command, and of course setting `invoke` and other such APIs. Sounds like the issue is somewhere there and the APIs are being injected where they shouldn't.\n> \n> Technically it seems that an attacker couldn't actually receive a response from the command it executes. Tauri IPC can't route the response back to the invoking iframe, but the action is still executed, with the response just being dropped. You see these messages in the logs:\n> \n> ```\n> [Warning] [TAURI] Couldn't find callback id 3399436348 in window. This happens when the app is reloaded while Rust is running an asynchronous operation.\n> ```\n> \n> ### PoC\n> \n> Repository with reproduction steps: https://github.com/begleynk/tauri-sandbox-iframe-escape-poc\n> \n> Building on that POC, here is a video of a Codepen iframe running inside an isolation mode Tauri app, invoking the same \"Greet\" command the frontend is invoking.\n> \n> https://github.com/tauri-apps/tauri/assets/1065208/8efd5f9d-3116-4068-b98b-6ace7de9261c\n> \n> This is done with the following code running inside Codepen:\n> \n> ```javascript\n> window.__TAURI_INVOKE__(\"greet\", { name: \"From CodePen\" })\n> ```\n> \n> ### Impact\n> \n> Valid commands with potentially unwanted consequences (\"delete project\", \"transfer credits\", etc.) could be invoked by an attacker that controls the content of an iframe running inside a Tauri app.\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:H/I:L/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "tauri"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.6.7"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "tauri"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0-beta.0"
      }, {
        "fixed" : "2.0.0-beta.20"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/tauri-apps/tauri/security/advisories/GHSA-57fm-592m-34r7"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-35222"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/tauri-apps/tauri/issues/8316"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/tauri-apps/tauri/commit/d950ac1239817d17324c035e5c4769ee71fc197d"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/tauri-apps/tauri/commit/f6d81dfe0871e0ccd012e5190d41e3767e733608"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/tauri-apps/tauri"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-284" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-05-23T14:11:24Z",
    "nvd_published_at" : "2024-05-23T14:15:09Z"
  }
}