nerdexam
EC-Council

312-50V9 · Question #92

Which of the following programming languages is most vulnerable to buffer overflow attacks?

The correct answer is B. C++. C++ inherits C's manual memory management without automatic bounds checking, making it the most susceptible mainstream language to buffer overflow vulnerabilities.

System Hacking

Question

Which of the following programming languages is most vulnerable to buffer overflow attacks?

Options

  • APerl
  • BC++
  • CPython
  • DJava

How the community answered

(45 responses)
  • A
    7% (3)
  • B
    89% (40)
  • C
    2% (1)
  • D
    2% (1)

Why each option

C++ inherits C's manual memory management without automatic bounds checking, making it the most susceptible mainstream language to buffer overflow vulnerabilities.

APerl

Perl is an interpreted, high-level language whose runtime manages memory allocation and enforces string boundaries, making classic buffer overflows effectively impossible at the language level.

BC++Correct

C++ allows direct pointer arithmetic and manual heap/stack memory management without enforcing array boundary checks at the language level, so writing past a buffer's end is undefined behavior that attackers can exploit. This contrasts with languages that use managed runtimes or automatic bounds checking to prevent such overwrites.

CPython

Python manages all memory through its interpreter and enforces strict bounds on data structures, so buffer overflows of the type exploitable in native code cannot occur in Python scripts.

DJava

Java runs inside the JVM, which performs automatic array bounds checking and garbage collection, preventing programs from writing outside allocated buffers.

Concept tested: Buffer overflow vulnerability in memory-unsafe languages

Source: https://learn.microsoft.com/en-us/cpp/code-quality/understanding-buffer-overruns

Topics

#buffer overflow#C++#memory management#unsafe languages

Community Discussion

No community discussion yet for this question.

Full 312-50V9 Practice