SQL Injection (SQLi) - what it is, why it’s dangerous, and how to prevent it

SQL Injection (SQLi)

What it is

SQL Injection is a way attackers trick a website into running their database commands. Instead of treating a form field (like “username”) as plain text, a vulnerable site stuffs that text straight into a database query. If an attacker types special characters and SQL words, the site may run them - letting the attacker peek at tables, change data, or even delete it. Think of it as slipping a second instruction into a message meant for the database. Well-built apps block this; rushed ones sometimes don’t.

Why it matters

A single SQLi hole can expose logins, emails, payment info - or let someone take over accounts and wipe records. Breaches from SQLi often lead to identity theft and big service outages.

How it works

  • Find input: attacker tests fields/URLs for errors or odd responses.

  • Inject: adds SQL pieces (quotes, OR/AND, UNION, etc.) to change the query.

  • Extract/modify: dumps tables, changes passwords, or deletes rows.

  • Pivot: uses the database foothold to move deeper into the app or network.

Red flags

  • Weird database error messages shown to users (with “SQL” or table names).

  • Sudden spikes in requests with quotes, UNION, or odd parameters.

  • Unexplained data changes or new admin accounts.

  • WAF/EDR alerts about injection patterns in web traffic.

Prevent it

  • Parameterized queries (prepared statements): never build SQL by string-concatenating user input.

  • ORM/Query builders: use safe APIs that bind values for you.

  • Input handling: validate types/lengths; reject unexpected characters where possible.

  • Least privilege: app DB user should only have the permissions it needs.

  • WAF & monitoring: block common SQLi patterns and alert on anomalies.

  • Tests: run automated scanners and add unit/integration tests for SQLi cases.

    Glossary (A–Z)

    All A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
      • Related Articles

      • Data Execution Prevention

        What it is Data Execution Prevention (DEP) is a Windows safety net that stops code from running in places it shouldn’t—like the stack or heap. If malware tries to execute from those memory areas, Windows blocks it and shuts the app down instead of ...
      • Data Exfiltration

        What it is Data exfiltration is the unauthorized transfer of your data out of your device or network—quietly slipping customer records, passwords, designs, or finances to an attacker. It’s the punchline of many breaches: get in, get data out, cash ...
      • Web Protection

        What it is Web protection is a bundle of tools and settings that keep you safer while you browse. It blocks dangerous sites and downloads, warns about fake logins, filters sketchy links, and helps keep your info private. It can run on your device ...
      • Web Cache Poisoning

        What it is Web cache poisoning is when attackers sneak bad content into a website’s cache. The cache is a “shortcut” server use to make pages load faster for everyone. If it’s poisoned, later visitors get the attacker’s fake version instead of the ...
      • Code Injection

        What it is Code injection (often leading to remote code execution) is when attackers feed a program the kind of input it never expected—so it runs the attacker’s code instead of safe instructions. That “code” can be a script or DLL dropped after the ...