Giter Site home page Giter Site logo

Comments (12)

i-am-shodan avatar i-am-shodan commented on July 17, 2024

I think what's happening in this case is that the CORS preflight check isn't returning a success code

from canarytokens.

jayjb avatar jayjb commented on July 17, 2024

Hi @i-am-shodan,

Thanks for reporting in. This is an interesting use case. Am i correct in assuming that you are trying to use

.ext-footer
{
    background-image: url('<LINK>');
    background-size: 0 0;
}

where you replace the <LINK> with a web image bug?

from canarytokens.

i-am-shodan avatar i-am-shodan commented on July 17, 2024

Yep thats it. Looking a the browser it fails the CORS preflight check.

from canarytokens.

i-am-shodan avatar i-am-shodan commented on July 17, 2024

Worth saying I can also get this use case to work if I host the image on a service I control and correctly set a wildcard CORS policy.

from canarytokens.

jayjb avatar jayjb commented on July 17, 2024

Hi @i-am-shodan,

Would you minding trying this using a "custom web image bug"? I see we added support for CORS (here)

from canarytokens.

i-am-shodan avatar i-am-shodan commented on July 17, 2024

I've tried both

from canarytokens.

jayjb avatar jayjb commented on July 17, 2024

@i-am-shodan, can you check the response header contains the Access-Control-Allow-Origin: *? In my test now, it is there. So when you browse to that login page, have the browser dev tools open on the Network tab; you should be able to inspect the request and response.

from canarytokens.

i-am-shodan avatar i-am-shodan commented on July 17, 2024

curl -vvv http://MYHOSTNAME/terms/traffic/npxix77cb0qfqf6aidlo6lj9p/img.png

> GET /terms/traffic/npxix77cb0qfqf6aidlo6lj9p/img.png HTTP/1.1
> Host: MYHOSTNAME 
> User-Agent: curl/7.68.0
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Server: nginx
< Date: Mon, 15 Jan 2024 14:05:56 GMT
< Content-Type: image/png
< Content-Length: 120
< Connection: keep-alive
< Access-Control-Allow-Origin: *
< 

But I think the problem here (at least what the browser is reporting to me) is that it's failing the CORS preflight check (https://developer.mozilla.org/en-US/docs/Glossary/Preflight_request). I have constructed one of these with:
curl -vvv -X OPTIONS -H "Access-Control-Request-Method: GET" -H "Access-Control-Request-Headers: origin, x-requested-with" -H "Origin: https://foo.bar.org" http://MYHOSTNAME /terms/traffic/npxix77cb0qfqf6aidlo6lj9p/img.png

I should be returning headers like:

Access-Control-Allow-Origin: https://foo.bar.org
Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE
Access-Control-Max-Age: 86400

But it isn't, this is what I get

* TCP_NODELAY set
* Connected to MYHOSTNAME (20.67.24.220) port 80 (#0)
> OPTIONS /terms/traffic/npxix77cb0qfqf6aidlo6lj9p/img.png HTTP/1.1
> Host: MYHOSTNAME 
> User-Agent: curl/7.68.0
> Accept: */*
> Access-Control-Request-Method: DELETE
> Access-Control-Request-Headers: origin, x-requested-with
> Origin: https://foo.bar.org
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Server: nginx
< Date: Mon, 15 Jan 2024 14:04:35 GMT
< Content-Length: 0
< Connection: keep-alive
< Access-Control-Allow-Origin: *
< Allow: OPTIONS, GET, POST
< 

So my guess is that it's failing the preflight because Access-Control-Allow-Methods and Access-Control-Max-Age are not set.

from canarytokens.

i-am-shodan avatar i-am-shodan commented on July 17, 2024

Worth saying that with Chrome + Edges devtools the request never appears because preflight fails

from canarytokens.

jayjb avatar jayjb commented on July 17, 2024

Hi @i-am-shodan,

Thanks so much for all the detail. I've been reading up on this and it looks like you are correct. Ill be adding some preflight handling today.

from canarytokens.

jayjb avatar jayjb commented on July 17, 2024

Hi @i-am-shodan,

Please could you give it another shot using a custom web image token? I've added cors preflight support

from canarytokens.

i-am-shodan avatar i-am-shodan commented on July 17, 2024

Success! Thanks for implementing this.

FYI, another thing that is also needed for the scenario is for everything to be under TLS.

from canarytokens.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.