300-215 exam dumps

300-215 practice question 96 of 229

Conducting Forensic Analysis and Incident Response Using Cisco Technologies for Cybersecurity. Professional level, Cisco. Free question with the correct answer and a full explanation.

300-215 Question 96

Single answer

During a forensic investigation, you are presented with the following code snippet found in a compromised system:

function checkUserInput(input) {
    let evalResult;
    try {
        evalResult = eval(input);
    } catch (e) {
        console.log('Error executing input:', e);
    }
    return evalResult;
}

What type of code does this snippet represent?

  1. A

    Code demonstrating a potential Command Injection vulnerability

  2. B

    Code demonstrating a potential SQL Injection vulnerability

  3. C

    Code demonstrating a potential Cross-Site Scripting (XSS) vulnerability

  4. D

    Code demonstrating a secure implementation of user input handling

Show answer and explanation

Correct answer: A

Explanation

The eval() function is highly dangerous when used with user-supplied input because it can execute arbitrary code. This is a classic example of a potential Command Injection vulnerability. Proper validation and sanitization of user inputs should be implemented instead of directly executing them.

  • A. Correct.

    The use of the eval() function to directly execute user-supplied input is a common pattern for Command Injection vulnerabilities. An attacker could craft malicious input to execute arbitrary system commands or scripts.

  • B. Incorrect.

    SQL Injection vulnerabilities typically involve improper handling of user inputs in SQL queries. This snippet does not include any SQL-related code.

  • C. Incorrect.

    Cross-Site Scripting (XSS) vulnerabilities are related to the injection of malicious scripts into web pages. This snippet does not involve HTML or browser-side script execution.

  • D. Incorrect.

    The use of eval() with user input is inherently insecure. It allows for arbitrary code execution, which is not a secure implementation of user input handling.

Timed practice exam

Take a 300-215 practice test under exam conditions

75 questions in 120 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam