Skip to content
XSS Write-up Beginner

One Overlooked Query Parameter: How a Single Line of Unsanitized Input Can Undo a Platform’s Entire…

A search parameter on a job-search platform reflected user input into the page and browser tab title without encoding, allowing script execution. An attacker could craft a link that runs code in a victim's browser, potentially stealing session cookies or performing actions as the victim.

mohammad.ehab7760 Follow

Published on medium.com

Cybersecurity

Mohammed Ehab, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 5 min read.

Context

The target was a public job-search platform used by startups and job seekers. The feature involved is the site's search: a query parameter in the URL that looked too trusting of whatever was typed into it. In this case the reflected value also reached the browser tab's title, not only the visible body content.

The author is a penetration tester, and the finding came out of ordinary use of the site rather than a dedicated assessment. The platform is not named, and neither its URL nor the exact payload is published, because the report was still under review at the time of writing.

Setup

No accounts, roles, tooling or versions are described. The researcher was browsing listings on the live site, filtering by location and skimming postings, when the search parameter in the URL bar drew attention. There was no custom tooling, no bypass chain and no prior research involved: the precondition was simply a browser and a search field whose value is echoed back into the page.

Finding it

While scrolling through listings, the researcher noticed a search parameter in the URL that looked too trusting of whatever was typed into it. Typing into it produced a JavaScript alert box in the browser. That showed the browser had executed script that arrived through the search field.

A second, related weak point turned up while exploring the platform further: a user-facing profile field that appeared to store special characters without proper sanitisation either. The report presents this as an observation, not as a demonstrated exploit, and gives no field name, request or response for it. The researcher's reading is that two independent findings pointing at the same gap suggests input handling was not treated as a first-class security concern across the codebase, rather than being a problem in one form.

Exploitation

Step 1: identify the reflected parameter

The starting point was the search parameter visible in the URL bar while filtering listings. The core issue is that a value typed into a search field gets echoed back into the page, including the browser tab's title, without special characters being encoded first.

Step 2: submit a value that the browser treats as markup

Typing a crafted value into the search field caused a JavaScript alert box to appear. The report does not publish the payload, the parameter name or the full URL, so the exact request cannot be reproduced from this write-up. What the result establishes is that the browser executed script that arrived through the search field.

Step 3: note the second weak point

While digging around the platform, the researcher observed a user-facing profile field that appeared to store special characters without proper sanitisation. No reproduction steps or evidence are given for this one; it is recorded as a related observation consistent with the same underlying input-handling gap.

Root cause

The core issue is reflected cross-site scripting. A value the user supplies is echoed back into the page, in the visible content and in the browser tab's title, without the platform encoding special characters like <, >, or " first. A browser normally treats those characters as inert text; when a server reflects them back unescaped, the browser interprets them as live HTML and JavaScript instead. One crafted link is then enough to make a victim's browser execute code that came from someone else while still believing it came from the trusted site.

The report does not describe the server-side code, the templating layer or any filter that was present and failed. The researcher's reading is that two independent findings pointing at the same gap suggests input handling was not treated as a first-class security concern across the codebase.

Impact

An alert() is a proof of concept, not the attack. The report sets out what the same injection point could be used for in the hands of someone with different intentions:

  • Stealing session cookies or authentication tokens, especially where they are not protected with the HttpOnly flag, turning a single clicked link into a full account takeover.
  • Performing actions on behalf of the victim without their knowledge, such as editing content, submitting forms or triggering account changes silently in the background.
  • Overlaying a convincing fake login form on a page the user already trusts, to harvest credentials directly.
  • Silently redirecting victims to phishing pages or malware while the address bar still shows the legitimate domain.

These outcomes depend on the victim opening a crafted link and clicking it. Reflected XSS is consistently rated as a serious, sometimes critical, vulnerability class, precisely because it needs only a crafted link and a click, and because it breaks the browser's origin-based trust model from the inside.

Fix

The researcher's remediation guidance covered three points: output encoding, a stricter Content-Security-Policy, and hardened cookie flags. The report does not say whether any of these were applied; at the time of writing the report was still under review. The author's advice to builders is that output encoding has to be the default behaviour for anything user-controlled, not something bolted on later, and that every place user input touches rendered HTML is a potential injection point: a search box, a profile name, a comment field, even a page title.

