Charitha Reddysecurity engineering
← All writing

Working the OWASP Top 10 by hand: PortSwigger and TryHackMe

During my application-security internship I worked through the PortSwigger Web Security Academy and TryHackMe's OWASP Top 10 room. Reading about a vulnerability and exploiting one are different things; the labs made the mechanics concrete. These are the six classes I spent the most time on, each with how the attack works and the fix I'd actually push for in review.

SQL injection

The labs start where it always starts: user input concatenated into a query. Entering ' OR 1=1-- in a login turns the WHERE clause into something always true; a UNION SELECT pulls data out of other tables. The ones that stuck were blind injection, where you confirm the flaw through boolean responses or a timing payload like '; IF (...) WAITFOR DELAY '0:0:5'-- rather than visible output.

Fix: parameterized queries, every time. The driver sends the query structure and the data separately, so input can never become SQL. ORMs do this by default; the danger is their raw-SQL escape hatches. Least-privilege database accounts limit the blast radius if one slips through.

Cross-site scripting (XSS)

Reflected XSS bounces a script out of a search parameter; stored XSS persists it in a comment or profile so it fires for every viewer; DOM XSS never touches the server, the page's own JavaScript writes attacker input into a sink like innerHTML. The lesson was that the sink matters as much as the source.

Fix: context-aware output encoding (HTML, attribute, JS, URL each differ), a strong Content-Security-Policy as a second layer, and for DOM XSS, safe sinks like textContent instead of innerHTML.

Broken access control

The one most relevant to my day job. Changing an ID in /account?id=1234 to read someone else's data (IDOR), or calling an admin API directly because the only control was a hidden button. Authentication asks "who are you?"; access control asks "are you allowed to do this?", and the second check is the one that goes missing.

Fix: enforce an ownership check on the server for every object access, deny by default, and centralize the authorization decision instead of scattering it across handlers. Hiding a UI element is not a control.

Server-side request forgery (SSRF)

You get the server to make a request for you: point a URL parameter at http://169.254.169.254/ to reach a cloud metadata endpoint, or at internal services behind the firewall. The labs covered the evasions too, alternate IP encodings and open-redirect chains to slip past naive allow-lists.

Fix: allow-list the destinations the server may call rather than block-listing bad ones, resolve and validate the host, and block link-local and internal ranges. On AWS, enforcing IMDSv2 removes the classic metadata target.

Authentication

Username enumeration from different error messages or response timings, brute-forcing weak lockout logic, and flawed password-reset and "stay logged in" flows. Small design gaps that each hand an attacker one more step.

Fix: identical responses whether or not an account exists, rate limiting and lockout, multi-factor authentication, and reset tokens that are random, single-use and short-lived.

Cross-site request forgery (CSRF)

A page on another site silently submits a state-changing request to an app you're logged into, riding your session cookie. The labs showed how missing, predictable or improperly validated anti-CSRF tokens open the door.

Fix: anti-CSRF tokens tied to the session, SameSite cookies (Lax or Strict), and re-authentication for the highest-impact actions.

What carried over

The same root cause runs through most of them: the server trusting something it didn't verify, a query built from input, an object ID, a destination URL, a request's origin. The labs were an attacker's lens on problems I review from the defender's side, and doing the exploit by hand made the fixes feel less like checklist items and more like the obvious answer.

More writing