/

CVE-2026-34444

Severity:

CRITICAL RISK

(10.0)

Improper Access Control / Sandbox Escape in Lupa Lua/LuaJIT

CVE-2026-34444

Modified

Vulnerability type

Category:

Improper Access Control / Sandbox Escape

CWE:

CWE-284, CWE-639, CWE-914

Impact:

Arbitrary Code Execution / Sandbox Escape

Severity:

CRITICAL RISK

(10.0)

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

Lupa's integration of Lua/LuaJIT with CPython contains an inconsistent attribute filtering flaw that fails to enforce restrictions when attributes are accessed via built-in functions such as getattr and setattr.

An attacker who can run Lua code through Lupa can bypass the intended attribute_filter protections and ultimately execute arbitrary Python code.

Affected context

This vulnerability affects applications that embed Lua or LuaJIT through Lupa (version 2.6 and earlier) and rely on attribute_filter or similar mechanisms to sandbox or restrict access to Python objects.

It is particularly relevant where:

  • Untrusted or semi-trusted Lua scripts are executed via Lupa
  • Security or multi-tenant isolation depends on attribute-based access restrictions
  • Python objects exposed to Lua are assumed to be protected by attribute_filter from dangerous attributes and methods

In such contexts, the inconsistency between direct attribute access and built-in function access invalidates the security model.

Exploit preconditions

  • Attack surface: Lupa's Lua/LuaJIT execution environment embedded inside a Python application.
  • Required access: Ability to execute Lua code (or influence Lua scripts) within the Lupa environment; this may be via user-supplied scripts, plugins, configuration, or any extensibility mechanism that passes code into Lupa.
  • Trigger point: Use of Python built-ins such as getattr/setattr (or equivalent attribute access paths) from within the Lua environment to reach attributes that should have been filtered.
  • Why exploitation is possible: The attribute_filter mechanism is not consistently enforced across all attribute access paths; built-in function–based attribute operations bypass the restriction logic, giving Lua code access to sensitive Python attributes and objects that can be chained to arbitrary code execution.

Why this happens

At its core, this issue is an improper access control problem in a language binding layer.

Lupa provides attribute_filter to selectively restrict which Python attributes are visible to Lua, but the enforcement is incomplete: it is applied to some attribute access paths while others (notably those using Python built-ins like getattr/setattr) are left unguarded.

This fragmented policy means the security boundary is only partly enforced, so code operating through alternative attribute access mechanisms can escape the intended sandbox.

Conceptually, this maps to:

  • CWE-284 (Improper Access Control): The system fails to enforce access restrictions consistently, allowing bypass of attribute filtering.
  • CWE-639 (Authorization Bypass Through User-Controlled Key): A script can reference attributes/objects via controllable names or keys in ways that skip normal authorization checks.

The insecure pattern is relying on attribute-level filtering without ensuring that every code path that can reach those attributes passes through the same authorization logic.

Potential impact

  • Bypass of attribute_filter-based restrictions on Python objects exposed to Lua
  • Escape from a presumed "sandboxed" Lua environment into the host Python runtime
  • Execution of arbitrary Python code with the privileges of the embedding application
  • Unauthorized access to sensitive data, configuration, or secrets available to the Python process
  • Lateral movement inside the application context, potentially leading to full system compromise depending on deployment privileges

General mitigation guidance

Effective mitigation focuses on establishing consistent, centralized enforcement of attribute access controls and reducing trust in embedded scripting environments:

  • Ensure that any attribute filtering or sandboxing logic is applied uniformly to all attribute access paths (direct attribute access, getattr/setattr, reflection helpers, proxy objects, etc.).
  • Prefer whitelisting of safe attributes and objects instead of blacklisting known-dangerous ones, to limit exposure if new attributes or helper APIs are introduced.
  • Isolate embedded Lua/LuaJIT runtimes from high-privilege Python objects; expose only minimal, well-audited interfaces explicitly designed for untrusted scripts.
  • Apply least privilege to the host Python process and its environment so that, even if the embedded scripting layer is abused, the blast radius is reduced (e.g., limited filesystem and network access, reduced OS-level permissions).
  • Consider external process isolation (e.g., running untrusted scripts in separate sandboxed processes or containers) rather than relying solely on in-process attribute filtering for security boundaries.

These patterns help ensure that a scripting sandbox cannot be circumvented by alternate access mechanisms.

How teams detect issues like this

Detection should aim at identifying inconsistent access control enforcement around attribute filtering:

  • Static analysis and code search:
  • Look for direct calls to getattr, setattr, or similar reflection utilities in code that interacts with Lupa-exposed objects, especially where no centralized access control wrapper is used.
  • Identify multiple code paths for attribute resolution in the binding layer and verify that all pass through the same filtering policy.
  • Code review signals:
  • Reliance on attribute_filter or similar constructs as a primary security control for untrusted Lua code, without accompanying design documentation on how all attribute access routes are covered.
  • Usage of dynamic attribute names derived from user or script input to access Python objects.
  • Policy and testing:
  • Introduce security tests or fuzzing that execute untrusted Lua scripts attempting to reach restricted attributes through various Python APIs.
  • Incorporate automated checks (e.g., SAST tools or custom linters) into CI to flag risky patterns like exposing powerful Python objects (files, subprocess, OS interfaces) directly to Lua without an explicit wrapper.

These approaches can reveal similar sandbox-escape vectors before deployment.

Sources

SourceLink
github.comgithub.com/scoder/lupa/security/advisories/GHSA-69v7-xpr6-6gjm
access.redhat.comaccess.redhat.com/errata/RHSA-2026:22993
access.redhat.comaccess.redhat.com/security/cve/CVE-2026-34444
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2455413
security.access.redhat.comsecurity.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-34444.json

Frequently asked

questions

It can be, if a remote user can supply or influence Lua code executed through Lupa (for example, through a web API, plugin system, or configuration-driven scripting). In purely local or fully trusted scripting scenarios, the risk is reduced but not entirely eliminated if trust boundaries are unclear.

The attacker needs the capability to run or control Lua scripts inside the Lupa-embedded environment. This may be direct script upload, editable configuration that is evaluated as Lua, or any mechanism that lets untrusted parties contribute code.

The most robust pattern is to centralize attribute access mediation and ensure every path to Python attributes (including built-ins and reflection mechanisms) passes through the same whitelist-based policy. Where possible, move untrusted code execution into a separate, OS-level sandbox or process and expose a narrow IPC-based API instead of raw object graphs.

When designing language bindings or sandboxes, treat them as security boundaries from the outset: define clear trust assumptions, enforce least privilege, avoid exposing powerful primitives, and validate that all attribute and method resolution paths are covered by the same authorization checks. Security-focused code reviews, threat modeling for embedded interpreters, and automated scanning for reflection and dynamic access patterns help catch these flaws early.

Find out what's already
exploitable in your codebase.