/

CVE-2026-47103

Severity:

CRITICAL RISK

(9.8)

Eval Injection (CWE-95) in Python StateMachine SCXML

CVE-2026-47103

Modified

Vulnerability type

Category:

Eval Injection

CWE:

CWE-95, CWE-94

Impact:

Remote Code Execution

Severity:

CRITICAL RISK

(9.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Python StateMachine before version 3.2.0 unsafely evaluates SCXML <data expr="..."> attributes using Python's built-in eval() with attacker-controlled input.

A malicious SCXML document can cause arbitrary code execution in the hosting Python process whenever these expressions are processed.

Affected context

The vulnerability exists when Python StateMachine is used to process SCXML documents that may contain untrusted or partially trusted content.

It is especially relevant in systems where workflows, state machines, or automation rules are defined via SCXML uploaded by users, integrated from external services, or loaded from dynamically obtained sources.

The issue is triggered when <data expr="..."> attributes are interpreted as Python expressions and evaluated during state transitions or data updates without isolation or prior validation.

Exploit preconditions

  • Attack surface: SCXML parsing and execution interface in applications using Python StateMachine
  • Required access: Ability to supply or influence SCXML content (e.g., upload, configuration, API input, or external file inclusion)
  • Trigger point: Processing of <data expr="..."> elements where the expr attribute is evaluated
  • Why exploitation is possible: The SCXMLProcessor passes attacker-controlled expression strings through a call chain that ultimately invokes Python's eval() directly, with access to the process context and without sandboxing, whitelisting, or expression restrictions

Why this happens

This vulnerability stems from treating SCXML expression attributes as trusted Python code and evaluating them with eval() in the main interpreter context.

This pattern aligns with CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code ('Eval Injection'), where input intended as data is instead executed as code.

The SCXMLProcessor design couples user-supplied SCXML expressions directly to dynamic evaluation, lacking a safe expression language, contextual escaping, or a controlled execution environment.

Potential impact

  • Execution of arbitrary Python code within the hosting application process
  • Reading, modifying, or deleting data accessible to the application
  • Installation of backdoors or execution of arbitrary OS-level commands via Python APIs
  • Compromise of application integrity and potential pivot to other systems or services the application can reach

General mitigation guidance

Effective mitigation focuses on removing or strictly controlling dynamic code evaluation driven by SCXML content.

Common patterns include:

  • Replacing eval() with a constrained, domain-specific expression language or a safe evaluation engine that cannot execute arbitrary Python code
  • Restricting SCXML inputs to trusted sources and treating user-supplied SCXML as data, not executable logic
  • Implementing allowlisted operations and explicit mapping between SCXML expressions and predefined functions or actions
  • Running state machine processing under least-privilege principles, minimizing accessible system resources and credentials
  • Introducing configuration options that disable dynamic expression evaluation when not required

How teams detect issues like this

Detection generally relies on both code-level analysis and runtime controls:

  • Static analysis rules that flag usage of eval() and similar dynamic execution functions in SCXML processing paths
  • Code review checklists that require scrutiny whenever user-controlled strings influence code execution or expression evaluation
  • Security-focused linting or automated review tools configured to detect eval-style patterns and untrusted data flows into interpreters
  • Runtime instrumentation or logging that highlights unexpected or complex SCXML expressions, enabling anomaly detection and incident investigation

Sources

SourceLink
github.comgithub.com/SaiTeja-Erukude/CVE-2026-47103-python-statemachine-rce
github.comgithub.com/fgmacedo/python-statemachine/releases/tag/v3.2.0
github.comgithub.com/fgmacedo/python-statemachine/security/advisories/GHSA-v4jc-pm6r-3vj8
vulncheck.comvulncheck.com/advisories/python-statemachine-rce-via-scxml-eval-injection

Frequently asked

questions

Yes, if an attacker can submit or influence SCXML content over a network interface, they can potentially trigger remote code execution on the server processing that SCXML.

The attacker needs the ability to provide or modify SCXML documents processed by Python StateMachine—for example, through file upload endpoints, configuration APIs, workflow editors, or integrations that fetch SCXML from external sources.

The safest pattern is to remove direct use of eval() on SCXML expressions and replace it with a constrained expression evaluator or a whitelist-based mapping of allowed operations, ensuring SCXML content cannot become arbitrary Python code.

Avoid evaluating user-controlled strings as code, design APIs so that configuration and workflow definitions are purely declarative, enforce strict separation between data and executable logic, and include checks for dynamic execution functions in security-focused code reviews and automated tooling.

Find out what's already
exploitable in your codebase.