Skip to content
Related Articles

Related Articles

Same Site Scripting

Improve Article
Save Article
  • Difficulty Level : Hard
  • Last Updated : 22 Sep, 2020
Improve Article
Save Article

Same Site Scripting is type of vulnerability that is caused by common DNS misconfiguration. But before we dive deep into concepts, let’s make sure we have basic understanding of how Internet works.

Working of the web :
When you try to visit website, your browser communicates with web server where that website’s hosted by using IP (internet protocol). IP uses IP addresses to access these servers.

Here’s basic interpretation of how process of visiting website works as following

  1. You try to visit
  2. The browser uses DNS (Domain Name System) to translate “” to it’s IP address, let’s say “”.
  3. Contents of “” are shown on your browser.

DNS Misconfiguration :
Let’s look at what we mean by DNS Misconfiguration. In the example above, if DNS server returns wrong IP address like instead of, browser successfully visits Now, if malicious website is hosted at, victim can be potentially harmed in lot of ways. This is problem if TLS (Transport Layer Security) isn’t used to connect to If TLS is used, on other hand, browser rejects connection attempt to because it doesn’t have private key that matches’s certificate.

Same Site Scripting :
A common practice while configuring nameservers is to install records of following type.

localhost. IN A

A mistake, which seems harmless, is to leave off trailing dot at the end. Server parses configuration file in way that localhost is interpreted as hostname within the current domain, instead of domain in itself. What this means is that if you try to use ping command for, query will resolve.

Same Site Scripting Vulnerability

This introduces the vulnerability called Same Site Scripting, which is variant of Cross-Site Scripting (XSS). Since dot isn’t present at the end of URL, it indicates that record is not fully qualified. Thus, queries of form “” are resolved.

So basically, loopback address (which simply means “myself” to computers) is assigned to this routable address for Hence, when you try to connect to this loopback address, you’ll be connected to machine which is sending message.

Example –
when you try to visit, and if you have service running on your localhost (like WAMP server, etc.) you’ll be redirected to that, and won’t be able to visit subdomain.

Impact :
This is not high severity vulnerability like XSS, as to exploit this, an attacker needs to be on same machine as you are. If they’re not, they can’t open network port over which, they can serve HTTP traffic to your browser from local machine.

Attack Scenario :
This DNS misconfiguration makes victims susceptible to attacks if they’re using multi-user systems.

  1. On shared UNIX system, an attacker listens on an unprivileged port[0] and then uses typical XSS attack vector(eg. img src = …) to lure victim into requesting “”.
  2. The response shown to victim, when he tries to visit above-mentioned URL is something like “Failed to load image”.
  3. In the background, however, request is logged.

How to avoid Same Site Scripting as an administrator :

  1. Non-FQ localhost entries should be removed from nameserver configurations for domains that host websites that rely on HTTP State Management.
  2. Additionally, those practicing Blackhole Routing via DNS to mitigate denial of service (DOS) attacks against specific hostnames should avoid the temptation to resolve targets to or similar addresses for sensitive domains.
My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!