DNS Rebinding: Methodology

OtherExploitation

From PayloadsAllTheThings by Swissky and contributors, under the MIT licence. Shown as written; the title and classification are ours. Licences. Its authors can have this tip removed by writing to abuse@bugbountytips.org.

Setup Phase:

  • Register a malicious domain (e.g., malicious.com).

  • Configure a custom DNS server capable of resolving malicious.com to different IP addresses.

Initial Victim Interaction:

  • Create a webpage on malicious.com containing malicious JavaScript or another exploit mechanism.

  • Entice the victim to visit the malicious webpage (e.g., via phishing, social engineering, or advertisements).

Initial DNS Resolution:

  • When the victim's browser accesses malicious.com, it queries the attacker's DNS server for the IP address.

  • The DNS server resolves malicious.com to an initial, legitimate-looking IP address (e.g., 203.0.113.1).

Rebinding to Internal IP:

  • After the browser's initial request, the attacker's DNS server updates the resolution for malicious.com to a private or internal IP address (e.g., 192.168.1.1, corresponding to the victim’s router or other internal devices).

This is often achieved by setting a very short TTL (time-to-live) for the initial DNS response, forcing the browser to re-resolve the domain.

Same-Origin Exploitation:

The browser treats subsequent responses as coming from the same origin (malicious.com).

Malicious JavaScript running in the victim's browser can now make requests to internal IP addresses or local services (e.g., 192.168.1.1 or 127.0.0.1), bypassing same-origin policy restrictions.

Example:

  1. Register a domain.

  2. Setup Singularity of Origin.

  3. Edit the autoattack HTML page for your needs.

  4. Browse to http://rebinder.your.domain:8080/autoattack.html.

  5. Wait for the attack to finish (it can take few seconds/minutes).

Comments

No comments yet.