312-50V11 · 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 enforcing automatic bounds checking.
Question
Which of the following programming languages is most vulnerable to buffer overflow attacks?
Options
- APerl
- BC++
- CPython
- DJava
How the community answered
(19 responses)- A5% (1)
- B89% (17)
- C5% (1)
Why each option
C++ is most vulnerable to buffer overflow attacks because it allows direct memory manipulation without enforcing automatic bounds checking.
Perl is an interpreted scripting language that manages memory automatically, preventing direct memory address manipulation and buffer overflows.
C++ inherits C's direct memory access model, allowing developers to use raw pointers and manual memory allocation functions like malloc/free and new/delete without automatic bounds enforcement. When input data exceeds allocated buffer size, the runtime does not prevent the overflow, allowing adjacent memory to be overwritten. This is the classic condition exploited in stack-based and heap-based buffer overflow attacks.
Python is an interpreted language with a managed runtime that enforces memory safety and raises exceptions on out-of-bounds access rather than allowing memory corruption.
Java runs on the JVM which enforces strict array bounds checking and automatic garbage collection, making buffer overflows impossible in pure Java code.
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.