VYPR
High severity7.8NVD Advisory· Published Sep 18, 2024· Updated Apr 15, 2026

CVE-2024-45858

CVE-2024-45858

Description

An arbitrary code execution vulnerability exists in versions 0.2.9 up to 0.5.10 of the Guardrails AI Guardrails framework because of the way it validates XML files. If a victim user loads a maliciously crafted XML file containing Python code, the code will be passed to an eval function, causing it to execute on the user's machine.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
guardrails-aiPyPI
>= 0.2.9, < 0.5.100.5.10

Patches

1
ab12701e8c3e

Merge pull request #1073 from guardrails-ai/eval-fix

2 files changed · +4 3
  • guardrails/utils/validator_utils.py+2 1 modified
    @@ -1,6 +1,7 @@
     # ruff: noqa
     """This module contains the constants and utils used by the validator.py."""
     
    +from ast import literal_eval
     from typing import Any, Dict, List, Optional, Tuple, Type, Union, cast
     
     from guardrails_api_client import ValidatorReference
    @@ -33,7 +34,7 @@ def parse_rail_arguments(arg_tokens: List[str]) -> List[Any]:
                     #   and be responsible for parsing them to the correct types.
                     # Option 2: We use something like the Validator Manifest that describes the arguments
                     #   to parse the values from the string WITHOUT an eval.
    -                t = eval(t)
    +                t = literal_eval(t)
                 except (ValueError, SyntaxError, NameError) as e:
                     raise ValueError(
                         f"Python expression `{t}` is not valid, "
    
  • tests/unit_tests/test_datatypes.py+2 2 modified
    @@ -22,7 +22,7 @@ def __init__(self, *args, **kwargs):
             ("test-validator: a", ["a"]),
             ("test-validator: a b", ["a", "b"]),
             (
    -            "test-validator: {list(range(5))} a b",
    +            "test-validator: {[0,1,2,3,4]} a b",
                 [[0, 1, 2, 3, 4], "a", "b"],
             ),
             ("test-validator: {[1, 2, 3]} a b", [[1, 2, 3], "a", "b"]),
    @@ -31,7 +31,7 @@ def __init__(self, *args, **kwargs):
                 [{"a": 1, "b": 2}, "c", "d"],
             ),
             (
    -            "test-validator: {1 + 2} {{'a': 1, 'b': 2}} c d",
    +            "test-validator: {3} {{'a': 1, 'b': 2}} c d",
                 [3, {"a": 1, "b": 2}, "c", "d"],
             ),
         ],
    

Vulnerability mechanics

Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

5

News mentions

0

No linked articles in our index yet.