← All lessons Stage 0 · Lesson 5
10 min

How to read a URL like an attacker

Stage 0 · Lesson 5 · 10 minutes · Requires Lessons 1–4


The one-line answer

A URL is not one thing — it's six parts, and each part is something a user controls and a server has to trust carefully.


Why you should care

Beginners see a URL as an address. Attackers see a form with six fields, all editable.

Almost every web bug you'll learn starts with changing one part of a URL and seeing what happens. Read URLs fluently and you'll spot possibilities that others walk past.


How it actually works

Here's a URL with every component present:

https://user:[email protected]:8443/products/view?id=42&sort=price#reviews

Broken down:

PartValueWhat it is
SchemehttpsProtocol to use
Credentialsuser:pass@Rarely used, often abusable
Hostshop.example.comWhich server (see Lesson 4)
Port:8443Which door (see Lesson 2)
Path/products/viewWhich resource
Query?id=42&sort=priceParameters
Fragment#reviewsPosition on page

The query string

This is where most of the action is.

?id=42&sort=price&debug=false
  • ? starts the query string
  • & separates parameters
  • Each parameter is name=value

Three parameters here: id, sort, debug. All three are sent to the server. All three can be changed to anything.

Look at debug=false and think for a moment. What might debug=true do?

The fragment is different

Everything after # is never sent to the server. It's handled entirely by the browser.

That matters enormously. If a page puts fragment content into the DOM, the resulting vulnerability — DOM-based XSS — never appears in server logs. The server genuinely never saw the payload. This is why some attacks are invisible to backend monitoring.

URL encoding

Some characters can't appear literally in a URL, so they're percent-encoded:

CharacterEncoded
space%20
/%2F
?%3F
#%23
&%26
<%3C
'%27

Encoding is a bypass technique in itself. A filter blocking ../ might miss %2e%2e%2f. A filter blocking <script> might miss %3Cscript%3E. Double encoding (%252e) defeats systems that decode only once.

Paths reveal structure

/api/v1/users/42/orders

Read that carefully. There's an API, it's versioned, there's a users collection, user 42, and their orders.

Immediate questions: does /api/v1/users/43/orders work? Does /api/v2/ exist? What about /api/v1/users/ with no ID — does it list everyone?

That's how recon actually feels.


See it yourself

Read a real URL. Go to any e-commerce site, search for something, and look at the URL. Identify the host, path, and every parameter. What does each one appear to control?

Change a parameter. On a site you own or a public search engine, find a numeric parameter and change it. Observe what happens.

Try encoding. Search for hello world and look at the URL — the space became %20 or +.

Inspect the fragment. Visit a long Wikipedia article, click a table-of-contents link, and watch the URL gain a #section without the page reloading. No request was made.

Boundary: Reading and understanding URLs is always fine. Changing parameters on systems you don't own to access other people's data is unauthorised access — a criminal offence, even if it's technically easy. Practise on our labs. Lesson 9 covers this properly.


How attackers abuse this

IDOR via path or query. /invoice?id=1043 shows your invoice. id=1044 shows someone else's. If the server checks that you're logged in but never checks whose invoice it is, that's Insecure Direct Object Reference — extremely common, often high severity.

Hidden parameters. debug=true, admin=1, test=1 — parameters left in by developers and never removed. Tools brute-force parameter names precisely because this works often enough to be worth trying.

Path traversal. ?file=report.pdf becomes ?file=../../../../etc/passwd. If the server naively joins that to a directory path, you're reading arbitrary system files.

Open redirect. ?next=/dashboard becomes ?next=https://evil.com. The user clicks a link on a domain they trust and lands somewhere they don't. This is a phishing enabler and it's frequently found.

SSRF via URL parameters. ?url=https://api.partner.com becomes ?url=http://169.254.169.254/latest/meta-data/. That address is the AWS metadata service — reachable only from inside the cloud instance. If the server fetches whatever URL you give it, you can make it fetch its own credentials.

Host header and credential confusion. https://[email protected] — everything before the @ is treated as credentials. Many users read the beginning of the URL and stop.


Common mistakes

"POST is more secure than GET." POST parameters aren't visible in the URL bar or server logs, which is better for sensitive values. But they're equally editable by anyone using developer tools or a proxy. Both need server-side validation.

