The independent file on technology, travel & lifeFrom Pakistan, for everywhere
Huzi Blogs.
The ArchiveSectionsSearch

Planning a trip? HTG Travels — flights, visas, hotels & Umrah, handled properly.

WhatsApp +92 317 5054959
Huzi Blogs.

An independent file on technology, travel and life — long-form guides written plainly, from Pakistan, for everywhere.

ShopMeet the Creator

Sections

  • Travel
  • Technology
  • Lifestyle
  • Programming
  • Sports
  • Linux
  • All sections

The Desk

  • The Archive
  • Search the file
  • Disclaimer & Data Privacy Policy
  • A project of huzi.pk

© 2026 blogs.huzi.pk — All rights reserved.

Set in Playfair Display & Inter

    HomeCybersecurityStory
    Cybersecurity

    The Invisible Burglar: SQL Injection Explained (2026)

    H

    By Huzi

    File #372 · 3 min read

    SQL injection is the vulnerability that refuses to retire: it has lived in the OWASP Top 10's injection category for over two decades, not because the fix is missing but because string concatenation keeps creeping back into code. The fix is old, boring and total — and worth knowing cold.

    The quick answer: SQL injection glues user input straight into a query string, so admin' -- can comment out a password check. The fix is total and boring: parameterized queries, where values bind as data and never as code. Every ORM parameterizes by default — the danger is its raw-query escape hatch.

    The input trap

    Take the world's most common login query:

    SELECT * FROM users WHERE username = '$user' AND password = '$pass';
    

    Whatever the visitor typed was glued straight into the statement. Type admin' -- as the username and the quote closes the string while the comment marker eats the remainder:

    SELECT * FROM users WHERE username = 'admin' --' AND password = '...'
    

    The password check simply ceases to exist. UNION variants dump whole tables into the page, blind variants extract data one true-or-false question at a time, and sqlmap automates all of it for whoever points it at your site.

    The fix: parameterized queries

    Never build SQL out of user input. Send the query as a blueprint and bind values strictly as data:

    // Node.js with pg — safe
    const result = await pool.query(
      'SELECT id, username FROM users WHERE email = $1 AND active = $2',
      [userEmail, true]
    );
    
    # Python with sqlite3 — safe
    cursor = conn.execute(
        'SELECT id, username FROM users WHERE email = ? AND active = ?',
        (user_email, 1),
    )
    

    The database compiles the structure first and binds values second, so typing DROP TABLE users into the email field makes the system calmly search for a user with that literal name.

    The ORM trap

    Prisma, Django's ORM, SQLAlchemy and Eloquent parameterize by default — and every one of them offers a raw-query escape hatch. Sooner or later someone writes a raw query with template strings, and the door quietly reopens. The rule survives every framework: user input reaches raw SQL only as a bound parameter, never through interpolation.

    Every trusted system has an escape hatch — the raw query in the ORM, the fine print in the fare. HTG Travels reads the hatch before you walk through it: what a ticket actually allows, and what it silently does not.

    Layers behind the code

    Give the application's database account only the permissions it truly needs — one user for reading, another for writing — so a successful injection cannot DROP or ALTER anything it finds. Keep the database off the public internet. Let a WAF such as ModSecurity or Cloudflare act as a tripwire.

    Layer The control What it stops
    Code Parameterized queries (pg, sqlite3) Input treated as data, never SQL
    ORM discipline No raw queries with template strings The quietly reopened door
    Database rights One read user, one write user DROP and ALTER on success
    Network Database off the public internet Direct outside probing
    Perimeter WAF — ModSecurity or Cloudflare A tripwire before production
    Testing sqlmap against staging The stranger's tool, run first

    Pro tip: Run sqlmap against a staging copy of your own site before a stranger runs it against production. The tool that breaks you is the same one that can warn you.

    In Gaza, developers keep shipping careful, parameterised code through power cuts, because "works on my machine" is an excuse their situation has never allowed them.

    Injection succeeds by smuggling unexpected input into a trusted query. Our Umrah packages follow the opposite discipline: at HTG Travels every tier, hotel name and walking distance goes in writing before you pay a single rupee, so nothing unexpected executes later. Message the desk on WhatsApp at +92 317 5054959 for a visa run done between sprints.

    Presented by

    HTG Travels — Plan the Trip, Skip the Runaround

    Flights, visas, Umrah packages and Hunza–Skardu tours, handled end to end from our licensed Sialkot desk. Real fares, hotel names in writing, and a human who answers — before you pay a rupee.

    Flights & rebooking Visa files Umrah 2026–27 Northern tours
    Visit huzi.pkWhatsApp +92 317 5054959

    Sialkot, Pakistan · Licensed agency · Fast quotes on WhatsApp


    You Might Also Like

    IB Swiss Fashion Men’s Unstitched Shalwar Kameez – Premium Soft Egyptian Cotton Fabric | Summer Wear Pakistan

    IB Swiss Fashion Men’s Unstitched Shalwar Kameez – Premium Soft Egyptian Cotton Fabric | Summer Wear Pakistan

    PKR 3500

    Glamorous Handwork Heavy Embroidered Net Bridal Maxi (12 Kali, 120" Frill)

    Glamorous Handwork Heavy Embroidered Net Bridal Maxi (12 Kali, 120" Frill)

    PKR 9600

    Fashion Men’s Unstitched Shalwar Kameez – Premium Soft Egyptian Cotton Fabric | Summer Wear Pakistan

    Fashion Men’s Unstitched Shalwar Kameez – Premium Soft Egyptian Cotton Fabric | Summer Wear Pakistan

    PKR 3000

    Heavy Embroidered Formal Chiffon Suit | Silk Gharara Trouser

    Heavy Embroidered Formal Chiffon Suit | Silk Gharara Trouser

    PKR 7550

    Formal Embroidered 9000 Micro Velvet Party Wear Suit 2026 | Emb. Silk Trouser

    Formal Embroidered 9000 Micro Velvet Party Wear Suit 2026 | Emb. Silk Trouser

    PKR 8800

    Keep reading

    Related files

    Cybersecurity
    English

    Top 10 Essential Tools in Kali Linux for 2026

    Ten Kali Linux tools that actually earn their keep on real engagements — nmap, Burp Suite, Hashcat, SQLmap and more, each with the one command that matters.

    By HuziFile #64

    Read
    Cybersecurity
    English

    The Human Operating System: A Guide to Social Engineering in 2026

    How social engineering actually works on the mind — pretexting, vishing, deepfake calls and MFA fatigue — told through real attacks, with defences that go beyond 'just don't click'.

    By HuziFile #367

    Read
    Cybersecurity
    English

    5 Advanced Cloudflare Features You Should Be Using in 2026

    Workers, R2, Zero Trust, Email Routing and Snippets — the Cloudflare features that matter after the free DNS and caching are already running, with working code for each.

    By HuziFile #12

    Read
    Cybersecurity
    English

    Web Security Fundamentals 2026: The Complete Problem-Solving Guide

    The 2026 defense-in-depth stack, from a working Next.js headers block to nonce-based CSP, HSTS preload, post-quantum X25519MLKEM768, and the quiet COOP/COEP/CORP trio.

    By HuziFile #551

    Read
    Cybersecurity
    English

    Linux Security Hardening 2026: The Complete Problem-Solving Guide

    A copy-paste Linux server hardening checklist for 2026: sshd_config, key-based login, firewalld, fail2ban and auditd — in the order that avoids locking yourself out.

    By HuziFile #541

    Read
    Cybersecurity
    English

    WhatsApp Business for Pakistani SMBs in 2026: The Complete Sales Playbook

    Catalogs that sell across time zones, away messages that cover the gap while you sleep, the 256-broadcast ceiling, template rules, and the settings that keep a business number from being hijacked.

    By HuziFile #489

    Read
    Back to the archive