Skip to content
XSS Disclosed report Beginner

text injection can be used in phishing 404 page should not include attacker text

The 404 page reflected attacker-controlled text from the URL path back into the response body. An attacker could craft a link that displays misleading text and an external link on the victim site's own domain, which could be used for phishing.

djamel-ghorab Follow

Originally disclosed on HackerOne

Bounty$250 View original
  • Triaged in 3 days
  • Fixed in 10 days
  • Paid in 10 days
  • Disclosed after 25 days

Hello i want to report a text injection and a missconfiguration of the 404 page which can be used in phishing

the bug exists at :

https://withinsecurity.com/test/%2f../It%20has%20been%20changed%20by%20a%20new%20one%20https://www.crowdcurity.com%20so%20go%20to%20the%20new%20one%20since%20this%20one

as you can see attacker text is included "It has been changed by a new one https://www.crowdcurity.com so go to the new one since this one was not found on this server."

Fix : just use a 404 page that don't include attacker text just as : hackerone do (a 404 page that don't include any externel text hope you fix it thanks

The original report as published on HackerOne, by djamel-ghorab. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 4 min read.

What the report shows

The target is the Within Security site, and the feature under scrutiny is its 404 handler. The researcher reports two related issues: a text injection and a misconfiguration of the 404 page, which together can be used in phishing.

The bug is demonstrated at this URL:

Text
https://withinsecurity.com/test/%2f../It%20has%20been%20changed%20by%20a%20new%20one%20https://www.crowdcurity.com%20so%20go%20to%20the%20new%20one%20since%20this%20one

The researcher quotes the injected sentence as it appears on the page:

Text
It has been changed by a new one https://www.crowdcurity.com so go to the new one since this one was not found on this server.

The path segment after /test/ contains a URL-encoded slash (%2f), a .. traversal sequence, and then a long encoded string that decodes to the sentence above. The effect is that the requested path is reflected into the body of the 404 page, so the page displays text the attacker chose, including a URL to another domain.

The researcher's proposed fix is to use a 404 page that does not include attacker text, citing HackerOne's 404 page as an example of one that includes no external text.

The report was disclosed on 16 January 2016, was classified as a violation of secure design principles, and paid a bounty of 250.00 USD. No severity or CVSS score is given.

Root cause

The 404 page includes part of the request path in its response. Because the path is attacker-controlled, any text placed in the URL appears in the rendered page. The payload uses an encoded slash and a .. segment before the reflected text.

Impact

As the researcher frames it, the reflected text can be used in phishing: an attacker can craft a link on the legitimate domain whose 404 page displays a message of the attacker's choosing, including a link to a different site. The page is served from the trusted host while displaying text that directs the reader elsewhere. The report does not demonstrate script execution or any impact beyond the reflected text.

How this kind of bug works

Reflected content bugs arise when an application takes input from the request and places it into a response without encoding or validation. In a 404 handler the input is usually the requested path or a query parameter, and the handler is often written quickly, with the assumption that a not-found page is harmless. That assumption is what fails: the page is still served from the trusted origin, so any text or markup it reflects inherits that trust.

When the reflected value is HTML-encoded, the result is limited to text injection, which is mainly useful for social engineering. When it is not encoded, the same flaw becomes reflected cross-site scripting. The report frames the issue as phishing rather than script execution.

The defences are output encoding appropriate to the context, avoiding reflection of raw request data in error pages, and serving generic error pages that contain no request-derived content.

How to test for it

  1. Identify endpoints that echo request data: error pages, search results, redirect notices, and any handler that mentions the requested resource.
  2. Send a request whose path or parameter contains a unique, harmless marker string, for example a distinctive word, and inspect the response body for that marker.
  3. If the marker appears, check how it is encoded. Look at whether angle brackets, quotes and ampersands are converted to entities.
  4. Try path tricks such as encoded slashes and dot segments to see whether the marker survives routing and normalisation into the output.
  5. Confirm whether markup is interpreted by the browser, which would raise the finding from text injection to XSS.

A positive result is the marker appearing verbatim in the response, ideally in a context where it can influence what the user reads or clicks. Common false positives are markers that appear only inside an encoded attribute, inside a JSON body served with a non-HTML content type, or in a response that is not rendered to users. Also check that the reflection is not simply the browser echoing the URL in the address bar.

How it is fixed

Serve a static, generic 404 page that contains no request-derived content. Where the requested path must be shown for usability, HTML-encode it for the output context and strip or reject control characters and path traversal sequences. Apply the same encoding to any other error or status page that reflects input, and review redirect and search handlers for the same pattern.

Hunting notes

Error handlers are a common hiding place because they are rarely reviewed and often built by copying the request into a template. Look at 404, 403, 500 and maintenance pages, custom routers, and frameworks that render the requested path in a "not found" message. Recon signals include verbose error pages, framework-specific 404 templates, and any response that repeats part of the URL.

Keep the payload benign, and state clearly whether markup is interpreted, since that determines whether the issue is text injection or XSS.

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 6 min read.

What happened, in plain words

This report is about the website withinsecurity.com, and specifically about what the site shows when someone asks for a page that does not exist. That page is called a 404 page, after the standard HTTP status code for "not found". Think of it like a shop assistant who, when asked for an item the shop does not stock, reads your request back to you out loud. If the assistant repeats whatever you said, you can make them say anything you like.

