Exam SPLK-2001 All QuestionsBrowse all questions from this exam
Question 41

Consider the following Python code snippet used in a Splunk add-on: if not os.path.exists(full_path): self.doAction(full_path, header) else: f = open(full_path) oldORnew = f.readline

().split(`,`) f.close()

An attacker could create a denial of service by causing an error in either the open() or readline() commands. What type of vulnerability is this?

    Correct Answer: C

    The provided code snippet has the potential for a vulnerability due to improper resource management. Specifically, the file is being left open if an error occurs during the 'readline()' call, which can prevent proper release of that resource. This is classified as CWE-404: Improper Resource Shutdown or Release, as it addresses the risk of resource leaks that could occur when resources are not properly closed or released. Ensuring that resources like files are properly managed and released is crucial to avoid such vulnerabilities.

Discussion
Ignotus

use the reference link; it's there.

qtygbapjpesdayazkoOption: C

C. CWE-404: Improper Resource Shutdown or Release

nosavotor

Friends could you please confirm this answer