CompTIA Security+ SY0-701 · Threats, Vulnerabilities, and Mitigations · easy
A developer discovers that a C++ network daemon copies a 512-byte user packet into a fixed 128-byte stack array using strcpy() without checking the input length, allowing an attacker to overwrite the function return address. What type of vulnerability is this, and which OS defense randomizes memory locations to hinder exploitation?
Published · Last updated · checked before publication — how we verify questions
Options
Answer: A. Buffer overflow mitigated at the OS level by ASLR memory randomization
Copying unchecked input into a fixed-size stack buffer that overwrites adjacent memory and the return pointer is a Stack Buffer Overflow. Address Space Layout Randomization (ASLR) randomizes the memory addresses of the stack, heap, and shared libraries so an attacker cannot reliably jump to a hardcoded shellcode address.
Why the other options are wrong
- B. SQL injection mitigated at the database layer by stored procedures — Overwriting a C++ stack return address via strcpy() is a memory buffer overflow, not SQL injection.
- C. Directory traversal mitigated by canonicalizing file system paths — Directory traversal uses ../ sequences to read arbitrary files, not stack buffer overwrites.
- D. Cross-Site Scripting mitigated by a Content Security Policy header — XSS is a browser script injection flaw in web pages, not a C++ stack memory corruption bug.
More Threats, Vulnerabilities, and Mitigations questions
- A security analyst discovers that an internal billing portal executes raw database queries built as "SELECT * FROM…
- Which two characteristics distinguish an Adversary-in-the-Middle (AitM) reverse-proxy phishing kit from a traditional…
- Which two indicators should a vulnerability management team combine with a vulnerability's base CVSS score to…
- An attacker compromises a niche trade-association website frequently visited by defense contractors, injecting an…
- A web application allows authenticated users to fetch profile avatars by passing a URL parameter…
All Threats, Vulnerabilities, and Mitigations questions and the topic overview →
CompTIA and Security+ are trademarks of the Computing Technology Industry Association. PrepIQ Hub is not affiliated with, endorsed by, or sponsored by CompTIA.