"Long random IDs are safe." A UUID is much harder to guess than 42, and that genuinely helps. But it isn't authorisation. If the ID leaks — in an email, a shared link, a referrer header — access is granted. Obscurity is not a permission check.

"The fragment is part of the request." It isn't. Server-side filtering can never see it.


Check yourself

  1. In https://app.example.com/report?id=7&format=pdf#top, which part never reaches the server?
  2. You find ?redirect=/home. What's the first thing worth testing, and why does it matter?
  3. Why might %2e%2e%2f succeed where ../ is blocked?
Answers
  1. #top — the fragment. It's handled entirely by the browser and is never transmitted in the HTTP request.
  2. Change it to an external domain: ?redirect=https://evil.com. If the application sends you there, it's an open redirect — attackers use it to make phishing links that begin with a trusted domain, which dramatically increases click-through.
  3. %2e%2e%2f is the URL-encoded form of ../. A filter that inspects the raw string before decoding won't recognise it, but the server decodes it afterwards and processes it as traversal. Filtering before decoding is a classic ordering mistake.

Your lab

Challenge 02 — Read a URL like an attacker

You'll be given a URL with several parameters. Work out what each does, and identify the one that shouldn't be under user control.

→ Open Stage 0 labs


Summary in your language

தமிழ் சுருக்கம் (Tamil summary)

URL-ஐ எப்படி படிப்பது?

ஒரு URL என்பது வெறும் முகவரி அல்ல — அதில் ஆறு பகுதிகள் உள்ளன, ஒவ்வொன்றையும் பயனாளர் மாற்ற முடியும்.

https://shop.example.com:8443/products?id=42#reviews
  • https — scheme (protocol)
  • shop.example.com — host (எந்த server)
  • :8443 — port (எந்த கதவு)
  • /products — path (எந்த பக்கம்)
  • ?id=42 — query parameter (இங்கே தான் பெரும்பாலான bugs இருக்கும்)
  • #reviews — fragment (இது server-க்கு அனுப்பப்படுவதே இல்லை)

முக்கிய புள்ளி:

?id=42 என்பதை ?id=43 என்று மாற்றினால் என்ன ஆகும்? server சரியாக சோதிக்கவில்லை என்றால், வேறொருவரின் தகவல் தெரியும். இதற்கு IDOR என்று பெயர் — மிக அதிகமாக காணப்படும் பாதுகாப்பு குறைபாடு.

எச்சரிக்கை: உங்களுக்கு சொந்தமில்லாத website-களில் parameter-களை மாற்றி மற்றவர்களின் தகவலைப் பார்ப்பது சட்டவிரோதமான செயல் — எளிதாக இருந்தாலும். எங்கள் labs-ல் மட்டும் பயிற்சி செய்யுங்கள்.

हिंदी सारांश (Hindi summary)

URL को कैसे पढ़ें?

URL सिर्फ़ एक पता नहीं है — इसमें छह हिस्से होते हैं, और हर हिस्से को user बदल सकता है।

https://shop.example.com:8443/products?id=42#reviews
  • https — scheme (protocol)
  • shop.example.com — host (कौन सा server)
  • :8443 — port (कौन सा दरवाज़ा)
  • /products — path (कौन सा पेज)
  • ?id=42 — query parameter (यहीं सबसे ज़्यादा bugs मिलते हैं)
  • #reviews — fragment (यह server तक जाता ही नहीं)

मुख्य बात:

अगर ?id=42 को बदलकर ?id=43 कर दें तो क्या होगा? अगर server ठीक से जाँच नहीं करता, तो किसी और की जानकारी दिख जाएगी। इसे IDOR कहते हैं — यह सबसे आम गंभीर bug है।

चेतावनी: जो website आपकी नहीं है, उसमें parameter बदलकर दूसरों का data देखना क़ानूनी अपराध है — भले ही करना आसान हो। सिर्फ़ हमारे labs में अभ्यास करें।

Want this summary in Malayalam, Telugu, Kannada or another language? Tell us — the most requested languages get added next.


What's next

You've seen %20 and %2e. Time to clear up the biggest confusion in all of beginner security: the difference between encoding, encryption and hashing.

→ Lesson 6: Encoding vs encryption vs hashing