News for hackers. Stuff that matters.
Re:Payment iframe - the easiest way to insert Stripe into yo... by bentlegen on Monday August 13, 2012 @12:16PM (#4376585)
Please don't use this. There is nothing stopping paymentiframe.com from taking your customer's credit card numbers.
Re:Payment iframe - the easiest way to insert Stripe into yo... by bryanlarsen on Monday August 13, 2012 @01:57PM (#4377119)
By using this, you're saying that you trust cperciva more than you trust Stripe. I'm confident that neither are going to try and deliberately steal your credit card numbers. But furthermore, you are saying that cperciva is going to protect paymentiframe.com from hacks better than stripe is going to protect theirs.

Myself, I'd place a lot of trust on cperciva, the former FreeBSD security officer, a guy who has written papers on security flaws in Pentium 4 processors. (http://www.daemonology.net/hyperthreading-considered-harmful...)

[edit] paymentiframe.com's FAQ now includes this:

Why should I trust you with my credit card entry form?

You probably shouldn't. This is more of a proof of concept — but you might also want to use the CGI script to generate an iframe which you download (along with the bits it links to) and serve up as a static file from a server you run (but make sure you get a separate domain name for it).

Re:Payment iframe - the easiest way to insert Stripe into yo... by semenko on Monday August 13, 2012 @05:19PM (#4378214)
> Myself, I'd place a lot of trust on cperciva

Sure, but you can just compare the two sites' external measures of security, and they're not even close.

Stripe domains:

- Pass optional HTTP security headers (like X-Frame-Options on manage.stripe.com)

- Are pinned to Chrome's HSTS list (http://src.chromium.org/viewvc/chrome?view=rev&revision=...) and pass a Strict-Transport-Security header

Re:Payment iframe - the easiest way to insert Stripe into yo... by tptacek on Monday August 13, 2012 @05:30PM (#4378257)
Aren't you comparing Colin's iframe with a level of security unobtainable to normal Stripe developers? If you just use Stripe's JS interface the way they tell you to, you're not strictly speaking benefiting from Stripe's HSTS or XFO; your site still needs to defend against clickjacking and SSL stripping.

I feel like Colin built this little thingy to solve a real problem --- that by adding Stripe to his site, he was giving Stripe control over his site, and his site hosts information more sensitive than credit cards --- and people are piling on because his solution to his little problem doesn't solve every other imaginable security problem.

This would be less galling if the kinds of sites using Stripe today weren't almost uniformly rife with application security flaws that defeat most of the good intentions that Stripe has.

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? :)
Re:Payment iframe - the easiest way to insert Stripe into yo... by DASD on Monday August 13, 2012 @01:02PM (#4376842)
Ben, Are you going to be addressing this in your book, Third Party Javascript? Would love to hear your recommendations for how to handle payment processing such as this.
Re:Payment iframe - the easiest way to insert Stripe into yo... by bentlegen on Monday August 13, 2012 @01:36PM (#4377001)
The book describes techniques that Stripe could use in developing their own iframed credit card form. I'd only trust a solution from them directly.
Re:Payment iframe - the easiest way to insert Stripe into yo... by tptacek on Monday August 13, 2012 @02:02PM (#4377136)
That doesn't make any sense, because the whole point of PAYMENTIFRAME.COM is that you don't trust Stripe.

Colin implemented this because besides credit card numbers, he was unwilling to give Stripe control over his website. Colin's users trust him with things that are much more sensitive than credit card numbers.

Re:Payment iframe - the easiest way to insert Stripe into yo... by DASD on Monday August 13, 2012 @02:09PM (#4377177)
People trust Stripe. I think the issue here is Javascript and origin-policy and relinquishing control. When Stripe releases their version of STRIPEPAYMENTIFRAME.COM as an iframe solution then this can go away. I believe Colin mentioned a need for this now rather than waiting for Stripe.

Interesting side note: Yes I know it's only meant to be a demonstration site but PAYMENTIFRAME.COM is using Google Analytics. Oh HAI GA...what's my Security Code again? Just needed a nice chuckle before I head back from lunch.

Re:Payment iframe - the easiest way to insert Stripe into yo... by tptacek on Monday August 13, 2012 @02:10PM (#4377180)
Colin trusts Stripe to collect credit cards. He does not trust them for anything else. Embedding the form on a page on TARSNAP.COM trusts them for everything that can happen on any web application on the same domain.
Re:Payment iframe - the easiest way to insert Stripe into yo... by DASD on Monday August 13, 2012 @02:21PM (#4377252)
Did my comment not cover something?
Re:Payment iframe - the easiest way to insert Stripe into yo... by bentlegen on Monday August 13, 2012 @02:13PM (#4377199)
That's great for Colin. But he should describe the steps he took to host his own iframed Stripe form. Not encourage others to blindly copy/paste an <iframe> tag pointing to his domain onto their website.
Re:Payment iframe - the easiest way to insert Stripe into yo... by bentlegen on Monday August 13, 2012 @02:41PM (#4377360)
Correction: If you're going to use this, please use the generated document and host it on your own domain.