Variants to test

  • Search and filter parameters. Submit a value containing <, >, and " and check whether it comes back unencoded in the response body. A positive result is the characters appearing verbatim in the HTML source rather than as entities.
  • Reflection into the document title. Check whether the parameter also lands inside <title>. A positive result is the injected markup appearing in the title element, which is easy to overlook when reviewing only the body.
  • Profile and account fields. Set a display name or similar user-facing field to a value containing special characters and view the profile as another user. A positive result is the stored value rendering as markup rather than text.
  • Cookie flags. Where an injection is confirmed, check whether session cookies carry HttpOnly. A positive result for an attacker is a session cookie readable from document.cookie.
  • Content-Security-Policy. Inspect the response headers for a policy that would block inline script. A positive result for an attacker is the absence of a policy, or one permissive enough to allow the reflected payload to run.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 16 min read.

What happened, in plain words

A security tester was looking for a job. Not testing anything, not running any special software, just scrolling through listings on a public job-search website used by startups and people looking for work. While filtering listings by location and skimming postings, he noticed something in the address bar of his browser: the search parameter in the web address carried whatever was typed into it.

That is normal for many websites. What is not normal is what happened next. He typed something into that search field, and a small JavaScript alert box popped up on the screen. An alert box is the little grey dialogue a website can show you with a message and an OK button. It is harmless in itself, but the fact that it appeared at all meant something important: the browser had executed script that arrived through the search field, as if it were part of the website's own instructions. That is a security hole, and it has a name: reflected cross-site scripting, usually shortened to reflected XSS.

He then looked around the site a little more and noticed a second, related weak spot: a profile field that visitors fill in themselves, which seemed to store special characters without cleaning them up either. He did not demonstrate an attack through that field; he just observed it. Two weak spots pointing at the same underlying habit suggested the problem was not one careless form but a general approach to handling what users type.

He stopped at the alert box. He did not try to steal anything, break into an account or take data. He wrote up what he found, with reproduction steps, an honest assessment of what could go wrong, and advice on how to fix it, and sent it to the platform's support team asking for it to reach whoever handles security. At the time of writing the report was still under review, which is why the article does not name the platform, give its address, or publish the exact text he typed. Publishing a working attack for a hole that is not fixed yet would just hand it to whoever reads it first.

This article walks through the same story from the beginning, explaining every term as it comes up, for someone who has never done security work before.

The setting: what the site is and what the feature does

The target was a public job-search platform, a website where startups post job openings and job seekers browse them. The feature involved is the site's search. You have used search boxes on websites many times: you type a word, press Enter or click a button, and the site shows you matching results.

There is a detail about how such searches usually work that matters here. When you type into a search box and submit, the browser often puts your words into the web address, the URL, as part of the link. The part after the question mark in a URL is called the query string, and each named piece of it is a query parameter. For example, a search for "designer" might produce an address ending in something like ?q=designer. The q is the parameter name and designer is its value. This lets you bookmark a search or share a link to it: the site reads the value out of the address and runs the search again.

To show you your results, the site takes that value and places it into the page it sends back to your browser. That is called reflection: your input is echoed back to you. Normally that is fine and useful, because you want to see what you searched for. The problem starts when a site echoes a value back without encoding special characters first; the report describes this as the core issue, including reflection into the browser tab's title.

The author is a penetration tester, someone paid to try to break into websites and software with permission, so that the owners can fix the holes before criminals find them. This particular finding did not come from a paid assessment or a planned test. It came from ordinary use of the site.

The platform is not named, and neither its address nor the exact text he typed is published, because the report was still under review when he wrote the article.

Setup: what was needed to find it

Almost nothing. No accounts, no special roles, no tools, no software versions are described. The researcher was browsing listings on the live site, filtering by location and skimming postings, when the search parameter in the address bar drew his attention. There was no custom tooling, no clever chain of tricks to get past defences, and no prior research involved. The only precondition was a browser and a search field whose value is echoed back into the page.

