Cloudanix VulnDB

CVE-2024-47532

None

CVSS

—

EPSS

0.7%

Published

Sep 30, 2024

CISA due date

—

Cloudanix analysis

Monitor only SSVC: Track

A tool that safely runs untrusted code has a loophole that could let attackers see information they are not supposed to access.

Exploitation
Remote Unauthenticated
Attacker needs
Low Privilege
Complexity
Low
Impact
Data Exposure
Component
Library
Class
Information Disclosure
Remediation
Upgrade
Effort
Medium
Patch risk
Low

What it actually does

The flaw permits indirect access to protected objects and sensitive data by leveraging the .obj attribute on AttributeError exceptions combined with functions from the string module within the restricted execution environment.

Why it matters to the business

Applications relying on RestrictedPython to sandbox untrusted code face risk of unauthorized information disclosure, which can expose internal state or secrets and undermine the security model of code-execution features.

How an attack unfolds

An attacker supplies crafted Python code to the restricted environment that deliberately triggers an AttributeError; the resulting exception object exposes its .obj attribute, and string module utilities are then used to inspect or extract otherwise protected attributes and data.

How to fix it

Upgrade zopefoundation/restrictedpython to the commit dc6c38f4da03c25683d90ab239a16dbae9d47b70. If the string module is not required, remove it from RestrictedPython.Utilities.utility_builtins as a temporary workaround.

How to confirm the fix worked

Confirm the patched commit is present in the deployed package; execute test code that attempts to reach protected objects via AttributeError.obj and verify access is denied.

Typical attack path

  1. Submit malicious code to the RestrictedPython sandbox
  2. Trigger an AttributeError on a protected object
  3. Access the exposed .obj attribute on the exception
  4. Use string module helpers to traverse and read internal data
  5. Exfiltrate the disclosed information

How to detect it

Inspect application logs and audit trails for restricted-code execution that references AttributeError combined with string module access or repeated attribute introspection patterns.

What your security team should do

  • Apply the fixed commit dc6c38f4da03c25683d90ab239a16dbae9d47b70 without delay
  • Audit all uses of utility_builtins and restrict string module exposure where possible
  • Review dependent projects for similar sandboxing patterns

The record

RestrictedPython is a restricted execution environment for Python to run untrusted code. A user can gain access to protected (and potentially sensible) information indirectly via AttributeError.obj and the string module. The problem will be fixed in version 7.3. As a workaround, If the application does not require access to the module string, it can remove it from RestrictedPython.Utilities.utility_builtins or otherwise do not make it available in the restricted execution environment.

Affected packages

Ecosystem Package Introduced Fixed
PyPI restrictedpython 0 d701cc36cccac36b21fa200f1f2d1945a9a215e6
PyPI restrictedpython 0 7.3
Debian:11 restrictedpython 0 No fix
Debian:12 restrictedpython 0 No fix
Debian:13 restrictedpython 0 No fix
Ubuntu:20.04:LTS restrictedpython 0 No fix
Ubuntu:22.04:LTS restrictedpython 0 No fix
Ubuntu:24.04:LTS restrictedpython 0 No fix
Ubuntu:24.10 restrictedpython 0 No fix
Ubuntu:Pro:16.04:LTS restrictedpython 0 No fix
Ubuntu:Pro:18.04:LTS restrictedpython 0 No fix
Ubuntu:Pro:20.04:LTS restrictedpython 0 4.0~b3-2ubuntu0.1~esm1
Ubuntu:Pro:22.04:LTS restrictedpython 0 4.0~b3-3ubuntu0.1~esm1
Ubuntu:Pro:24.04:LTS restrictedpython 0 6.2-1ubuntu0.24.04.1~esm1