Advisory

PYSEC-2026-3807

Details, part 2 of 2. The advisory

Details

Note: Option B also fixes a secondary bug on the same line — ' '.join(out.args) crashes
with TypeError when args contain non-strings (e.g., raise SystemExit(0) with integer
code). The fix uses str(a) for a in out.args.

Option C — Catch `BaseException` in `run()` and `eval()` (broadest, requires care):

except BaseException as exc:
    if isinstance(exc, (SystemExit, KeyboardInterrupt, GeneratorExit)):
        # Re-raise as RuntimeError to contain within sandbox
        self.raise_exception(node, exc=RuntimeError,
                             msg=f"{type(exc).__name__} raised in sandbox")
    elif with_raise and self.expr is not None:
        self.raise_exception(node, expr=self.expr)

Option A is the simplest and least likely to introduce regressions. Option B additionally
addresses the str.join crash on integer args.

---

Disclosure Timeline

| Date | Event |
|------|-------|
| 2026-06-09 | Vulnerability discovered during code review |
| 2026-06-09 | Report submitted via GitHub Security Advisory |
| TBD | Maintainer acknowledgment |
| TBD + 90 days | Public disclosure deadline |

---

Researcher

Independent security researcher. No bug bounty program exists for this project.
CVE assignment requested via GitHub Security Advisory submission.

---

References

  • Prior CVE: CVE-2025-24359 (format string injection, fixed 1.0.6)
  • Prior advisory: GHSA-vp47-9734-prjw (AST mutation TOCTOU, fixed 1.0.6)
  • Python exception hierarchy: https://docs.python.org/3/library/exceptions.html#exception-hierarchy
  • asteval documentation: https://lmfit.github.io/asteval/

Sources & licences