This is worth pausing on for a beginner. Security findings are often imagined as requiring exotic skills. Many real ones, including this one, require only curiosity about what a normal feature does with what you give it.

Finding it

Step 1: notice the parameter

While scrolling through listings, the researcher noticed a search parameter in the URL that looked too trusting of whatever was typed into it. "Too trusting" is the key phrase. A website that trusts its input assumes that whatever arrives in a parameter is ordinary text a normal visitor would type. A website that does not trust its input assumes the value could be anything at all, including characters that mean something special to a browser, and handles it accordingly.

Why look at the address bar at all? Because the address bar shows you, in plain sight, exactly what the site is receiving from you. If your words appear there, the site is reading them from the link, and the next question is what it does with them when it builds the page.

Step 2: type something and watch what comes back

He typed a crafted value into the search field, and a JavaScript alert box appeared in the browser. That showed the browser had executed script that arrived through the search field.

What does "interpreted as live markup" mean? A web page is written in a language called HTML. HTML is made of text plus special instructions in angle brackets, called tags, which tell the browser how to display things: this is a heading, this is a paragraph, this is a button. When a browser receives a page, it reads the HTML and follows the instructions. Ordinary text in the page is just shown to you. But if text contains characters that look like HTML, such as <, > or ", the browser may treat them as instructions rather than as letters on the screen.

That is the whole trick behind cross-site scripting. If a site takes your input and drops it into the page without encoding it, the browser cannot tell your text apart from the site's own instructions. Encoding means converting special characters into safe stand-ins, so that a < is displayed as a < character rather than starting a tag. When encoding is missing, your text becomes part of the page's code, and code can do things: show an alert, read data, send requests.

The report does not publish the payload (the crafted text he typed), the parameter name, or the full URL, so the exact request cannot be reproduced from the write-up. What the result establishes is that the browser executed script that arrived through the search field, in the context of the legitimate origin. "Origin" here means the site's identity as the browser sees it: its scheme, its domain and its port. Code running in a page's origin is treated by the browser as coming from that site, with all the trust that implies.

Why does the alert box matter if it does nothing harmful? Because it is proof. It shows that the browser executed code that arrived through the search field. Once you can make the browser run one instruction, you can, in principle, make it run others. The alert is the smallest possible demonstration that the door is open.

Step 3: note the second weak point

While digging around the platform further, the researcher observed a user-facing profile field that appeared to store special characters without proper sanitisation. A profile field is something like a display name or a short bio that a user fills in and that other people can see. Sanitisation means cleaning input so that dangerous characters cannot do anything harmful, either by encoding them or by rejecting them.

No reproduction steps or evidence are given for this one. It is recorded as a related observation, consistent with the same underlying input-handling gap. The researcher's reading is that two independent findings pointing at the same gap suggests input handling was not treated as a first-class security concern across the codebase, rather than being a problem in one form. In plain terms: if two different parts of a site make the same mistake, the mistake is probably in how the team builds things in general, not in one page.

Why "just an alert box" is never just an alert box

An alert box looks harmless, almost like a party trick. But it is a proof of concept, not the actual attack. A proof of concept is a small, safe demonstration that a hole exists. In the hands of someone with different intentions, the same injection point could instead be used to do real damage. The report lists four examples.

  1. Steal session cookies or authentication tokens. A cookie is a small piece of data a website asks your browser to store and send back with every request to that site. It is how a site remembers that you are logged in: after you sign in, the site gives your browser a cookie, and on each later visit the browser presents it, like a wristband at an event that proves you already paid. A session cookie is the specific cookie that proves who you are. An authentication token is a similar idea in a different form, a string that stands in for your login. If a script running in the page can read that cookie, it can send it to an attacker, who can then use it to act as you. The HttpOnly flag is a setting on a cookie that tells the browser: never let page scripts read this one. It is like keeping the wristband under your sleeve where only the door staff can see it. Without that flag, a script can read the cookie, and a single clicked link becomes a full account takeover, meaning the attacker gets control of your account.

  2. Perform actions on behalf of the victim without their knowledge. Because the script runs inside a page from the trusted site, and the browser sends your cookies along with requests made from that page, the script can do things you could do: edit content, submit forms, or trigger account changes silently in the background. You would see nothing.

  3. Overlay a convincing fake login form on top of a page the user already trusts. A script can draw new elements on the page. It could cover the real page with a login box that looks exactly like the site's own, and when you type your username and password, they go to the attacker. This is called phishing: tricking someone into handing over credentials on a page that looks genuine. Credentials means your username and password.

  4. Silently redirect victims to phishing pages or malware while the address bar still shows the legitimate domain. A script can send your browser somewhere else. Malware is harmful software. The address bar showing the real site is what makes this convincing: you glance up, see the familiar name, and trust what is on screen.

