python-statemachine
CVE-2026-100415 · GHSA-v3qq-3xvg-m77g
Restricted-evaluator write-side dunder traversal
Critical, 9.1 · Public source snapshot: November 12, 2026
Original portfolio report · Public advisory
Shared credits and the scope of my investigation are documented below.
CVE-2026-100415 · GHSA-v3qq-3xvg-m77g · python-statemachine · Critical
Public security research by Charles Vosburgh (
the-vibe-dev). The public advisory credits multiple reporters; this write-up preserves that shared attribution.
| Field | Value |
|---|---|
| Package | python-statemachine |
| CVE | CVE-2026-100415 |
| Ecosystem | PyPI / Python |
| Severity | Critical |
| CVSS | 9.1 — CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H |
| Affected | >= 3.2.0, < 3.2.1 |
| Fixed | 3.2.1 |
| Weakness | CWE-915 / CWE-913 — improperly controlled modification of dynamically managed attributes |
| Public PoC | Yes |
| Credit | the-vibe-dev / Charles Vosburgh is one of the public reporters |
python-statemachine 3.2.0 introduced a declarative IO layer capable of loading SCXML, JSON, and YAML statecharts with a restricted evaluator enabled by default through trusted=False. The read-side evaluator correctly rejected _-prefixed attribute traversal such as __class__, but the write-side implementation used by SCXML <assign location> did not apply the same policy to intermediate destination segments.
A document-controlled location such as:
__class__.__init__
could therefore traverse from the machine's model instance to the shared Model class and replace an existing class attribute with a value produced by the restricted evaluator.
The public advisory demonstrates process-wide integrity and availability impact. Modifying Model.__name__ changes shared class state, while replacing Model.__init__ with a non-callable value causes future model construction to fail.
This finding should not be inflated into arbitrary Python code execution. The demonstrated restricted-evaluator primitive writes data values; the public advisory's validated impact is shared-state corruption and denial of service.
Security invariant: Every path segment traversed during a restricted write must satisfy the same attribute policy as a restricted read, including intermediate objects and facade aliases.
The restricted evaluator in 3.2.0 blocks private/dunder reads. A representative read-side rule is:
case ast.Attribute(attr=attr) if allow_value_nodes:
if attr.startswith("_"):
raise ValueError(f"Attribute access to '{attr}' is not allowed")
return build_attribute(recurse(node.value), attr)
That creates a clear security expectation: untrusted statechart data should be able to work with ordinary model fields, but not walk into Python runtime internals such as classes, interpreter objects, engines, or other shared implementation state.
The write path did not preserve that rule. In 3.2.0, the assignment action split the document-controlled location on dots and followed every intermediate path element with raw getattr():
*path, attr = self.action.location.split(".")
obj = machine.model
for p in path:
obj = getattr(obj, p)
if not attr.isidentifier() or not (hasattr(obj, attr) or attr in kwargs):
raise ValueError(...)
if attr in protected_attrs:
raise ValueError(...)
setattr(obj, attr, value)
Only the final attribute name is checked. The dangerous __class__ component is intermediate, so it reaches the shared class before the final-name checks execute.
For the public __class__.__init__ example, the effective sequence is:
objstarts as the current model instance.getattr(obj, "__class__")returns the shared model class.__init__is a valid identifier and already exists.- The restricted evaluator supplies a data value.
setattr(Model, "__init__", value)modifies the shared class.- Later model construction uses the corrupted class attribute and fails.
A second public integrity demonstration targets __class__.__name__. Changing the class name through one loaded machine is visible through other references to the same Model class, confirming that the write crossed the per-machine model boundary into process-shared state.
Read policy and write policy were implemented separately. The evaluator enforced a strong rule for reading attribute paths, but <assign location> treated intermediate path components as ordinary Python object traversal and protected only the final name.
That asymmetry is dangerous because a destination path is just as expressive as a read path. If an attacker can walk through a protected intermediate object during assignment, checking only the final field does not preserve the original confinement model.
A follow-on variant hardened under the same advisory family involved facade/system aliases that could expose another route into protected runtime objects. It is documented as a distinct hardening case rather than presented as a separate RCE claim.
flowchart TD
A[Application loads attacker-controlled statechart with trusted=False]
B[SCXML assign contains a dotted location]
C[Write path follows intermediate segments with raw getattr]
D[Dunder segment reaches shared runtime/class object]
E[Final setattr writes evaluator-produced data to shared object]
F[Process-wide integrity corruption or future construction failure]
A --> B --> C --> D --> E --> F
The base PoC is public in GHSA-v3qq-3xvg-m77g and is not duplicated as a separate artifact in this repository.
The public advisory uses safe, observable state changes rather than attacker-defined executable Python. Useful controls include:
- attempting the analogous dunder path as a restricted read, which is denied;
- writing a normal public model attribute, which remains allowed;
- writing through
__class__, which succeeds in 3.2.0; - observing that class-level state changes are visible process-wide;
- confirming 3.2.1 rejects the original path and the adjacent alias variants covered by upstream tests.
Twenty-eight focused upstream regression tests were run against the fixed release during review. The destructive base trigger was not rerun merely for publication packaging.
The demonstrated capability is unauthorized mutation of shared Python class/runtime state from a document that is supposed to be restricted.
Concrete public outcomes include:
- changing shared class metadata; and
- replacing
Model.__init__with a non-callable data value, causing subsequent model construction to raiseTypeError.
That supports high integrity and availability impact. The public advisory rates the issue Critical, CVSS 9.1.
No confidentiality impact is claimed for this specific advisory, and the write-side primitive should not be described as arbitrary code execution without separate evidence of attacker-controlled callable construction.
The affected surface was introduced with the generalized IO layer in commit:
9492f3f7d543da52368fe2e1416ba7f0f0d67730
and first shipped in 3.2.0.
The fixing commit is:
f7159a8549c5c26de0babb7b67c882804037a24e
released in 3.2.1.
The public package range is therefore:
>= 3.2.0, < 3.2.1
The public v3.2.0 and v3.2.1 tags and corresponding PyPI source distributions were inspected, and the security-relevant source matched.
Upgrade to python-statemachine 3.2.1 or later.
Restricted write paths should validate every traversed segment before calling getattr() or setattr(). The same private/dunder restrictions used for reads should apply to destinations, aliases, wrappers, and facade objects.
Regression coverage should include:
- private/dunder names as the first segment;
- private/dunder names in the middle of a path;
- protected names as the final segment;
- facade aliases that resolve to runtime objects;
- allowed public nested writes;
- assertions that failed assignments leave shared classes unchanged.
| Date | Event |
|---|---|
| 2026-06-17 | python-statemachine 3.2.0 published with the new IO layer. |
| 2026-08-01 | 3.2.1 and GHSA-v3qq-3xvg-m77g published. |
| 2026-08-26 | Public tags, PyPI artifacts, fix, and regression coverage reviewed. |
GHSA-v3qq-3xvg-m77g is a write-side policy bypass in python-statemachine's restricted declarative loader. The library correctly recognized that untrusted documents must not read Python internals, but the assignment implementation allowed the same protected objects to be reached as intermediate write destinations.
The fix in 3.2.1 aligns write traversal with the intended restricted-evaluation boundary and adds regression coverage for the original route and adjacent aliases.
Broader lesson: A sandboxed data model needs symmetric read and write confinement. Protecting sensitive objects from lookup is insufficient if destination traversal can still reach and mutate them.
- https://github.com/fgmacedo/python-statemachine/security/advisories/GHSA-v3qq-3xvg-m77g
The public advisory credits multiple reporters, including me (the-vibe-dev). This write-up does not claim sole discovery.
Research was AI-assisted for source mapping, hypothesis generation, release comparison, and evidence organization. I performed the final validation, disclosure coordination, severity calibration, and publication review.
This write-up documents a publicly disclosed vulnerability for defensive research, remediation, regression testing, and authorized assessment. Do not use technical details against systems without explicit permission.