The researcher found that the 404 page on withinsecurity.com included the crafted address in its response. Because the visitor controls the address, the visitor controls the text that appears on the page. The researcher showed this with a single link:

Text
https://withinsecurity.com/test/%2f../It%20has%20been%20changed%20by%20a%20new%20one%20https://www.crowdcurity.com%20so%20go%20to%20the%20new%20one%20since%20this%20one

Reading that link from left to right:

  • https://withinsecurity.com is the trusted site. This is the part a visitor sees in the address bar.
  • /test/ is an ordinary folder-like path on the site.
  • %2f is the URL-encoded form of a forward slash /.
  • .. is the standard way to mean "go up one folder". In file paths it is used to climb out of a directory. Here it appears in the crafted path before the reflected text.
  • The long string after that is the attacker's sentence, written in URL encoding. %20 is a space, so It%20has%20been%20changed decodes to It has been changed.

When that address is requested, the 404 page comes back with the attacker's sentence in it. The researcher quotes the sentence as it appeared on the page:

Text
It has been changed by a new one https://www.crowdcurity.com so go to the new one since this one was not found on this server.

That sentence contains a URL to another domain. The page is still served from withinsecurity.com, so the address bar shows the trusted name while the body of the page tells the visitor to go somewhere else. The page is served from withinsecurity.com while the body contains text chosen by the requester.

The researcher describes this as two related problems: a text injection, meaning attacker-chosen text placed into a page, and a misconfiguration of the 404 page, meaning the page was built in a way that allows this. The suggested fix is simple: use a 404 page that does not include any text from the request, and the researcher points to HackerOne's 404 page as an example that contains no external text.

The report was disclosed on 16 January 2016, was classified as a violation of secure design principles, and paid a bounty of 250.00 USD. No severity or CVSS score is given.

In general, how this kind of bug works

Many web pages are built by taking something from the request and putting it into the response. A search page shows your search words back to you. A login error says "the account [name] does not exist". A 404 page says "we could not find [the address you asked for]". This is convenient, but it means the page is partly written by whoever sent the request.

A request is simply the message your browser sends to a server when you open a link or submit a form. It contains the address you want, and often extra data such as cookies. A cookie is a small piece of data a site stores in your browser so it can recognise you on the next request, like a cloakroom ticket. None of that matters for this bug, but it helps to know that the address is just one field in a message the visitor fully controls.

When a page puts request data into its output without cleaning it, the result is called reflected content, because the input is bounced straight back. If the data is turned into safe text before being placed on the page, the worst an attacker can do is choose the words the victim reads. That is text injection, and it is mainly useful for social engineering: tricking a person into trusting a message or clicking a link. If the data is placed into the page as raw markup, the browser may treat it as part of the page's structure, and the same flaw becomes cross-site scripting, usually shortened to XSS, where attacker code runs in the victim's browser. The report talks about phishing rather than code execution.

A 404 page is a common place for this mistake because it is written quickly and rarely reviewed. The developer assumes a "not found" page is harmless, so they paste the requested address into the message without thinking about who controls it. But the page is still served from the trusted domain, so any text on it inherits that trust.

The defences are straightforward. Error pages should be generic and contain nothing taken from the request. Where the requested address really must be shown, for example to help a user spot a typo, it should be encoded for the place it appears, so that characters like <, > and & are turned into harmless entities rather than being treated as markup. Path tricks such as encoded slashes and .. segments should be rejected or normalised before anything is displayed. The same review should cover other error and status pages, redirect notices and search results, because they often share the same pattern.

Glossary

  • 404 page: the page a website shows when the requested address does not match anything on the server. The name comes from the HTTP status code 404, meaning "not found".
  • HTTP status code: a three-digit number a server sends with every response to say broadly what happened, such as 200 for success or 404 for not found.
  • Request: the message a browser sends to a server asking for a page or other resource.
  • Response: the message a server sends back, containing the page or data and the status code.
  • URL: the address of a resource on the web, such as https://withinsecurity.com/test/.
  • URL encoding: a way of writing characters that are not allowed or are ambiguous in a URL, using a percent sign and two hexadecimal digits. %20 means a space and %2f means a forward slash.
  • Path: the part of a URL after the domain name, such as /test/.
  • Path traversal: using .. segments in a path to climb out of the intended folder, for example ../.
  • Text injection: placing attacker-chosen text into a page so that it appears as part of the site's own content.
  • Reflected content: request data that is placed back into the response without being stored, so it appears only for that one request.
  • Cross-site scripting (XSS): a flaw where attacker-supplied markup or code is placed into a page and runs in the victim's browser.
  • Phishing: tricking someone into trusting a message or link, often to steal information or send them to another site.
  • Social engineering: manipulating a person rather than a machine, for example by making a message look trustworthy.
  • Output encoding: converting characters in data so they are displayed as text rather than interpreted as markup or code.
  • Cookie: a small piece of data a site stores in the browser to recognise a visitor across requests.
  • Domain: the name of a site, such as withinsecurity.com, which appears in the address bar.
  • Bounty: a payment made by a company to a researcher who reports a security problem.
  • CVSS: a standard scoring system for rating the severity of a security issue. This report gives no score.
  • Violation of secure design principles: a category for flaws where the design of a feature, rather than a coding slip, creates the weakness.

More by djamel-ghorab

View all

1 more disclosed report, best first.

More from withinsecurity

View all

The newest disclosed reports for this program.

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.