News for hackers. Stuff that matters.
Re:Payment iframe - the easiest way to insert Stripe into yo... by tptacek on Monday August 13, 2012 @02:00PM (#4377126)
Do you use Typekit? Google Analytics? Mixpanel? Olark? Do those services get used anywhere in the path your users might take from your front page to the page in your app where you take credit cards? Then all those services can take your customer's credit cards too.

I frankly trust Colin Percival a lot more than I trust Olark. And I like Olark.

Your point is something Colin should address in his FAQ, and so it was good of you to make it, but it's also trivially knocked down.

Re:Payment iframe - the easiest way to insert Stripe into yo... by bentlegen on Monday August 13, 2012 @02:11PM (#4377187)
> Your point is something Colin should address in his FAQ, and so it was good of you to make it, but it's also trivially knocked down.

So, you're saying that because Google Analytics could conceivably touch credit card information (using Stripe's JS), it's perfectly fine for some random guy with a suspect domain-name to?

I disagree.

Re:Payment iframe - the easiest way to insert Stripe into yo... by tptacek on Monday August 13, 2012 @02:22PM (#4377253)
Sourcing dynamically-generated Javascript from some opaque randomized URL that plugs into an entire giant Rails application that nobody has ever assessed and that sees an "agile" deployment once every three hours, solely in order to get "dynamic A/B testing metrics" or "live chat": JUST FINE.

Sourcing static content from a static web server run by a security expert in order to segregate your application's secrets from those of Stripe: TOTALLY IRRESPONSIBLE.

Re:Payment iframe - the easiest way to insert Stripe into yo... by bentlegen on Monday August 13, 2012 @02:31PM (#4377300)
How can I be sure that it is static? And if it is static today, who's to say it won't be static tomorrow? What if the website's domain expires, and somebody snaps it up and puts something in its place? What if cperciva sells the domain to someone else?

I am not endorsing the use of third-party JavaScript on someone's payment page. I am also not endorsing the use of serving your payment form inside of a third-party iframe hosted on paymentiframe.com. I am not sure why you consider this opinion to be false.

Re:Payment iframe - the easiest way to insert Stripe into yo... by tptacek on Monday August 13, 2012 @02:40PM (#4377357)
Again: "payment page" is besides the point. The JS bug just has to happen anywhere in the path a user would take to get to the payment page.

It sure does make the argument simpler to pretend that you can just keep the Olark and Typekit and Optimizer bugs off your payments page and call it a day, but that doesn't actually do anything to protect most sites. Engage instead with my actual argument, which is that for virtually every app using these services, bugging your front page with Olark is even more unsafe than this iframe is.

Re:Payment iframe - the easiest way to insert Stripe into yo... by bentlegen on Monday August 13, 2012 @02:47PM (#4377398)
@tctapek - re: fetching another URL, just use a subdomain exclusive for processing payments (i.e. http://payments.yourdomain.com).
Re:Payment iframe - the easiest way to insert Stripe into yo... by tptacek on Monday August 13, 2012 @03:01PM (#4377487)
Any Javascript you inject into the front page of your app owns the customer experience entirely. It does not matter that you set up a subdomain to send people to for payments; malicious Javascript is just going to "send" users to an extremely authentic looking facsimile of that domain.
Re:Payment iframe - the easiest way to insert Stripe into yo... by cperciva on Monday August 13, 2012 @02:52PM (#4377437)
Except that the evil javascript will set its domain to yourdomain.com (you're allowed to strip components) and then it can tamper with anything else from yourdomain.com.
Re:Payment iframe - the easiest way to insert Stripe into yo... by bentlegen on Monday August 13, 2012 @02:57PM (#4377466)
@cperciva – wrong. Both pages have to opt into the same domain for that to work.

As in, even if the "evil script" set it's domain to yourdomain.com, unless your pages on yourdomain.com ALSO do

document.domain = 'yourdomain.com';

The script on the subdomain can't access that content.

[EDIT] Whoever is downvoting this, can you demonstrate otherwise?

Re:Payment iframe - the easiest way to insert Stripe into yo... by cperciva on Monday August 13, 2012 @03:03PM (#4377496)
My understanding is that pages from yourdomain.com would already have document.domain set to 'yourdomain.com', but I'm not a javascript expert.
Re:Payment iframe - the easiest way to insert Stripe into yo... by bentlegen on Monday August 13, 2012 @03:07PM (#4377521)
@cperciva – it is and it isn't. Implicit vs explicit. This answer expands:

http://stackoverflow.com/a/3978372

Re:Payment iframe - the easiest way to insert Stripe into yo... by cperciva on Monday August 13, 2012 @03:27PM (#4377644)
This reminds me of the WAT talk.

It's also crazy enough that I wouldn't want to trust that every browser in the world will always share that same behaviour.

Re:Payment iframe - the easiest way to insert Stripe into yo... by bentlegen on Monday August 13, 2012 @04:33PM (#4377997)
This document.domain behaviour is documented as part of the HTML spec:

http://www.whatwg.org/specs/web-apps/current-work/multipage/...

Re:Payment iframe - the easiest way to insert Stripe into yo... by slexaxton on Monday August 13, 2012 @03:06PM (#4377517)
bentlegen _is_ an expert in third party javascript, and is correct that both domains need to opt in to a `document.domain` even if they would match with only one changing. This is to prevent this exact security exploit.
Re:Payment iframe - the easiest way to insert Stripe into yo... by tptacek on Monday August 13, 2012 @03:17PM (#4377569)
This part of the discussion is a bit of a sideshow, isn't it? PAYMENTS.YOURDOMAIN.COM is not in fact a real mitigation for malicious Javascript on WWW.YOURDOMAIN.COM.
Re:Payment iframe - the easiest way to insert Stripe into yo... by bentlegen on Monday August 13, 2012 @03:49PM (#4377760)
Seems like the best solution from where I'm sitting.

Listen, if you don't trust Stripe's JavaScript, just use their HTTP API instead from your server: https://stripe.com/docs/api

Re:Payment iframe - the easiest way to insert Stripe into yo... by tptacek on Monday August 13, 2012 @03:59PM (#4377808)
You can't do that without incurring a PCI Audit, can you?

The best answer is "don't link to Javascript URLs that you don't control and audit on your website". Nobody likes that answer, but that doesn't make the second-best answer any more meaningful.

Re:Payment iframe - the easiest way to insert Stripe into yo... by cperciva on Monday August 13, 2012 @04:01PM (#4377825)
You can't do that without incurring a PCI Audit, can you?

Exactly. There's no way I would be serving up third party javascript to a logged-in Tarsnap user, even inside an iframe, if it weren't for the fact that dealing with PCI auditing would irreparably damage my sanity.

Re:Payment iframe - the easiest way to insert Stripe into yo... by cperciva on Monday August 13, 2012 @02:47PM (#4377400)
Sourcing static content from a static web server

Technically, the iframe is dynamic content, seeing as it's generated by a CGI script based on the parameters in the URL. :-)

Re:Payment iframe - the easiest way to insert Stripe into yo... by cperciva on Monday August 13, 2012 @02:13PM (#4377197)
I think Thomas is saying that I'm not "some random guy".
Re:Payment iframe - the easiest way to insert Stripe into yo... by tptacek on Monday August 13, 2012 @02:44PM (#4377383)
I think highly of you, but my irritation here has more to do with being shouted down about getting crazy third party JS services off banking applications than it does with who runs this particular static iframe.

I think this issue is LITERALLY this simple: people are accustomed to third-party applications that work by "just copy this tiny snippet of JS code into your layout template", and all the cool kids do it, so it's not up for discussion. But static content hosting a form in an iframe? THAT'S CRAZY TALK.

Re:Payment iframe - the easiest way to insert Stripe into yo... by cperciva on Monday August 13, 2012 @02:50PM (#4377423)
Agreed, people are far too casual about dropping random javascript into their web sites. (I tried to make this point last year when I blogged about how Iran should have forged an SSL certificate for ssl.google-analytics.com instead of *.google.com, but that blog post didn't get much attention sadly.)
Re:Payment iframe - the easiest way to insert Stripe into yo... by cpach on Monday August 13, 2012 @04:39PM (#4378015)
Great article! (The URL is http://www.daemonology.net/blog/2011-09-01-Iran-forged-the-w... in case anyone wonders.)

It surely gives food for thought.

Re:Payment iframe - the easiest way to insert Stripe into yo... by DASD on Monday August 13, 2012 @02:28PM (#4377279)
Your name is familiar...You're the fellow that does security consulting for bingo card sites right? :)