I face some sort of "MitM" attack type that I don't really know how to search, because I don't really know what it is called, so I am in the dark here, and need some help and advice.
Let's say there is a shopping website: shop.com
Customers, after logging in, can browse the items, put them into the shopping cart, and in the end, they can go checkout, where they are redirected to a payment processor, e.g.: paypal. The site itself doesn't handle any payment or credit card, it redirects to a secure site.
Someone makes a fake site: fake-shop.com
When the customer goes to this fake website, it calls the original shop.com
and shows the result to the customer, but also injects javascript code into it.
The fake server doesn't care about the customer data, they don't take anything, it just flows through the fake server, it is working basically as a proxy server, and sends the data back and forth between the customer and the real server, and they inject their code in the html, and they are only interested in the checkout.
When the customer wants to checkout and pay for the items, the fake server changes the real checkout.html, where they hide the original paypal selection option, and inject their own form, which asks for credit card details, and when the customer enters those and hits send it will send it to the fake server.
My questions:
- What is this attack called? Some sort of MitM with replay, but this happens real-time.
- How can this "attack" be detected on the server side?
- How can be this prevented? Will CSP inline script blocking be enough and block any js injection?