Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to prevent such attacks when offering image upload service? #1

Open
mrkent opened this issue Mar 23, 2016 · 10 comments
Open

How to prevent such attacks when offering image upload service? #1

mrkent opened this issue Mar 23, 2016 · 10 comments

Comments

@mrkent
Copy link

mrkent commented Mar 23, 2016

No description provided.

@expobrain
Copy link
Owner

One option to provente such kind of attack is to use tool to prevent generic Canvas Fingerprinting, that is preventing or alerting the user about JavaScript code reading the content of a canvas.

@0xAndre
Copy link

0xAndre commented Feb 6, 2018

Still working on recent browsers?

@expobrain
Copy link
Owner

@x0uter good question, I can run some tests to check that

@0xAndre
Copy link

0xAndre commented Feb 9, 2018

It was great, cause I cannot run. I don't know if I'm doing anything wrong, or recent browsers block it. thanks @expobrain

@IgorSasovets
Copy link

Hi, @expobrain ! First of all, thank you so much for interesting article and awesome example! Have you tried to run it on latest version of Chrome/Firefox? Also, as I understand, to execute code, I have to write a script which you mentioned? If yes, than how to write self-executable code?
Thanks, anyway.

@expobrain
Copy link
Owner

Hi @IgorSasovets , yes, I tested it and it still working.

If you want to hide your code in a PNG you can just use my sources out of the box, you don't need to write anything, maybe just minimise and uglify the JS loader.

However you can write your own packer and loader to use a different file format like JPG, GIF, WEBP, you name it, the concept is still the same.

@IgorSasovets
Copy link

Thanks for quick response) I will play with it)

@IgorSasovets
Copy link

I tested it in latest Firefox and all works as expected) But in Chrome I got error:

Uncaught DOMException: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The canvas has been tainted by cross-origin data.
    at HTMLImageElement.<anonymous> (file:///D:/tests/javascript-js2png/html/js/loader.js:19:20)

Seems that it's blocked due to CORS requests policy. Can you please tell me how to solve this issue?

@expobrain
Copy link
Owner

@IgorSasovets I reckon the issue is that you are loading the index.html using the file:// protocol which increase the restriction of what JavaScript can access.

If you run make server and than navigate to http://localhost:8080 it will work.

@IgorSasovets
Copy link

Hi, @expobrain ! Sorry for late response. I tried your approach and now it works! Thank you for support!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants