mediummultiple choiceObjective-mapped

A support portal searches customers by last name using a parameter called q. After one user enters a single quote, the app returns a SQL syntax error. A tester then submits `test' OR '1'='1` and sees every customer record. Which control most directly prevents this issue?

Question 1mediummultiple choice
Full question →

A support portal searches customers by last name using a parameter called q. After one user enters a single quote, the app returns a SQL syntax error. A tester then submits `test' OR '1'='1` and sees every customer record. Which control most directly prevents this issue?

Answer choices

Why each option matters

Good practice is not just finding the correct option. The wrong answers often show the exact trap the exam wants you to fall into.

A

Best answer

Parameterize the database queries with prepared statements

Prepared statements separate code from data, so attacker-controlled input cannot change the intended SQL query structure.

B

Distractor review

Encode all output returned to the browser

Output encoding helps prevent browser-side issues like XSS, but it does not stop malicious SQL input from reaching the database.

C

Distractor review

Add CSRF tokens to the login form

CSRF tokens protect against unwanted cross-site requests, but they do not address SQL injection in server-side query logic.

D

Distractor review

Move the application to a separate VLAN

Network segmentation may limit exposure, but it does not fix the vulnerable query construction that allows injection.

Common exam trap

Common exam trap: an active trunk can still block the VLAN you need

A trunk being up does not prove every VLAN is crossing it. Check allowed VLAN lists, native VLAN mismatch, VLAN existence and access-port assignment.

Technical deep dive

How to think about this question

VLAN questions usually combine access-port and trunking clues. The key is to identify whether the issue is local to one switchport, caused by the trunk, or caused by the VLAN not existing where it needs to exist.

KKey Concepts to Remember

  • Access ports place end devices into a single VLAN.
  • Trunk ports carry multiple VLANs between switches.
  • Allowed VLAN lists decide which VLANs can cross a trunk.
  • Native VLAN mismatch can create confusing symptoms.

TExam Day Tips

  • Use show vlan brief to verify access VLANs.
  • Use show interfaces trunk to verify trunk state and allowed VLANs.
  • Do not treat every same-VLAN issue as a routing problem.

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.

More questions from this exam

Keep practising from the same exam bank, or move into a focused topic page if this question exposed a weak area.

FAQ

Questions learners often ask

What does this SY0-701 question test?

Access ports place end devices into a single VLAN.

What is the correct answer to this question?

The correct answer is: Parameterize the database queries with prepared statements — Prepared statements are the most direct fix because they separate the SQL command from the user-supplied data. In a vulnerable application, concatenating input into a query lets an attacker alter the database logic, which is why a quote can trigger an error and an injected expression can return all records. Parameterization prevents the database from treating attacker input as executable SQL, which blocks the attack at the root cause. Why others are wrong: Output encoding is useful for preventing reflected or stored XSS in the browser, not SQL injection on the server. CSRF tokens protect against forged browser requests and do not influence database query parsing. A VLAN can reduce exposure to some systems, but it does not stop injection when the application itself is vulnerable.

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

Then try more questions from the same exam bank and focus on understanding why the wrong options are tempting.

Discussion

Loading comments…

Sign in to join the discussion.