{"id":713,"cve":"CVE-2021-42561","cve_url":"https:\/\/www.cvedetails.com\/cve\/CVE-2021-42561","cwe":"CWE-74 Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')","cwe_number":74,"cwe_url":"https:\/\/cwe.mitre.org\/data\/definitions\/74","cvss_score":8.8,"published":"2022-01-12","owasp":"A03 Injection","odc":"Function","cdc":"Incorrect Functionality","category":"Input Validation and Sanitization","subcategory":"Command Injection","scope":"Remote","impact":"Arbitrary Code Execution","summary":"CALDERA 2.8.1 Human plugin allows shell command injection via unsanitized \"name\" parameter","permalink":"https:\/\/netpack.pt\/vaitp\/vulnerability\/CVE-2021-42561\/","description":"An issue was discovered in CALDERA 2.8.1. When activated, the Human plugin passes the unsanitized name parameter to a python \"os.system\" function. This allows attackers to use shell metacharacters (e.g., backticks \"``\" or dollar parenthesis \"$()\" ) in order to escape the current command and execute arbitrary shell commands.","solution":"Update CALDERA to version 2.8.2 or higher.","affected_component":"os","fixed_by_upgrading":true,"vulnerable_code":"import os\n\ndef execute_command(name):\n    \"\"\"Vulnerable function that demonstrates the security issue.\"\"\"\n    command = f\"echo {name}\"\n    os.system(command)\n\nuser_input = \"user_input; ls\"\nexecute_command(user_input)","patched_code":"import shlex\nimport subprocess\n\ndef execute_command(name):\n    \"\"\"Secure function that fixes the vulnerability.\"\"\"\n    modified_name = shlex.quote(name)\n    command = f\"echo {modified_name}\"\n    subprocess.run(command, shell=True, check=True)\n\nuser_input = \"user_input; ls\"\nexecute_command(user_input)","payload_needed":false,"payload":null,"payload_status":"none","published_fix":[],"references":null}