CVE-2022-36126
Ignition < 7.9.20 and 8.x < 8.1.17, RCE via ScriptInvoke
- CVSS 7.2
- CWE-863 Incorrect Authorization
- Input Validation and Sanitization
- Remote
An issue was discovered in Inductive Automation Ignition before 7.9.20 and 8.x before 8.1.17. The ScriptInvoke function allows remote attackers to execute arbitrary code by supplying a Python script.
- CVSS base score
- 7.2
- Published
- 2022-07-16
- OWASP
- A03 Injection
- Orthogonal defect classification
- Function
- Code defect classification
- Incorrect Functionality
- Category
- Input Validation and Sanitization
- Subcategory
- Command Injection
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- Ignition
- Fixed by upgrading
- Yes
Solution
Update Ignition to version 7.9.20 or 8.x to version 8.1.17 or higher.
Vulnerable code sample
def unsafe_script_invoke(script):
# Directly executing user-supplied script
exec(script)
# Example usage
user_input_script = "__import__('os').system('ls')" # Arbitrary code execution
unsafe_script_invoke(user_input_script)Patched code sample
import ast
import logging
def safe_script_invoke(script):
# Use ast.literal_eval to safely evaluate expressions
try:
# Only allow safe expressions
safe_code = ast.literal_eval(script)
# Execute only if it's a safe expression
return safe_code
except (ValueError, SyntaxError) as e:
logging.error(f"Invalid script: {e}")
return None
# Example usage
user_input_script = "1 + 2" # This should be a safe input
result = safe_script_invoke(user_input_script)
if result is not None:
print(f"Result: {result}")
else:
print("Execution failed due to unsafe script.")Cite this entry
@misc{vaitp:cve202236126,
title = {{Ignition < 7.9.20 and 8.x < 8.1.17, RCE via ScriptInvoke}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2022},
note = {VAITP Python Vulnerability Dataset, entry CVE-2022-36126},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2022-36126/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
