eval() call detected
High
- Category
- Dangerous Code Execution
- Content
def calculator(self, expression: str): """计算数学表达式""" try: result = eval(expression, {"__builtins__": {}}, {}) return f"{expression} = {result}" except Exception as e: return f"计算失败:{str(e)}"- Confidence
- 98% confidence
- Finding
- The calculator method passes user-controlled input directly into Python's eval(), which is inherently dangerous even with __builtins__ removed. Attackers may still trigger denial-of-service through expensive expressions or exploit Python object model behaviors in some environments to escape the intended sandbox, so this should not be treated as a safe math parser.
