Question 231 of 1,152
Threats, Vulnerabilities, and MitigationshardMultiple SelectObjective-mapped

Quick Answer

The correct answer is to store uploads outside the web root and deny execution permissions on the upload directory. This combination works because storing files outside the web root removes direct URL access, so even if a path traversal sequence like `../` is submitted, the application cannot serve files from arbitrary directories via the web server. Denying execution permissions on the upload directory then prevents any uploaded file—malicious or not—from being run as code, closing the door on remote code execution attacks. On the Security+ SY0-701 exam, path traversal mitigation questions often test your understanding that server-side validation alone is insufficient; you must also enforce secure storage architecture. A common trap is assuming client-side filtering or simple string replacement of `../` is enough, but attackers easily bypass these with encoded sequences like `%2e%2e%2f`. For memory, think “out of root, no execute”—if the uploads are outside the web root and can’t execute, traversal attempts become harmless.

SY0-701 Threats, Vulnerabilities, and Mitigations Practice Question

This SY0-701 practice question tests your understanding of threats, vulnerabilities, and mitigations. Examine the command output carefully: the correct answer depends on what the output actually shows, not on general recall alone. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

A support portal lets users upload files and name them manually. During review, a tester submits a filename containing path traversal sequences, and logs later show the application trying to access files outside the intended upload folder. Which two changes best address the flaw? Select two.

Clue words in this question

Noticing these words before you look at the options changes how you read each choice.

  • Clue: "best"

    Why it matters: Signals that multiple options may be partially correct. Choose the option that most directly solves the exact problem described, not the one that sounds most complete.

Question 1hardmulti select
Read the full NAT/PAT explanation →

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Validate and canonicalize the filename on the server, then allow only approved name patterns.

Option A is correct because server-side validation and canonicalization (e.g., using `realpath()` or `Path.GetFullPath()`) resolves path traversal sequences like `../` to an absolute path, which can then be checked against an allowlist of permitted patterns. This prevents the application from following malicious sequences to access files outside the intended upload directory. Without canonicalization, simple string filtering can be bypassed by encoding or alternative traversal patterns.

Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Validate and canonicalize the filename on the server, then allow only approved name patterns.

    Why this is correct

    Server-side canonicalization and allowlisting stop attackers from escaping the expected directory structure. Client-side checks are not enough because attackers can modify requests directly. This is the most direct way to prevent traversal sequences from being interpreted as filesystem paths.

    Clue confirmation

    The clue word "best" in the question point toward this answer.

    Related concept

    Read the scenario before looking for a memorised answer.

  • Store uploads outside the web root and deny execution permissions on the upload directory.

    Why this is correct

    Keeping uploads outside the web-accessible path reduces the risk that a file can be executed or directly fetched. Denying execution helps prevent an attacker from turning an upload feature into code execution. This is a strong defense-in-depth control for untrusted files.

    Clue confirmation

    The clue word "best" in the question point toward this answer.

    Related concept

    Read the scenario before looking for a memorised answer.

  • Increase the maximum upload size so the application can handle more files.

    Why it's wrong here

    Larger file limits do not stop path traversal or malicious filename manipulation. That change addresses capacity, not input validation. In some cases it could even make abuse worse by allowing larger malicious payloads to be uploaded.

  • Add browser-side JavaScript validation to reject suspicious filenames.

    Why it's wrong here

    Client-side validation improves user experience, but it is easily bypassed by modifying the request. Attackers do not rely on the browser interface, so server-side validation is still required. This control helps usability, not real security enforcement.

  • Hide detailed error messages from end users only.

    Why it's wrong here

    Reducing error detail can limit information leakage, but it does not stop traversal attempts. The application would still be vulnerable if it accepts and processes unsafe paths. Error handling is useful, but it is not the main fix for the flaw shown.

Common exam traps

Common exam trap: answer the scenario, not the keyword

CompTIA often tests the misconception that client-side validation or error message hiding is sufficient to prevent server-side attacks, when in fact only server-side canonicalization and allowlisting can stop path traversal.

Trap categories for this question

  • Command / output trap

    Reducing error detail can limit information leakage, but it does not stop traversal attempts. The application would still be vulnerable if it accepts and processes unsafe paths. Error handling is useful, but it is not the main fix for the flaw shown.

Detailed technical explanation

How to think about this question

Path traversal attacks exploit insufficient input sanitization by injecting sequences like `../` or encoded variants (`%2e%2e%2f`) to navigate the filesystem. Canonicalization resolves these sequences to a normalized path, which can then be compared against an allowed base directory (e.g., using `os.path.abspath()` in Python or `Path.GetFullPath()` in .NET). A real-world example is the CVE-2019-10742 vulnerability in Axios, where improper path validation allowed reading arbitrary files on the server.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Real-world example

How this comes up in practice

A developer is choosing between AES-256 (symmetric) and RSA-2048 (asymmetric) for encrypting a large file that will be sent to a partner. Symmetric encryption is fast but requires key exchange; asymmetric is slower but solves the key distribution problem. A hybrid approach — encrypt the file with AES, encrypt the AES key with RSA — is standard. Questions like this test whether you understand when each approach applies.

What to study next

Got this wrong? Here's your next step.

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Related practice questions

Related SY0-701 practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free SY0-701 practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this SY0-701 question test?

Threats, Vulnerabilities, and Mitigations — This question tests Threats, Vulnerabilities, and Mitigations — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: Validate and canonicalize the filename on the server, then allow only approved name patterns. — Option A is correct because server-side validation and canonicalization (e.g., using `realpath()` or `Path.GetFullPath()`) resolves path traversal sequences like `../` to an absolute path, which can then be checked against an allowlist of permitted patterns. This prevents the application from following malicious sequences to access files outside the intended upload directory. Without canonicalization, simple string filtering can be bypassed by encoding or alternative traversal patterns.

What should I do if I get this SY0-701 question wrong?

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Are there clue words in this question I should notice?

Yes — watch for: "best". Signals that multiple options may be partially correct. Choose the option that most directly solves the exact problem described, not the one that sounds most complete.

What is the key concept behind this question?

Read the scenario before looking for a memorised answer.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Keep practising

More SY0-701 practice questions

Last reviewed: Jun 30, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This SY0-701 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the SY0-701 exam.