StudyToCert

All certifications / Security+ / Lessons

CompTIA Security+ SY0-701 · Domain 2: Threats, vulnerabilities & mitigations

SQL injection, XSS (stored/reflected), CSRF

▶ Watch the overview video

Last reviewed October 6, 2026 · Leer en español

Explain it simpler

These are common attacks on websites. SQL injection happens when a site puts what you type straight into a database command, so an attacker can type database instructions that read or change data. The fix is to treat input strictly as data, using parameterized queries. Cross-site scripting (XSS) gets a website to show attacker-written code that runs in visitors' browsers. Stored XSS saves the code on the site, like in a comment, so it hits everyone who views it; reflected XSS bounces it back from a crafted link. Cross-site request forgery (CSRF) tricks your logged-in browser into sending a request you did not intend, like changing your email. It is like a clerk who reads your note aloud as an order, a public notice board someone has written a trick message on, and a forged note that uses your signature.

It is Tuesday morning at Lakeside Outfitters, and Priya on the web team opens a ticket from customer support: three agents say their accounts changed language settings on their own after opening the same customer ticket. Meanwhile the database administrator forwards a log with a strange login attempt, a username field full of quote marks and the word OR. And a customer swears she never changed her shipping address, yet the order history shows she did, from her own logged-in session. Three odd reports, three different web attacks. Which one is which, and what single fix would have stopped each?

Three web application attacks appear on almost every Security+ exam: SQL injection, cross-site scripting (XSS) and cross-site request forgery (CSRF). All three abuse the way a web application trusts either the data it receives or the browser that sends it. They matter because web applications are exposed to the whole internet, and a single vulnerable form can leak an entire customer database or let an attacker act as a logged-in user. The exam focuses on telling them apart and picking the right defense for each, rather than on writing the attacks, so this lesson keeps the attacker's side at the level you need to recognize it.

Free account

Keep reading for free

Create a free StudyToCert account to read the rest of this lesson: 9 more sections, 9 key terms, a real-world example, an exam tip and self-check questions. Every lesson, lab and practice test is free with an account.

Sign up free Log in

Study Security+ for free
A week-by-week plan with every lesson, quizzes, checkpoint tests, a practice exam and hands-on labs.
Open the Security+ study plan