6 ms·
Yeah, it's not just unsafe-eval that needs to be blocked, I just said that that was the specific feature that would have blocked this. A good CSP would have pr
by SahAssar 6y ago
Yeah, it's not just unsafe-eval that needs to be blocked, I just said that that was the specific feature that would have blocked this.
A good CSP would have protected against most injection attacks though (as long as the JS files have not been modified).
- jeroenhd 6y agoYou're right if this was some included third party script, but usually these hacks involve an attacker getting access to the (PHP/HTML) source code and injecting stuff directly. At that point there's very little you can do to prevent JS files from being changed or the CSP being disabled at all. Very few web store systems rely on statically generated HTML pages, and the ones that do usually have some JS file for animations or functionality that the attacker can also modify. CSP is great for blocking XSS and other such attacks, but I don't think it can be an effective defence in this particular attack. The only way I can think of to get CSP to protect you is to host no JS on the server itself, configure some kind of proxy (Cloudflare?) and inject CSP config there. An attacker could still compromise the website but they'd need to escalate their attack to the point of a DNS takeover or add a noticeable redirect to an attacker-controlled skimming page, both of which aren't very likely to be used against random targets like these web shops often are.