Unofficial Hacker News companion — get notified on comment replies, and more.

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

624 points by scanr 5 days ago | www.infohawk.com | 390 comments on HN | Vote on HN (opens Hacker News) |

View full thread · View on Hacker News

Comment thread (6)

  1. >For example, if you take away all loops and branches from JS, but still allow it to send network requests, you'll no longer have a Turing complete language (well, you'll have to also remove lambda functions and some other stuff; Turing completeness is complicated). But have you reduced its exploitability? Perhaps marginally, but no more than that.

    Who said we should still allow it to send network requests? Just to the parent page would be enough.

    And my suggestion was stronger: that we can also drop JS and other functionality from pages handling payment forms altogether.

    Replies (1)
    1. Sure, disabling network requests to other pages is sensible. I interpreted your original comment as suggesting the code execution itself was a problem:

      > run random code on your computer. It is just not acceptable

      > Servers should deliver just data

      > Everying else is nuts.

      You didn't mention network access as a problem once.

      As I've tried to explain here, code execution and network access are entirely orthogonal issues. The latter is a problem (as is downloading data from other servers than the "parent page"), the former is not.

      If you're serving a static PDF or even a static SVG, you're "executing random code" on your clients' computers. Why is that not a problem? Or is it, would you disallow payment pages from embedding SVGs as well?

      Note also that just using a <img> tag, you're sending network requests, potentially to other servers, so disabling JS isn't enough to prevent that. And I'm fairly certain, that if you'd design a "static" prebuilt library of html entities, complex enough to support even a subset of what we've seen JS used for in shop interfaces for example, that'd be powerful enough to do conditional network requests, et cetera.

      Replies (1)
      1. >You didn't mention network access as a problem once.

        Well, isn't it implied from "Servers should deliver just data"?

        Code to be executed is not data. And without that, who would do the random network access, since a mere "payment entry/submit" form wouldn't be able.

        >If you're serving a static PDF or even a static SVG, you're "executing random code" on your clients' computers. Why is that not a problem?

        Allowing code in a format like PDF is already a problem. Same for SVG. Strict markup, with no references and dynamic instructions would be fine.

        >

        Or is it, would you disallow payment pages from embedding SVGs as well?*

        Totally. I'd even go as far as make them a standard, browser provided, form, and that's it. The store can send the shop's title and logo, some hero image, static images of each product, the price, if there was a discount, tax amounts, etc.

        Then from the item list, to the "x" buttons to remove an item or "+" to increase the units, to the total amount, be rendered by the browser in a standard format for every shop on the web, similar how a mail app would show every mail as a set of "from", "subject", "body" textboxes.

        Replies (1)
        1. > Code to be executed is not data.

          Code is data. Executing code is displaying data, and displaying data requires executing code.

          > The store can send the shop's title and logo, some hero image, static images of each product, the price, if there was a discount, tax amounts, etc.

          We've already established you need to disallow SVG. JPEG XL is another widely supported TC format, so that goes as well. [1]

          > who would do the random network access

          As I already mentioned, suppose the shop wants to serve their logo or product images from a CDN, to spread the load geographically or something. That's either a "random" network access to a different server, or it's just not allowed for the shop to do that.

          > the price, if there was a discount, tax amounts, etc.

          The "etc." is doing a lot of work here. As you add more and more features, you'll end up implementing a DSL for specifying a price listing. Then you'll have to take some care to ensure it's not accidentally TC, if that's something you care about.

          Just because it's a fun thought experiment, suppose a shop wants to add an offer such as "buy 3 apples, get one free pear". If you allow that to your price list DSL, you've pretty much got a Petri net [2]. If you add precedence between offers (if both offer 1 and 2 apply, offer 1 is used), I think that would make it a Turing complete system, i.e. by designing the offers properly, the products you get at the end could be any function of the quantities of products you're buying. A silly example, but a fun one.

          [1] https://dbohdan.com/jpeg-xl [2] https://en.wikipedia.org/wiki/Petri_net#Extensions

          Replies (1)
          1. >Code to be executed is not data.

            Code is data.

            Pedantically yes. In every common sense notion we separate the two. Which is why Lisps make a great point of how they "uniquely" adhere to that (e.g. Rich Hickey "A fundamental feature of all Lisps, if they want to be a Lisp, is that code is represented as data."). A plain text is also a binary file, but we don't go around saying "plaintexts are binaries" because we understand the distinction given the context.

            For our purposes there is code, instructions in a programming language to be executed by the browser, and there is data, passive text or images that are just send be rendered.

            >We've already established you need to disallow SVG. JPEG XL is another widely supported TC format, so that goes as well.

            Fine by JPEG XL going too. And any other number of shit we don't need to have a bloody payment page. I'm not describing what is, but what could be, and be 1000 times safer than what we have.

            >As I already mentioned, suppose the shop wants to serve their logo or product images from a CDN, to spread the load geographically or something. That's either a "random" network access to a different server, or it's just not allowed for the shop to do that.

            Totally fine with this not allowed. Problem solved. The browser can cache it, and that's it.

            >The "etc." is doing a lot of work here. As you add more and more features, you'll end up implementing a DSL for specifying a price listing.

            Let's not add "more and more features" then. Keep it to the vast fewer features that work for 99% of store payment pages (or even cars) we've ever used.

            The rest can implement whatever custom solution they need, and be shown with a big "POTENTIALLY DANGEROUS" label slapped on them by the browser, same as it would do to a site with an broker certificate.

            >Just because it's a fun thought experiment, suppose a shop wants to add an offer such as "buy 3 apples, get one free pear". If you allow that to your price list DSL, you've pretty much got a Petri net

            Or you just allow them to send the state of the current list, and you return back the pear with it's price marked as zero.

            It's not rocket science. It doesn't need to be turing complete either to handle 95% of payment pages that exist (or 99.9999% if we go by popularity).

            Replies (1)
            1. The point of my examples isn't the examples themselves, but rather to illustrate that there's a bunch of complexity that you haven't thought about.

              Sure you can keep narrowing your spec as much as you want, but how can you be sure you've covered all "dangerous" (according to you) features? Perhaps there's another image format you need to forbid, how do you know?

              Also I'm VERY dubious of your 95% figure. I'd be surprised if more than 50% of current payment pages fulfilled your specs. Remember, you need to exclude any page that uses a SVG image, or uses a CDN for any image, or whatever else that you might later realize is "dangerous".

              And no, there's no intrinsic need for TC (nor an intrinsic need for non-TC), it just happens to be that a fully featured programming language is a very convenient way to handle complexity and configuration.

              It's in fact probably the more secure way to add configuration, because then the browser writers just need to implement and verify the interpreter of the language, instead of a bunch of arcane specialized components for whatever features a shop might need.

              And no, "just don't use those features", isn't a solution. There's a reason no shop in existence probably fulfills your requirements of being "secure", which is that the benefit is entirely theoretical, and the downside is that users want the features you exclude.