A development team is reviewing a function in a compiled C network service that handles attacker-supplied input. They want to identify the conditions present in this routine that together make a classic stack buffer overflow possible, so they can write a remediation ticket that targets the actual cause. Which TWO characteristics of the code are the conditions that most directly enable a stack buffer overflow? Select TWO.
- AThe routine briefly trusts a permission check made a moment earlier, allowing another thread to swap the target file before the write occurs
- BIncoming data is copied into a fixed-size stack buffer using a routine that does not check the length of the source against the destination size Correct
- CThe length of the input is fully attacker-controlled and can exceed the size of the destination buffer at runtime Correct
- DThe flaw has not yet been disclosed to the vendor and no patch or detection signature exists for it across any product version
- EThe service was deployed with its diagnostic logging endpoint left publicly reachable over the network without any authentication
Why A is wrong: This describes a time-of-check to time-of-use race condition, which is a real flaw but concerns concurrent state changes between two operations, not the fixed-size memory copy that produces a buffer overflow.
Why B is correct: Copying without a bounds check is a defining enabler of a buffer overflow, because input longer than the destination overwrites adjacent stack memory such as the saved return address.
Why C is correct: Attacker control over an input length that can exceed the buffer is the second necessary condition, since without oversized input the unchecked copy would never write past the buffer's bounds.
Why D is wrong: This is tempting because the function may indeed be undiscovered, but undisclosed status describes a zero-day vulnerability and says nothing about the memory-handling mechanics that cause an overflow.
Why E is wrong: An exposed unauthenticated endpoint is a security misconfiguration introduced at deployment, which is a separate category and does not contribute to the in-memory overwrite that defines a buffer overflow.