{"id":454,"cve":"CVE-2014-8165","cve_url":"https:\/\/www.cvedetails.com\/cve\/CVE-2014-8165","cwe":"CWE-345 Insufficient Verification of Data Authenticity","cwe_number":345,"cwe_url":"https:\/\/cwe.mitre.org\/data\/definitions\/345","cvss_score":10,"published":"2015-02-19","owasp":"A08 Software and Data Integrity Failures","odc":"Timing\/Serialization","cdc":"Serialization Issues","category":"Input Validation and Sanitization","subcategory":"Insecure Parsing or Deserialization","scope":"Remote","impact":"Arbitrary Code Execution","summary":"Remote code execution via unsafe Python pickle usage in amsnet.py","permalink":"https:\/\/netpack.pt\/vaitp\/vulnerability\/CVE-2014-8165\/","description":"scripts\/amsvis\/powerpcAMS\/amsnet.py in powerpc-utils-python uses the pickle Python module unsafely, which allows remote attackers to execute arbitrary code via a crafted serialized object.","solution":"Update powerpc-utils-python to a version that safely handles the pickle module, preferably version 1.2.0 or higher.","affected_component":"Python","fixed_by_upgrading":true,"vulnerable_code":"import pickle\n\ndef load_data(serialized_data):\n    # Using pickle to deserialize data unsafely\n    return pickle.loads(serialized_data)\n\ndef process_data(serialized_data):\n    try:\n        data = load_data(serialized_data)\n        # Process the data as needed\n    except Exception as e:\n        print(\"Error processing data:\", e)\n\n# Example of how to use the function\nserialized_data = b'\\x80\\x03}q\\x00X\\x03\\x00\\x00\\x00keyq\\x01X\\x05\\x00\\x00\\x00valueq\\x02.'  # Example of a potentially unsafe serialized object\nprocess_data(serialized_data)","patched_code":"import json\n\ndef safe_load(data):\n    # Use json instead of pickle to safely deserialize data\n    return json.loads(data)\n\ndef process_data(serialized_data):\n    try:\n        data = safe_load(serialized_data)\n        # Process the data as needed\n    except json.JSONDecodeError as e:\n        print(\"Invalid data:\", e)\n\n# Example of how to use the function\nserialized_data = '{\"key\": \"value\"}'  # Example of a safe serialized object\nprocess_data(serialized_data)","payload_needed":false,"payload":null,"payload_status":"none","published_fix":[],"references":null}