CVE-2025-31477
Executive Summary
CVE-2025-31477 is a critical vulnerability in the Tauri shell plugin (versions prior to 2.2.1) that allows an attacker to bypass protocol restrictions on the open endpoint. The plugin is designed to open files and URLs using the system’s default handler (e.g., xdg-open on Linux). Due to improper validation of allowed protocols, dangerous schemes like file://, smb://, and nfs:// can be passed to the system opener, leading to remote code execution (RCE) when untrusted user input is processed. This vulnerability requires either direct exposure of the endpoint to users or code execution in the frontend of a Tauri application.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
This vulnerability affects the Tauri shell plugin, which is distributed via npm (@tauri-apps/plugin-shell) and Cargo (tauri-plugin-shell). Applications that use this plugin and expose the open endpoint to untrusted input are at risk. The supply chain risk is moderate, as the plugin is a core component of many Tauri applications.
CVSS Breakdown & Threat Level
- CVSS Score: 9.6 (Critical)
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
- Attack Vector: Network
- Attack Complexity: Low
- Privileges Required: None
- User Interaction: Required (user must click a link or trigger the open endpoint)
- Scope: Unchanged
- Confidentiality Impact: High
- Integrity Impact: High
- Availability Impact: High
Threat Level: Critical. Exploitation can lead to full system compromise.
Deep Dive & Mechanics
The Tauri shell plugin provides an open endpoint that is intended to open files or URLs with the system’s default handler. The plugin maintains a list of allowed protocols (e.g., https, mailto) to prevent abuse. However, the validation logic in versions prior to 2.2.1 is flawed.
Vulnerable Code (simplified):
// Vulnerable validation
function isAllowedProtocol(url) {
const allowed = ['https:', 'mailto:', 'http:'];
return allowed.some(protocol => url.startsWith(protocol));
}
This check only verifies that the URL starts with an allowed protocol, but does not ensure that the protocol is exactly one of the allowed ones. For example, file:// is not in the list, but a URL like https://evil.com would pass. However, the real issue is that the validation does not properly reject dangerous protocols when they are passed directly. The fix in 2.2.1 ensures that only exact protocol matches are allowed.
Attack Scenario:
- An attacker crafts a URL with a dangerous protocol, e.g.,
file:///etc/passwdorsmb://attacker/share. - The attacker tricks a user into clicking a link that triggers the
openendpoint with this URL. - The system’s default handler (e.g.,
xdg-open) processes the URL, potentially executing code or exposing sensitive files.
Vulnerable vs. Patched Code
Vulnerable (pre-2.2.1):
// Rust implementation (simplified)
fn is_allowed_protocol(url: &str) -> bool {
let allowed = ["https:", "mailto:", "http:"];
allowed.iter().any(|&p| url.starts_with(p))
}
This allows file:// because it does not check that the protocol is exactly one of the allowed ones.
Patched (2.2.1):
fn is_allowed_protocol(url: &str) -> bool {
let allowed = ["https:", "mailto:", "http:"];
if let Some(pos) = url.find(':') {
let protocol = &url[..=pos];
allowed.contains(&protocol)
} else {
false
}
}
This extracts the protocol part and checks for an exact match.
Exploitation & Lab Setup
Red Team
Prerequisites:
- A Tauri application using shell plugin < 2.2.1.
- The application exposes the
openendpoint to user input (e.g., via a webview).
Exploit Steps:
- Identify the
openendpoint in the Tauri application (e.g.,window.__TAURI__.shell.open). - Craft a malicious URL:
file:///etc/passwdorsmb://attacker/share. - Execute the exploit via JavaScript in the frontend:
// Exploit code window.__TAURI__.shell.open('file:///etc/passwd'); - On Linux,
xdg-openwill open the file in the default text editor, exposing sensitive data. On Windows,file://may execute a script if associated with an executable.
Advanced Exploit:
- Use
smb://to force the system to connect to an attacker-controlled SMB share, potentially leaking NTLM hashes. - Use
nfs://to mount a remote filesystem.
Blue Team
Detection:
- Monitor for unusual
xdg-openoropencommand invocations withfile://,smb://, ornfs://protocols. - Log all calls to the Tauri shell plugin’s
openendpoint.
Hunting:
- Search for Tauri applications that use shell plugin version < 2.2.1.
- Check application logs for URLs containing dangerous protocols.
Lab Setup:
- Use a Tauri application with shell plugin 2.2.0.
- Create a simple webview that calls
window.__TAURI__.shell.openwith a test URL. - Monitor system logs for the open command.
Indicators of Compromise (IOCs)
- Network: Outbound connections to SMB shares (port 445) or NFS (port 2049) initiated by the Tauri application.
- File System: Unexpected file reads via
file://protocol. - Process:
xdg-openoropencommands with arguments containingfile://,smb://, ornfs://. - Logs: Application logs showing calls to
shell.openwith dangerous protocols.
Detection Engineering
YARA Rule
rule CVE_2025_31477_Tauri_Shell_Open {
meta:
description = "Detects Tauri shell plugin open calls with dangerous protocols"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-31477"
strings:
$dangerous_protocols = /(file|smb|nfs|ftp):\/\// nocase
$tauri_open = "shell.open" nocase
condition:
$tauri_open and $dangerous_protocols
}
Sigma Rule
title: CVE-2025-31477 Tauri Shell Plugin Dangerous Protocol
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects Tauri shell plugin open calls with dangerous protocols
author: Valters IT
date: 2025-04-10
logsource:
category: application
product: tauri
detection:
selection:
EventID: 1001 # Example event ID for Tauri plugin calls
Data|contains:
- 'file://'
- 'smb://'
- 'nfs://'
- 'ftp://'
condition: selection
falsepositives:
- Legitimate use of file:// for local files (rare)
level: high
Suricata Rule
alert tcp any any -> any any (msg:"CVE-2025-31477 Tauri Shell Plugin Dangerous Protocol"; content:"shell.open"; nocase; pcre:"/(file|smb|nfs|ftp):\/\//"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate:
- Update the Tauri shell plugin to version 2.2.1 or later.
- If immediate update is not possible, disable the
openendpoint or restrict it to a whitelist of safe protocols.
Long-term:
- Implement input validation for all user-supplied URLs.
- Use a strict allowlist of protocols (e.g., only
https:andmailto:). - Monitor for unusual system calls from the Tauri application.
Patch Details:
- Upgrade to
@tauri-apps/plugin-shell@2.2.1(npm) ortauri-plugin-shell 2.2.1(Cargo).
Valters IT Signature: This report was generated by Valters IT DevSecOps AI. For questions, contact security@valters.it.