SPLK-2001 Exam QuestionsBrowse all questions from this exam

SPLK-2001 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?

Show Answer
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

3 comments
Sign in to comment
Ignotus
Aug 23, 2023

use the reference link; it's there.

nosavotor
Aug 22, 2023

Friends could you please confirm this answer

qtygbapjpesdayazkoOption: C
Sep 17, 2023

C. CWE-404: Improper Resource Shutdown or Release