CVE-2025-34075: Vagrant HashiCorp Vagrant Has Code Injection Vulnerability
MODERATECVE-2025-34075 is a MODERATE hashicorp vagrant has code injection vulnerability (CWE-668: Exposure of Resource to Wrong Sphere) affecting Vagrant libraries in the RubyGems ecosystem. The issue involves hashicorp vagrant has code injection vulnerability through default synced folders. Remediation is available by upgrading affected packages to version 2.4.7.
CVE-2025-34075 at a Glance
How to Fix CVE-2025-34075
To remediate this vulnerability, upgrade all affected Vagrant dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade vagrant to 2.4.7
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for vagrant
How to Check if You Are Affected
To determine whether your application is affected by CVE-2025-34075, inspect your project dependencies for Vagrant:
inspect dependencies for vagrant
Analyze the terminal output to locate any version of Vagrant in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.4.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-668: Exposure of Resource to Wrong Sphere, where the product exposes a resource to the wrong control sphere, providing unintended actors with inappropriate access to the resource. In Vagrant, 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
CVE-2025-34075 Affected Vagrant Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
vagrant
|
RubyGems |
≥ 2.2.10
< 2.4.7
|
2.4.7
|
References
Frequently Asked Questions
What is CVE-2025-34075?
Which Vagrant versions are affected?
What version fixes CVE-2025-34075?
Is vagrant affected?
What CWE is associated with CVE-2025-34075?
How can I check RubyGems dependencies for CVE-2025-34075?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-hqp6-mjw3-f586",
"modified" : "2025-07-05T01:47:56Z",
"published" : "2025-07-02T21:32:00Z",
"aliases" : [ "CVE-2025-34075" ],
"summary" : "HashiCorp Vagrant has code injection vulnerability through default synced folders",
"details" : "An authenticated virtual machine escape vulnerability exists in HashiCorp Vagrant versions 2.4.6 and below when using the default synced folder configuration. By design, Vagrant automatically mounts the host system’s project directory into the guest VM under /vagrant (or C:\\vagrant on Windows). This includes the Vagrantfile configuration file, which is a Ruby script evaluated by the host every time a vagrant command is executed in the project directory. If a low-privileged attacker obtains shell access to the guest VM, they can append arbitrary Ruby code to the mounted Vagrantfile. When a user on the host later runs any vagrant command, the injected code is executed on the host with that user’s privileges.\n\nWhile this shared-folder behavior is well-documented by Vagrant, the security implications of Vagrantfile execution from guest-writable storage are not explicitly addressed. This effectively enables guest-to-host code execution in multi-tenant or adversarial VM scenarios.",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "RubyGems",
"name" : "vagrant"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.2.10"
}, {
"fixed" : "2.4.7"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-34075"
}, {
"type" : "WEB",
"url" : "https://github.com/hashicorp/vagrant/issues/13688"
}, {
"type" : "WEB",
"url" : "https://github.com/hashicorp/vagrant/commit/abe87b2fdc124ef426c016d44d2f6f4792f0cbe3"
}, {
"type" : "WEB",
"url" : "https://developer.hashicorp.com/vagrant"
}, {
"type" : "WEB",
"url" : "https://developer.hashicorp.com/vagrant/docs/synced-folders/basic_usage"
}, {
"type" : "WEB",
"url" : "https://developer.hashicorp.com/vagrant/docs/vagrantfile"
}, {
"type" : "ADVISORY",
"url" : "https://github.com/advisories/GHSA-hqp6-mjw3-f586"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/hashicorp/vagrant"
}, {
"type" : "WEB",
"url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/vagrant/CVE-2025-34075.yml"
}, {
"type" : "WEB",
"url" : "https://raw.githubusercontent.com/rapid7/metasploit-framework/master/modules/exploits/multi/local/vagrant_synced_folder_vagrantfile_breakout.rb"
}, {
"type" : "WEB",
"url" : "https://vulncheck.com/advisories/hashicorp-vagrant-synced-folder-vagrantfile-breakout"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-276", "CWE-668", "CWE-94" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2025-07-03T12:59:35Z",
"nvd_published_at" : "2025-07-02T20:15:29Z"
}
}