A 36-minute working session on the attacks that break real apps — SQL injection, XSS, CSRF, broken access control, SSRF — why they work, and the small set of habits that shut each one down. Anchored on the OWASP Top 10.
A normal developer asks "how do I make this work?" An attacker asks "what happens if I send something you didn'texpect?" Security is just the discipline of asking that second question first — and assuming any data crossing into your system might be hostile.
Nothing reaches the trusted side without being validated at the boundary.
Assume any one control will eventually fail, so stack several. A parameterized query and input validation and least privilege on the DB user. If the first line breaks, the next still holds.
Like a bank — a locked door, plus cameras, plus a vault, plus a guard. No single failure empties it.
Every user, service, and token should hold only the permissions it actually needs. A reporting job gets read-only access, not DROP TABLE. When something is compromised, the blast radius is small.
Like a hotel keycard — it opens your room and the gym, not every other guest's door.
Injection happens whenever you glue untrusted text into a command that an interpreter then runs — SQL, a shell, an LDAP filter. The attacker stops being a user and starts being an author of your queries. The fix is one habit, and it is nearly free.
? placeholders first, then the values separately. The database compiles the query structure once, then slots the values in as pure data. They can never become new SQL. This single technique kills the entire category.Code and data ride separate channels — the value never re-enters the SQL grammar.
DROP TABLE.If injection is "attacker writes your SQL," XSS is "attacker writes your JavaScript." Sneak a <script>into a page another user loads, and it runs with that user's session — stealing cookies, keylogging, making requests as them. The defense: treat user content as text, and lock down what scripts may run.
The attacker saves a malicious script in a field you persist — a comment, a profile bio, a product review. It then fires for everyone who views that content. The most damaging kind, because it spreads on its own.
Input from the URL or form is echoed into the response unescaped — a search page that prints You searched for: …. The attacker emails a crafted link; clicking it runs their script in your victim's session.
Client-side JavaScript reads something attacker-controlled (the URL hash, localStorage) and writes it into the page with innerHTML. The whole exploit lives in the browser, so server logs show nothing.
< shows as a literal less-than sign instead of starting a tag. Modern frameworks (React, Vue, Angular, server templates) auto-escape by default — the danger is the escape hatch: dangerouslySetInnerHTML, v-html, innerHTML.CSP is the safety net: even if a script slips in, the browser refuses to run inline or third-party code.
XSS abuses trust the user has in your site. CSRF abuses the trust your site has in the user's browser. The attacker doesn't steal a session — they ride one that's already logged in, by making the victim's browser fire a request it didn't mean to send.
The victim never clicks "transfer" — evil.com submits it for them, and the browser helpfully attaches the cookie.
SameSite=Lax (a sensible default) blocks it on cross-site POSTs while still allowing normal top-level navigation; SameSite=Strict is tighter. This alone defeats the classic CSRF attack.Belt and braces: SameSite stops the request being sent, and the token means even a same-site mistake fails closed. Pure-token APIs that authenticate with an Authorization header instead of cookies are naturally CSRF-resistant.
Some of the most common breaches aren't exotic — they're forgetting to check who's asking, letting your server fetch a URL it shouldn't, or leaving a key in the repo. Broken access control has topped the OWASP Top 10. Expand each below.
The app authenticates who you are but forgets to check what you're allowed to touch. The classic form is IDOR— an Insecure Direct Object Reference — where changing an id in the URL hands you another user's record.
Enforce authorization on the server, on every request, deny by default. Never rely on a hidden button or a client-side role check.
SSRF is when an attacker makes your server send a request to a destination they pick. Since the server sits inside your network, it can reach internal services and the cloud metadata endpoint — often handing over credentials.
Validate against an allowlist of permitted hosts, resolve and block private IP ranges, and disable redirects. SSRF earned its own slot on the OWASP Top 10.
Secrets — API keys, DB passwords, signing keys — hard-coded in source, committed to git, or printed in logs. Once a secret is in git history it is compromised forever, even after you delete the line. This overlaps OWASP's Cryptographic Failures and Security Misconfiguration.
Keep secrets in environment variables or a secrets manager (Vault, AWS/GCP Secrets Manager). Add automated secret scanning to CI, and ship sane defaults — no debug pages, no default admin passwords, in production.
Tools don't replace the mindset — they scale it. Four families cover different moments: scanning your own code, attacking the running app, watching your dependencies, and filtering live traffic. Use them together; each catches what the others miss.
Static Application Security Testing reads your code without running it, flagging risky patterns — a raw SQL concat, an innerHTMLsink — as you type or in CI. Catches issues earliest, when they're cheapest.
Pro: fast, custom rules in plain patterns, generous free tier.
Con: rules you write yourself can be noisy until tuned.
Pro: strong IDE/PR integration, AI-assisted fix suggestions.
Con: commercial; deeper features are paid.
Dynamic Application Security Testingprobes a live deployment from the outside like a real attacker — fuzzing inputs, replaying requests — so it finds runtime and config issues source scanning can't see.
Pro: free, open-source, scriptable for CI pipelines.
Con: steeper setup; more false positives to triage.
Pro:the pentester's standard; unmatched manual tooling.
Con: Pro tier is paid; built for experts, not push-button.
Most of your app is code you didn't write. These tools watch your package.json/ lockfile for libraries with known CVEs (OWASP's "Vulnerable and Outdated Components") and open upgrade PRs.
Pro: free and built into GitHub; zero setup, auto PRs.
Con: GitHub-centric; PR noise on big dependency trees.
Pro: rich vuln database, reachability analysis, fix advice.
Con: full platform is commercial.
A Web Application Firewall sits in front of your app and blocks malicious requests by pattern — injection strings, known bad bots — plus rate-limiting and DDoS mitigation. A shield, not a fix for the underlying bug.
Pro: easy to deploy, managed rule sets, strong DDoS protection.
Con: can be bypassed; risks a false sense of safety.
Pro: AWS WAF / Azure / GCP integrate tightly with your stack.
Con: rule tuning is on you; per-request cost at scale.
Threat modeling is just a structured version of the question we started with: what could go wrong here? Four questions, asked before you ship a feature — no special tools required.
What are we building? Sketch the data flow and mark the trust boundaries.
What can go wrong? Walk each input — spoofing, tampering, info leak, elevation.
What will we do? Pick a control per risk — escape, parameterize, authorize.
Did it work? Verify with a test, a scan, or a review.
Five quick questions on injection, XSS, CSRF, access control, and tooling — instant feedback, no sign-in.
Navigate with ← → or scroll · back to library