These outcomes depend on the victim opening a crafted link and clicking it. Reflected XSS is consistently rated as a serious, sometimes critical, vulnerability class, precisely because it needs only a crafted link and a click, and because it breaks the browser's origin-based trust model from the inside. That trust model is the browser's central security idea: content from one site should not be able to act as another site. Reflected XSS gets around it not by fooling the browser about which site it is on, but by putting the attacker's instructions inside the trusted site's own page.

The disclosure

Disclosure is the process of telling the people who own a system about a hole you found. Responsible disclosure means doing it privately, giving them time to fix it, and not publishing details that would let others exploit it in the meantime. The researcher did what responsible disclosure is supposed to look like: he stopped at proof of concept. No session hijacking (using someone else's session to act as them), no data exfiltration (copying data out), no attempts to pivot the finding into something bigger than it needed to be to prove impact.

He documented four things:

  1. The technical root cause, meaning the underlying reason the hole exists.
  2. Step-by-step reproduction instructions, so the owners could see it for themselves.
  3. A realistic assessment of business impact, meaning what harm could actually come of it.
  4. Concrete remediation guidance, meaning specific fixes: output encoding, a stricter Content-Security-Policy, and hardened cookie flags.

Those three fixes deserve a plain explanation, because they are the practical heart of the article.

  • Output encoding means, whenever the site places user input into a page, converting special characters into safe stand-ins so the browser shows them as text instead of treating them as instructions. "Output" here means the page the site sends out; "encoding" means the conversion.
  • Content-Security-Policy is a set of instructions a site can send to the browser in its response headers, saying which sources of script are allowed to run. Response headers are small pieces of information sent alongside the page, before its content. A strict policy can block inline script, meaning script written directly inside the page, which is exactly the kind of script a reflected XSS payload produces. It is a second lock on the door, useful even when the first one fails.
  • Hardened cookie flags means setting cookies' protective options, such as HttpOnly, so that scripts cannot read them.

He sent the full report directly to the platform's support team, requesting it be routed to whoever owns security there. At the time of writing, the report was still under review, which is exactly why the platform's name, its URL and the exact payload do not appear in the article. Publishing exploit-ready details for a vulnerability that has not been fixed yet does not help anyone; it just hands a working attack to whoever reads it first. If and when the issue is resolved, that is a conversation for a different, more detailed follow-up.

The lesson, for builders and breakers alike

For people building web applications: never trust a "we'll just skip it, it's a small field" moment. Every place user input touches your rendered HTML is a potential injection point: a search box, a profile name, a comment field, even something as unassuming as a page title. Output encoding is not a nice-to-have bolted on later; it has to be the default behaviour for anything user-controlled.

For people breaking web applications, for a living or for fun and responsibly: do not underestimate the boring-looking parameters. Some of the most impactful findings the author has come across did not need custom tooling or novel research. They needed someone to actually look at what a query parameter does with what you give it.

Sometimes the most dangerous line of code is not the one doing something complex. It is the one that was never told not to trust you.

Variants to test

If you want to look for the same class of problem on sites you are authorised to test, the technical write-up lists these checks. Each one is described with what a positive result looks like.

  • Search and filter parameters. Submit a value containing <, >, and " and check whether it comes back unencoded in the response body. The response body is the page content the server sends back. A positive result is the characters appearing verbatim in the HTML source rather than as entities. Entities are the encoded stand-ins, such as &lt; for <. You can see the HTML source in most browsers by viewing the page source.
  • Reflection into the document title. Check whether the parameter also lands inside <title>, the HTML element that sets the browser tab's text. A positive result is the injected markup appearing in the title element, which is easy to overlook when reviewing only the body.
  • Profile and account fields. Set a display name or similar user-facing field to a value containing special characters and view the profile as another user. A positive result is the stored value rendering as markup rather than text.
  • Cookie flags. Where an injection is confirmed, check whether session cookies carry HttpOnly. A positive result for an attacker is a session cookie readable from document.cookie. document.cookie is the browser feature that lets a page's script read the cookies available to it.
  • Content-Security-Policy. Inspect the response headers for a policy that would block inline script. A positive result for an attacker is the absence of a policy, or one permissive enough to allow the reflected payload to run.

Glossary

  • Alert box: a small pop-up dialogue a web page can show with a message and an OK button; often used as the simplest proof that script can run.
  • Authentication token: a string that stands in for a login, so a site can recognise a signed-in user without asking for the password every time.
  • Browser: the program you use to view websites, such as Chrome, Firefox or Safari.
  • Content-Security-Policy: instructions a site sends to the browser saying which sources of script are allowed to run, used as a second line of defence against injected script.
  • Cookie: a small piece of data a site asks your browser to store and send back with later requests, commonly used to remember that you are logged in.
  • Credentials: a username and password, or similar proof of identity.
  • Cross-site scripting (XSS): a class of vulnerability where a site lets an attacker's text become part of its own page code, so the browser runs it as if the site had written it.
  • Data exfiltration: copying data out of a system without permission.
  • Disclosure: telling the owners of a system about a security hole you found.
  • document.cookie: the browser feature that lets a page's script read the cookies available to it.
  • Encoding (output encoding): converting special characters into safe stand-ins so the browser displays them as text instead of treating them as instructions.
  • Entities: the encoded stand-ins for special characters in HTML, such as &lt; for <.
  • HTML: the language web pages are written in, made of text plus instructions in angle brackets called tags.
  • HttpOnly: a cookie setting that stops page scripts from reading that cookie.
  • Impact: the harm that could realistically result from a vulnerability.
  • Injection point: any place where input from a user reaches the page the site builds, and could therefore be interpreted as code.
  • Inline script: script written directly inside a page rather than loaded from a separate file; the kind a reflected XSS payload produces.
  • Malware: harmful software.
  • Markup: the tags and instructions in a page that tell the browser how to display things.
  • Origin: a site's identity as the browser sees it, made of its scheme, domain and port; content from one origin is trusted to act only for that origin.
  • Parameter (query parameter): a named value in a URL's query string, the part after the question mark, such as q in ?q=designer.
  • Payload: the crafted text an attacker submits to trigger a vulnerability.
  • Penetration tester: someone who tries to break into systems with permission, so the owners can fix the holes first.
  • Phishing: tricking someone into handing over information, such as a password, on a page that looks genuine.
  • Proof of concept: a small, safe demonstration that a vulnerability exists.
  • Query string: the part of a URL after the question mark that carries parameters.
  • Reflected XSS: cross-site scripting where the attacker's input is echoed straight back into the page in response to a request, typically via a crafted link.
  • Reflection: a site echoing a value you supplied back into the page it sends you.
  • Remediation: the fix for a vulnerability.
  • Response body: the page content a server sends back to the browser.
  • Response headers: small pieces of information sent alongside a page, before its content, such as cookie settings and security policies.
  • Responsible disclosure: reporting a hole privately, giving the owners time to fix it, and not publishing details that would let others exploit it meanwhile.
  • Root cause: the underlying reason a vulnerability exists.
  • Sanitisation: cleaning input so dangerous characters cannot do anything harmful.
  • Session cookie: the cookie that proves who you are while you are signed in.
  • Session hijacking: using someone else's session to act as them.
  • Tags: the instructions in angle brackets in HTML that tell the browser how to display content.
  • Title (document title): the HTML element that sets the text shown on the browser tab.
  • URL: the address of a page or resource on the web.
  • Vulnerability: a weakness in a system that could be used to cause harm.

More by mohammad.ehab7760

View all

1 more disclosed report, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.