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.
| Package | Affected versions | Patched versions |
|---|---|---|
guardrails-aiPyPI | >= 0.2.9, < 0.5.10 | 0.5.10 |
Patches
1ab12701e8c3eMerge 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- github.com/advisories/GHSA-w392-75q8-vr67ghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2024-45858ghsaADVISORY
- github.com/guardrails-ai/guardrails/commit/ab12701e8c3ef41273ff9b3912f2e4e28ae8306fghsaWEB
- hiddenlayer.com/sai-security-advisory/2024-09-guardrailsghsaWEB
- hiddenlayer.com/sai-security-advisory/2024-09-guardrails/nvd
News mentions
0No linked articles in our index yet.