CVE-2026-31040 stata-mcp has insufficient validation of user-supplied Stata do-file content that can lead to command execution

Critical 9.8 Published Updated

Attackers can execute arbitrary commands via insufficient validation of Stata do-file content in the stata-mcp library.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2026-31040?

CVE-2026-31040 is a critical code injection vulnerability in n/a, published on 8 Apr 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

A vulnerability was identified in stata-mcp prior to v1.13.0 where insufficient validation of user-supplied Stata do-file content can lead to command execution.

Weakness: CWE-94

Which versions are affected by CVE-2026-31040?

3 open source packages ship an affected version, including stata-mcp. It affects 1 product.

PackageAffectedFixed in
stata-mcp PyPIAll versions1.13.0
stata-mcp PyPIAll versions1.13.0
stata-mcp PyPIAll versions1.13.0

Products include Statamcp Stata-Mcp.

How do I fix CVE-2026-31040?

Upgrade stata-mcp to 1.13.0 or later.

Upgrade, and never evaluate templates, expressions or code built from user input. More about Code injection.

Is CVE-2026-31040 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-31040 exists.

Sources

Also known as GHSA-jpcj-7wfg-mqxv, PYSEC-2026-3076.

Is CVE-2026-31040 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free