{"id":766,"cve":"CVE-2008-3294","cve_url":"https:\/\/www.cvedetails.com\/cve\/CVE-2008-3294","cwe":"CWE-94 Improper Control of Generation of Code ('Code Injection')","cwe_number":94,"cwe_url":"https:\/\/cwe.mitre.org\/data\/definitions\/94","cvss_score":3.7,"published":"2008-07-24","owasp":"A08 Software and Data Integrity Failures","odc":"Timing\/Serialization","cdc":"Timing Issues","category":"Authentication, Authorization, and Session Management","subcategory":"Privilege Escalation","scope":"Local","impact":"Arbitrary Code Execution","summary":"Vim 5.0-7.1, Python build: Insecure Makefile-conf ownership and permissions allow code execution by local users","permalink":"https:\/\/netpack.pt\/vaitp\/vulnerability\/CVE-2008-3294\/","description":"src\/configure.in in Vim 5.0 through 7.1, when used for a build with Python support, does not ensure that the Makefile-conf temporary file has the intended ownership and permissions, which allows local users to execute arbitrary code by modifying this file during a time window, or by creating it ahead of time with permissions that prevent its modification by configure.","solution":"Update Vim to version 7.2 or higher.","affected_component":"Vim","fixed_by_upgrading":true,"vulnerable_code":"import os\nimport tempfile\n\ndef create_makefile_conf():\n    temp_file_name = tempfile.mktemp(prefix='Makefile-conf-')\n    with open(temp_file_name, 'w') as temp_file:\n        temp_file.write(\"# Makefile configuration\\n\")\n    \n    with open(temp_file_name, 'r') as file:\n        print(file.read())\n    \n    os.remove(temp_file_name)\n\ncreate_makefile_conf()","patched_code":"import os\nimport tempfile\nimport stat\n\ndef create_makefile_conf():\n    with tempfile.NamedTemporaryFile(delete=False) as temp_file:\n        temp_file_name = temp_file.name\n        temp_file.write(b\"# Makefile configuration\\n\")\n    \n    os.chmod(temp_file_name, stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IROTH)\n    \n    try:\n        with open(temp_file_name, 'r') as file:\n            print(file.read())\n    finally:\n        os.remove(temp_file_name)\n\ncreate_makefile_conf()","payload_needed":false,"payload":null,"payload_status":"none","published_fix":[],"references":null}