CS0-003 · Question #103
A security analyst found an old version of OpenSSH running on a DMZ server and determined the following piece of code could have led to a command execution through an integer overflow; Which of the fo
The correct answer is C. Use built-in functions from libraries to check and handle long numbers properly.. The vulnerability in the code is an integer overflow, which happens when the size of a variable exceeds its maximum capacity. Attackers can exploit this vulnerability to execute arbitrary code, escalate privileges, or cause a denial of service. To prevent integer overflows, it is
Question
A security analyst found an old version of OpenSSH running on a DMZ server and determined the following piece of code could have led to a command execution through an integer overflow; Which of the following controls must be in place to prevent this vulnerability?
Exhibit
Options
- AConvert all integer numbers in strings to handle the memory buffer correctly.
- BImplement float numbers instead of integers to prevent integer overflows.
- CUse built-in functions from libraries to check and handle long numbers properly.
- DSanitize user inputs, avoiding small numbers that cannot be handled in the memory.
How the community answered
(33 responses)- A6% (2)
- B3% (1)
- C79% (26)
- D12% (4)
Explanation
The vulnerability in the code is an integer overflow, which happens when the size of a variable exceeds its maximum capacity. Attackers can exploit this vulnerability to execute arbitrary code, escalate privileges, or cause a denial of service. To prevent integer overflows, it is recommended to use built-in functions from libraries to check and handle long numbers properly. In this case, OpenSSH should be updated to the latest version, which includes patches to fix this vulnerability. Additionally, it is good practice to use static analysis tools and perform code reviews to detect vulnerabilities before they are deployed to production.
Topics
Community Discussion
No community discussion yet for this question.
