Buffer Overflow vs SQL Injection Attack Analysis

Answer Correct answer: B — This is a buffer overflow attack because the code attempts to write to an array index (10) that exceeds the allocated buffer size (0-9), leading to memory corruption rather than database manipulation.

John is investigating web-application firewall logs and observers that someone is attempting to inject the following: What type of attack is this? - image

  1. SQL injection
  2. Buffer overflow Correct Answer
  3. CSRF
  4. XSS

Community Votes

B
80%
A
20%

80% of anonymous learners picked answer B. Votes are pick records left by other test-takers — they are not the verified answer.

Community Insight

The core concept tested is memory management vulnerabilities, with the common trap being the misidentification of out-of-bounds array access as an SQL injection attempt due to the presence of code-like syntax.

This question tests the ability to distinguish between buffer overflow and SQL injection attacks by analyzing a code snippet involving array index access. It establishes that writing beyond allocated memory boundaries constitutes a buffer overflow, not a database query manipulation.

Many learners incorrectly select SQL injection (A) because they see code or strings that look like data, failing to recognize that the specific action of accessing index 10 in a 10-element array (0-9) is a memory corruption issue, not a database query issue.

Community Discussion (4 comments)

nicejob 👍 1 Selected: B
buffer overflow, it not possible is sqli
Osanyindoro 👍 2 Selected: B
The answer is B (buffer overflow) Reasons: The buffer buff is defined to hold 10 elements (indices 0 through 9). Writing to buff[10] attempts to access memory beyond the allocated buffer size. This can lead to overwriting adjacent memory, potentially corrupting data, crashing the application, or enabling the execution of malicious code.
Booict 👍 1 Selected: B
the answer is B and not A. Ignore my previous answer
Booict 👍 1 Selected: A
SQL injection attack involves inserting malicious SQL code into a web application's input fields to manipulate the database

Comments & Corrections

No comments yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

Expert Analysis

Why the Answer Is Correct

The correct answer is B (Buffer Overflow). The image likely depicts a code snippet where an array or buffer of size 10 (indices 0-9) is being accessed at index 10 (e.g., buff[10] = value). This action writes data beyond the allocated memory boundary, overwriting adjacent memory locations. This is the definition of a buffer overflow vulnerability, which can lead to crashes, data corruption, or arbitrary code execution.

Why the Other Options Are Wrong

SQL injection (A) involves inserting malicious SQL statements into input fields to manipulate a backend database; it does not involve direct memory access errors in application code. Cross-Site Request Forgery (C) is an attack that forces an end user to execute unwanted actions on a trusted web application, unrelated to memory bounds. Cross-Site Scripting (D) involves injecting client-side scripts into web pages viewed by other users, also unrelated to server-side memory allocation errors.

Community Comment Notes

Community consensus strongly supports Buffer Overflow. As Osanyindoro noted, "Writing to buff[10] attempts to access memory beyond the allocated buffer size," correctly identifying the out-of-bounds access. Another commenter, nicejob, emphasized that "it not possible is sqli," highlighting the distinction between memory errors and database queries. Booict initially considered SQL injection but corrected themselves, confirming the buffer overflow nature upon closer inspection of the indices.

Exam Strategy

When analyzing attack scenarios, always look for keywords related to memory management (buffer, stack, heap, overflow, crash) versus database interactions (SQL, query, UNION, SELECT). If the exploit involves exceeding array limits or pointer arithmetic, it is a buffer overflow, not SQL injection.

Frequently Asked Questions

Why is this not SQL injection if it looks like code?

SQL injection requires injecting commands into a database query. This scenario shows direct memory access violation in application code, which is a buffer overflow.

How do I identify buffer overflow in exam questions?

Look for mentions of arrays, buffers, indices, 'out of bounds', 'crash', or 'memory corruption'. If the exploit breaks memory boundaries, it's a buffer overflow.

More 312-50v13 FAQ →

Related Analysis

← Back to 312-50v13 Study Guide