312-50V10 · Question #318
Which of the following programming languages is most vulnerable to buffer overflow attacks?
The correct answer is B. C++. C++ is most vulnerable to buffer overflow attacks because it allows direct memory manipulation without automatic bounds checking, unlike managed or interpreted languages.
Question
Which of the following programming languages is most vulnerable to buffer overflow attacks?
Options
- APerl
- BC++
- CPython
- DJava
How the community answered
(35 responses)- A3% (1)
- B91% (32)
- D6% (2)
Why each option
C++ is most vulnerable to buffer overflow attacks because it allows direct memory manipulation without automatic bounds checking, unlike managed or interpreted languages.
Perl is an interpreted language with automatic memory management that abstracts direct memory access, significantly reducing buffer overflow risk.
C++ provides direct access to memory through pointers and does not perform automatic bounds checking on arrays or buffers, meaning a programmer can write past the end of an allocated buffer and overwrite adjacent memory. This is the classic condition exploited in buffer overflow attacks, and it is a well-documented vulnerability class in C and C++ programs that managed languages prevent by design.
Python is an interpreted, garbage-collected language that manages memory automatically and raises exceptions on out-of-bounds access rather than silently overwriting memory.
Java runs on the JVM which enforces strict array bounds checking at runtime and throws ArrayIndexOutOfBoundsException instead of allowing memory corruption.
Concept tested: Buffer overflow vulnerability in unmanaged languages
Source: https://owasp.org/www-community/vulnerabilities/Buffer_Overflow
Topics
Community Discussion
No community discussion yet for this question.