00:00:00.734-->00:00:06.273 >>Alright so Steven has been doing some research into banking. Um, how many people out 00:00:06.273-->00:00:09.810 there use things like Quicken and things like that to uh to fill out the spreadsheet for 00:00:09.810-->00:00:14.815 you? Yeah. Okay this is a security conference so you all fail. Um, you can turn in your 00:00:16.850-->00:00:21.855 mother’s maiden name at the desk on your way out. Um, that stuffs always kind of giving me the 00:00:24.558-->00:00:31.465 creeps, that’s why I use Redacted and I fill everything in by hand and uh to validate 00:00:31.465-->00:00:38.338 that decision uh let's give a big hand to Steven. [applause] Thank you very much, have a 00:00:38.338-->00:00:43.343 great time. [applause] >>Take a quick drink of Pepsi. [laughter] Ahh. So uh I wanna say first off 00:00:49.816-->00:00:55.923 uh this is my 7th DefCon, my first time on stage I am super excited uh to be giving back to 00:00:55.923-->00:01:01.795 this community uh finally and share some, share some knowledge. Uh what I’ve been 00:01:01.795-->00:01:06.800 working on for uh, for about t- 6 months all total. So, ehm. Hacking banks. Because that’s 00:01:12.673-->00:01:18.912 where the money is. Uh what was my motivation? Uh I think because a lot of community 00:01:18.912-->00:01:23.917 overlap uh with, excuse me, with uh the tech geeks and finance geeks, a lot of people I work 00:01:27.321-->00:01:32.326 with uh are finance geeks as well. Um, I like to hack things that I uh I use. I like to hack 00:01:34.361-->00:01:39.299 things that are in my own backyard. I like to make my life safer. Uh, and uh and then ya 00:01:39.299-->00:01:45.105 know improve the world around me through making my life safer. And uh, I don’t write banking 00:01:45.105-->00:01:50.110 software. I’m a pen testing by tr- uh, by, by job. Uh so I’m just a guy with CURL and PYTHON 00:01:53.146-->00:01:59.219 and some curiosity. And I’ll kinda walk you through uh how I went from zero to this talk, in 00:01:59.219-->00:02:04.157 uh, in the last 6 months. Sitting at home I’m using Quicken, I uh am security aware, 00:02:09.830-->00:02:14.601 I’ve got 2 factor on all my accounts I load up my bank account in Quicken, uh the 00:02:14.601-->00:02:19.172 password doesn’t work with a 2 factor, well surely typing the password without 2 factor, 00:02:19.172-->00:02:24.177 that’s not gonna work. Nope it does. So, what’s going on here? Just plain text password, is 00:02:27.047-->00:02:33.086 there a separate server, is there a separate protocol? How is Quicken and other, other 00:02:33.086-->00:02:38.091 desktop software talking to my bank uh that’s not just going through the, the webpage? So 00:02:41.028-->00:02:45.966 let's talk about Quicken. Uh Quicken is uh 1 of what the financial industry calls a 00:02:45.966-->00:02:52.439 personal financial management software. Uh you’ve probably seen these names, everyone, a 00:02:52.439-->00:02:59.046 lot of people raised their hands, mint dot coms very popular, um PFMs the industry 00:02:59.046-->00:03:05.952 term, uh I’ll start throwing that around. I have a bunch of bank accounts, uh some people 00:03:05.952-->00:03:10.757 collect credit cards, uh sorry I collect credit cards. Some people collect baseball cards, 00:03:10.757-->00:03:17.197 uh some people have way too many domain names, uh I have way too many bank accounts. I, they give 00:03:17.197-->00:03:23.236 you bonuses when you sign up, and uh, and I, I like undertraining of like from a 00:03:23.236-->00:03:28.241 practical real uh sense how, how financial system works. So uh, I’ve got let’s say less than 100 00:03:32.479-->00:03:37.484 more than 20 bank accounts that I w- uh, I wanna manage and that g- b-becomes a pain. So I want, 00:03:39.619-->00:03:43.990 I want some simple aggregator client that I don’t have to write myself uh that’ll just 00:03:43.990-->00:03:48.562 keep track of my transactions every month. I use Quicken personally, it’s the devil I 00:03:48.562-->00:03:53.033 know, it’s terrible I love to hate it, I don’t recommend it. I don’t recommend any of these. 00:03:53.033-->00:03:59.773 Um, uh, I wish, I wish there was one that I could recommend to you. So let’s start from user’s 00:03:59.773-->00:04:04.711 experience. Uh this is the Quicken UI, on the left-hand side I’ve a list of bank 00:04:08.281-->00:04:13.987 accounts, uh also just loans and credit cards. On the right hand side you’ve got a big 00:04:13.987-->00:04:18.859 transaction list. Everything you, you bought, who you paid, what you paid when, pretty, 00:04:18.859-->00:04:23.864 pretty standard for, for balancing your checkbook. So you first install a program like 00:04:26.032-->00:04:31.304 Quicken and this is what happens. You have to, enter in your account info. First you 00:04:31.304-->00:04:35.242 tell it, what kind of account you have. It’s quite a, quite a large selection of banking 00:04:35.242-->00:04:40.247 products that we all use. Then, uh, you pick your bank name, uh and it does uh basically a name 00:04:44.217-->00:04:49.222 to sort of uh URL lookup, uh a DNS like lookup. Um that’s called the branding service. 00:04:51.491-->00:04:55.028 Then you pick out how you want to connect, usually there’s just 1 way sometimes there’s multiple 00:04:55.028-->00:04:59.966 ways, we’ll go into that. Then you type in your credentials, into this totally not your banks 00:05:02.435-->00:05:07.440 website. Uh form, where you put your plain text password. It somehow finds your account, you 00:05:12.379-->00:05:17.384 pick the one that you want to uh interact with in the app. And voila it starts downloading your 00:05:19.586-->00:05:24.591 transactions. That’s what the user sees. So what’s going on in the background? There are 3 ways 00:05:27.294-->00:05:32.966 in which Quicken, uh, uh and sort of other financial management software uh talk to 00:05:32.966-->00:05:37.971 your bank. Um, the Quicken these are the Quicken brand names, once called web connect. Uh web 00:05:40.006-->00:05:45.345 connect is a fancy way for saying you go to your website, you type in your creds you go 00:05:45.345-->00:05:50.350 download a file and you manually import it into the app. Uh, web connects easier to say. Express 00:05:52.786-->00:05:57.791 web connect is uh, Quicken has a bot that does that for you. It’s all manual. Direct connects what 00:06:01.261-->00:06:08.168 we’re gonna talk about. It’s a programmatic structured uh query language based on the OFX 00:06:08.168-->00:06:13.173 protocol that talks directly between your client and your bank. So again in picture form, 00:06:18.678-->00:06:20.680 you are the middle man on web connect, uh an intuit server is the middle man on express web 00:06:20.680-->00:06:22.682 connect and direct connect is you actually talking directly with your bank. It’s the minimal 00:06:22.682-->00:06:24.684 amount of trust relationship. Financial institution here is also the industry term uh for 00:06:24.684-->00:06:26.686 bank or credit card or investment account, for 401k I’ll start saying financial 00:06:26.686-->00:06:28.688 institution from here on out now that you’re in with the banker lingo with me. Another step 00:06:28.688-->00:06:30.690 here, uh is account aggregators. These are important to understand. Uh so every bank, if 00:06:30.690-->00:06:35.695 you have to actually connect and go download a file, well they all do it a little differently 00:06:44.671-->00:06:49.676 so someone realized that there was a business her creating 1 unified API, their own 00:07:08.662-->00:07:14.601 proprietary API and then screen scraping as a service to all these other banks. Uh so there’s 00:07:14.601-->00:07:19.005 a couple uh these are the big names in account aggregation, um YODLEE's the biggest, they’ve 00:07:19.005-->00:07:25.045 actually been around for 20 years. Uh they also clean and normalize the data so um, you 00:07:25.045-->00:07:29.716 know so you’re, you’re the names of like the companies that you’ve bought stuff from and 00:07:29.716-->00:07:34.554 what type of purchase it is, all gets, all gets canonicalized across multiple institutions. 00:07:34.554-->00:07:40.360 They, they provide a good service. A-and so the end user application developer they 00:07:40.360-->00:07:44.230 provide a consistent API so like i-if you want to write your own banking app you don’t have to 00:07:44.230-->00:07:49.235 talk to 1000s of different banks individually. Uh but they also add yea another layer of trust, 00:07:52.739-->00:07:59.679 so now my plain text password goes from my computer, to personal capital web application 00:07:59.679-->00:08:06.553 um PFM to YODLEE and then to my financial institution where they do some screen scraping or maybe 00:08:06.553-->00:08:11.558 make that direct connection to OFX for me. I have to trust that every one of these tops has my 00:08:14.094-->00:08:18.832 own financial best interested in mind and that they’re all competent enough to protect a 00:08:18.832-->00:08:23.837 secret. The first easier to believe than the latter. So hopefully you’re seeing as I did 00:08:29.142-->00:08:34.147 that this whole architecture uh, is, is lacking uh in least privilege. Uh and this is 00:08:38.785-->00:08:44.524 bulls**t, like these are our banks, these are, hey Joel. These are our, these are our 00:08:44.524-->00:08:49.529 money. Uh why do I have to give full read write access to third party software to uh, to just ya 00:08:53.133-->00:08:58.772 know balance my checkbook every month and trust some ya know the latest financial app whose then 00:08:58.772-->00:09:05.311 giving my read write password to a third party and then to another third part and what’s 00:09:05.311-->00:09:11.584 definitely needed here is some kind of uh OAuth tokenized app-based access control where I 00:09:11.584-->00:09:17.190 can say, hey Quicken you can ya know you can go to uh, you can go to my Bank of America account 00:09:17.190-->00:09:21.528 if you only have read only access uh and only for 30 days and then talk to me after 30 00:09:21.528-->00:09:27.133 days and I’ll, and I’ll re-up your privileges, that’s what we need, that is not what we have 00:09:27.133-->00:09:32.138 in 2018 in banking personal finance. So that’s the end user perspective. Uh let’s get 00:09:39.012-->00:09:43.817 technical. We’re gonna start at the specification level. Uh walk guys through how things could 00:09:43.817-->00:09:48.822 work and then we’ll talk about implementations and deployments and how things actually work. 00:09:55.562-->00:10:01.034 The OFX protocol is an open spec. There’s a group of companies that build it. Uh it’s 00:10:01.034-->00:10:06.039 uh freely available for download and perusal and implementation. Uh you can go grab this spec 00:10:09.175-->00:10:14.180 right now and, and ready along with me if you’d like. OFX is this proto-web service. It was 00:10:18.618-->00:10:23.623 actually invented in 1997. So it’s before like we even had rest as a term but it passes uh, 00:10:25.992-->00:10:32.699 it passes messages that are structured over uh HTP, sends a request, gets it back a 00:10:32.699-->00:10:37.704 response. It can do pretty much anything that a normal consumer would want to do with their 00:10:39.739-->00:10:46.513 bank. You can ya know checking savings account uh your IRA, credit card transactions, you 00:10:46.513-->00:10:52.552 can do bill pay. Those, those first 3 on the left there kind of read only operations on the 00:10:52.552-->00:10:57.557 right uh writeable operations. Uh wiring money to foreign uh banks, transferring between 00:11:00.894-->00:11:06.366 counts, accounts at your bank. Transferring to accounts at different banks. Its up to each 00:11:06.366-->00:11:12.338 financial institution to sort of decide how much of the spec and the protocol that they uh, they 00:11:12.338-->00:11:17.343 implement. Uh, n-no one really implements them all. Um, as, as we’ll see. It also does taxes. 00:11:19.779-->00:11:25.685 Uh I didn’t really research into that too much but TurboTax uh that I use and a lot of people 00:11:25.685-->00:11:30.690 use uh also pulls a lot of data through this protocol. And then that’s kind of the data path and 00:11:33.526-->00:11:37.830 then there’s sort of a config path within the protocol and other interesting um side 00:11:37.830-->00:11:44.637 things. So uh, initial enrollment and password change can be done through OFX. Uh 00:11:44.637-->00:11:51.377 messaging from the bank to you, notifications from you to the bank and lots of f-functionality 00:11:51.377-->00:11:57.617 that’s sort of obviously there to help transition uh, uh a small bank, a traditional bank 00:11:57.617-->00:12:02.555 into the digital age. Uh so you can, download images and PDFs like within the protocol, uh 00:12:05.191-->00:12:10.797 sort of meant as like a scan of your bank statement instead of sending it to the, to you in the 00:12:10.797-->00:12:15.535 mail ya know it’s an obviously like first step getting away from mailing you but it’s just 00:12:15.535-->00:12:21.841 scanning of PDF and sending you the exact same thing. This protocol is complex, it’s got a 00:12:21.841-->00:12:26.846 650-page specification and it’s actively developed and growing. With that complexity we all know 00:12:31.150-->00:12:36.155 comes insecurity. I mentioned it goes over HTP, uh so here we’re gonna actually look at some, 00:12:43.029-->00:12:48.034 some captures of sorts. Uh this is the standard HTTP header. Uh you’re doing a post request to a 00:12:52.038-->00:12:57.043 well known URL. Um, request response as I said, uh that URL is almost always just some kind 00:13:00.780-->00:13:05.785 of um base path and then, and then server, handler, remember CGI. It’s, it’s definitely based 00:13:08.554-->00:13:13.559 off that. Uh there’s unique content type, application uh X, OFX, uh and some servers, not 00:13:17.063-->00:13:22.068 all servers do user agent filtering so uh I’m, I’m using the uh, the Intuit client app uh 00:13:25.171-->00:13:30.176 user agent here in these examples. So I uh the same slide I just dropped those HTTP 00:13:33.746-->00:13:39.285 headers, make the text a little bigger and we can look at the real protocol. It’s got a header 00:13:39.285-->00:13:43.723 that mostly remains static, it tells us the version number, which is the most interesting 00:13:43.723-->00:13:50.563 part. Uh and then the body uh, looks like HTML right? You’ve got, we’ve got elements and 00:13:50.563-->00:13:56.536 tags. Uh nested within each other we got span elements, we’ve got block level elements. 00:13:56.536-->00:14:01.474 Uh it’s actually SGML, which if you’ve never heard of, neither had I. SGML was invented after 00:14:04.077-->00:14:09.082 HTML but before XML. So they’re like ya know, a little bit of rigidity uh so you can like 00:14:11.184-->00:14:16.489 parse it well but not, not a lot. Uh still, still some wiggle room. You, you can tell it’s 00:14:16.489-->00:14:22.261 not, you can tell its SGML because there’s no closing tags on the span elements. Um, those, 00:14:22.261-->00:14:27.266 those become required in XML. Uh it’s hard to get an SGML parser today. Python deprecated it in 2 00:14:30.536-->00:14:34.474 dot 6 which was years and years ago. Um, so that’s, that’s an interesting note. And uh, you’ll 00:14:34.474-->00:14:36.476 notice plain test user ID, it’s basically HTTP basic auth. Everyone of your requests sends 00:14:36.476-->00:14:38.478 your username and password plain text in every request. All over TLS, us so it’s not, it’s not, 00:14:38.478-->00:14:44.450 TLS is required, um but no challenge response, no, no session token. There is, there 00:14:44.450-->00:14:49.756 is a session token mechanism of sorts, I’ve not seen it used. And, uh there’s this financial 00:14:49.756-->00:14:54.761 ID that’s sort of optional. Um sometimes you need to specify the, the numeric value for the 00:15:00.700-->00:15:05.705 banks, sometimes, sometimes you don’t’. And on the response, there’s a status code inside 00:15:07.740-->00:15:12.745 every block saying success, or, or a unique error message. So pretty, pretty easy to parse, 00:15:18.584-->00:15:23.589 very human readable and all outlines in a, in a decently written spec. So typical 00:15:30.763-->00:15:37.103 protocol flow, we saw this in GUI. This is the same thing over the wire. The client makes a 00:15:37.103-->00:15:43.442 profile request, which can be made anonymously, gets a bunch of capabilities uh from the 00:15:43.442-->00:15:48.347 server, hey do you support banking do you support investment? Then it sends a 00:15:48.347-->00:15:53.452 account info request, getting a list of accounts. That one has to be authenticated so it can 00:15:53.452-->00:15:58.457 look up your accounts and it sends a statement request getting all your transactions. 00:16:04.297-->00:16:08.234 Here’s an example of the profile request. Um that last one we looked at was just the, the 00:16:08.234-->00:16:12.672 simplest authentication. Now we’re actually asking for some data back in the body. Uh this 00:16:12.672-->00:16:19.612 profile request, anonymous sign in, prof RQ you don’t h- really have to pass any data at all and 00:16:19.612-->00:16:25.451 you get back a lot, you get back a lot of interesting info from a server sitting on the internet 00:16:25.451-->00:16:29.689 uh that anyone can query with anonymous credentials about w-what it, what it supports. 00:16:29.689-->00:16:34.694 This example we’ve got the bank message set, it’s telling me checking accounts, and uh 00:16:37.063-->00:16:42.068 savings accounts likely. Uh are, are available, uh this XFERPROF tells me that I can do money 00:16:44.570-->00:16:50.376 transfers uh to different accounts. That’s, that’s uh intro bank uh money transfers. 00:16:50.376-->00:16:55.381 And then, also in the profile is uh information about the bank, 1997 most banks didn’t have 00:17:00.386-->00:17:05.124 websites yet so this was sort of seen as like the way you were gonna talk to your bank and they 00:17:05.124-->00:17:11.964 might not have a website. So the ya know physical address of the bank um and email so you can, 00:17:11.964-->00:17:18.037 you can talk to someone at the bank, that all, that all comes back with this profile request. 00:17:18.037-->00:17:23.042 So a timeline. 1997, Microsoft who’s making Microsoft money, Intuit who’s making Quicken and 00:17:34.921-->00:17:40.760 CheckFree who’s since got bought and, and is not a common name. Um all collaborated to make this 00:17:40.760-->00:17:45.865 protocol. They each had their own proprietary protocol which uh your client had to use to 00:17:45.865-->00:17:51.404 talk to the bank. Presumably it was hard to get a bank to implement even 1, so they merged 00:17:51.404-->00:17:56.142 together and uh, and put their combined weight to d- get the banks to actually run uh 1 of 00:17:56.142-->00:18:01.080 these OFX servers. 2005, uh the FDIC sees a lot of banks are going online and says okay we 00:18:07.019-->00:18:12.291 should, we should make the security here is, is uh up to snuff. So the FDIC, the, the um, 00:18:12.291-->00:18:18.264 US Federal Government Deposit Insurance Corporation who make, ya know who has to pay out when, 00:18:18.264-->00:18:24.904 when banks lose, uh lose money says okay guidance, all banks should, not must, but strongly 00:18:24.904-->00:18:31.844 should use multi factor authentication for any of their online um, access. So, in 00:18:31.844-->00:18:36.849 response to that a new version the spec comes out, 2006 uh called 1 dot o 3 with MFA which 00:18:41.721-->00:18:46.726 we’ll go into. They transition it to XML, uh 2007 brand new beautiful spec with OAuth came 00:18:52.999-->00:18:58.838 out in November, it’s 8 months old, no one has implemented it, it is not in the wild yet. Um 00:18:58.838-->00:19:03.776 I’m hopeful. And you might notice there’s a big gap here between 2006 and 2017. Pure 00:19:07.680-->00:19:12.685 speculation but uh, 2009 Microsoft decides that Microsoft money uh their premiere, uh 00:19:15.855-->00:19:20.860 personal finance management software, it’s not worth it. They, they drop it. They uh, 00:19:23.095-->00:19:28.100 team stops developing it. And, and 2 things happen. Um, Intuit, now sort of being the only 00:19:30.336-->00:19:32.838 player in town gets lazy and starts charging people $100 a year for the exact same version 00:19:32.838-->00:19:34.840 of Quicken 2010, 2011, 2012, no, no software improvements whatsoever because they have no 00:19:34.840-->00:19:36.842 competition and they don’t need to try. Uh but on the good side, uh there’s this whole uh 00:19:36.842-->00:19:38.844 community effort because people love Microsoft Money and so a lot of geeks started like 00:19:38.844-->00:19:40.846 posting on forums and putting up webpages and finding these, finding out about OFX and 00:19:40.846-->00:19:42.848 writing clients and that’s what all of my work is built on is, is uh these guys in sort of 2009 00:19:42.848-->00:19:44.850 through 2011 who uh, wanted to replace Microsoft Money with a bunch of python scripts and 00:19:44.850-->00:19:46.852 excel spreadsheets. So let's talk about MFA. Quick refresher that most everyone knows uh in 00:19:46.852-->00:19:48.854 this room. Multi-factor authentication something you know, something you have uh, and 00:19:48.854-->00:19:50.856 or something you are. The point is to remove the brute force password attack or theft of your 00:19:50.856-->00:19:52.858 password as valid attacks against uh, against your account. Things that uh, 00:19:52.858-->00:19:57.863 individuals are, are quite susceptible to. Banks have been doing 2 factor authentication 00:20:03.436-->00:20:08.441 for 50 years. Uh with your ATM card. You have your card, you have your PIN number, something 00:20:47.012-->00:20:52.017 you have something you know. They’re good at this. In addition to multi-factor uh sort 00:21:11.904-->00:21:18.744 of security community has, has finally settled on the name uh 2 step authentication better than, 00:21:18.744-->00:21:24.016 than 1 factor but not as good as multi-factor. Uh we see this a lot. We see this a lot in banks. 00:21:24.016-->00:21:30.322 We still see it with Twitter, uh getting an SMS code uh instead of, instead of something you 00:21:30.322-->00:21:35.995 physically have. Some side band channel of information. Uh again, better, better than 1, 00:21:35.995-->00:21:41.000 than 1 factor but not as good as 2. So 2006, MFA is should not must by FDIC, what is, what is 00:21:46.438-->00:21:51.443 the protocol uh the protocol implementers do? They have 4 different solutions in the 00:21:57.316-->00:22:03.556 specification. 1 is uh this user cred, uh 1 is this MFA challenge, they’re both 00:22:03.556-->00:22:09.828 basically the uh asking questions, about your mother’s maiden name that you all know 00:22:09.828-->00:22:14.833 and love. In fact the second 1 is hardcoded in the spec. These are the questions that you will 00:22:17.903-->00:22:22.908 ask as a server to the client. 2018 we all realize uh these are both something you know, these 00:22:26.078-->00:22:32.017 are things that are somewhat obvious or, or easily available to learn about a person and 00:22:32.017-->00:22:37.456 moreover i- I, I have the like, I have the cheat sheet before the test right? Oh okay I need 00:22:37.456-->00:22:41.493 to find out these 20 things about this person and then I can definitely log into their 00:22:41.493-->00:22:46.498 account. Ya know, their zip code. The other 2 forms a little better. CLIENTUID AUTHTOKEN. Um 00:22:49.201-->00:22:54.206 I’ll start on the right, AUTHTOKEN server generated um, s-sort of GUI’d uh that uh sends 00:22:57.109-->00:23:02.047 the client, client assistant back every time. Uh it’s sort of key value-ish. It could be used 00:23:05.451-->00:23:11.790 to hold like TOTP, like 1-time password codes um but they don’t, they don’t do that, 00:23:11.790-->00:23:17.296 nobody uses it. CLIENTUID is what everybody has sort of standardized on. Uh as the 00:23:17.296-->00:23:22.301 second factor. It is client generated, GUId. Client sends it the first time, server records 00:23:25.137-->00:23:30.576 it, every time henceforth the client has to send that same UID otherwise the server will stop 00:23:30.576-->00:23:35.581 trusting them. So its TOFU, it’s trust on first use. Um, but actually uh, people have like 00:23:38.917-->00:23:43.489 more than 1 computer and this is recognized, um in the spec and in the implementation 00:23:43.489-->00:23:47.359 guidelines. Like people will have a desktop and a, and a laptop, people have a phone. So 00:23:47.359-->00:23:52.364 it’s actually trust on first 4 uses. [laughter] Sometimes 2. Uh, but yeah so like if you see 00:23:55.834-->00:23:58.537 it, you’ve never seen this client and they make up an ID well as long as you don’t 00:23:58.537-->00:24:03.475 already have like 1 or 2 stored, sure they’re also the same person. And that is the state of 00:24:06.178-->00:24:11.784 the art in multi-factor authentication within the protocol that passes your money. 00:24:11.784-->00:24:16.789 But I have good news. Cause that’s in version 103 and nobody’s running version 103. 00:24:20.859-->00:24:25.864 They’re running 102. 80 percent of the implementation in the wild are not running, are 00:24:30.970-->00:24:36.508 running the version that was written in 1997. Um, 20 percent are running the version that in 00:24:36.508-->00:24:41.513 theory can support multi-factor. Uh, n- and nobody is running the OAuth version. Good news. So 00:24:46.185-->00:24:51.190 let’s talk about the financial institutions. These banks we love. We all know these big 00:24:59.498-->00:25:04.103 names. Um most of us probably have an account somewhere here. These are from like the, the top 00:25:04.103-->00:25:09.108 20 by assets of US banks. Uh Citigroup, JP Morgan, Wells Fargo, American Express, for 00:25:12.511-->00:25:17.516 credit cards. Um, OFX is used, is used by these guys. OFX is uh, is also used by Yolo, you 00:25:23.155-->00:25:28.160 only live once Federal Credit Union. [laughter] This is me participating in bank branch 00:25:31.330-->00:25:36.335 tourism. I flew to California and then drove 2 hours to get this photo for you. I have a lot 00:25:40.339-->00:25:45.344 of bank accounts. [laughter] And if that’s not enough why don’t you guys start a bank? Jack 00:25:51.083-->00:25:56.088 Henry will help you. Are you ready to start a bank? We have tips and advice. Jack Henry’s 00:25:58.657-->00:26:03.762 one of the major software providers of OFX. More banks there are the um, more money 00:26:03.762-->00:26:07.833 they make the more software they sell, tart a bank. Hey if anybody wants to start a bank 00:26:07.833-->00:26:12.838 like me after this, we can, we can see if we can hack it out tonight. So I learned there are 00:26:14.973-->00:26:19.978 a lot of banks. Like, a lot. US and Canada uh, other countries are much more restrictive but 00:26:23.348-->00:26:28.353 there are, there are according to uh Intuit 15-->000 FI’s, financial institutions. Um about 00:26:32.724-->00:26:37.729 according to, to OFX consortium, 7-->000 banks at 1 time have deployed uh in OFX server. My 00:26:40.098-->00:26:46.939 personal scanning shows about 2-->000 unique institutions on the internet right now. Um, that 00:26:46.939-->00:26:51.910 compresses down to, to 400 unique servers, cause there’s actually a lot of service 00:26:51.910-->00:26:57.116 providers so to like web hosting, OFX hosting companies in this space. But there are a 00:26:57.116-->00:27:02.287 lot of banks in the US and Canada. Many of these are the same company. Like uh when you 00:27:02.287-->00:27:07.659 have a Target branded credit card, that’s an FI, when you have like uh ya know Quiznos 00:27:07.659-->00:27:12.331 branded credit card, that’s considered a financial institution. Uh so, th- it’s, 00:27:12.331-->00:27:17.336 it’s not purely like separate uh business entities. Um, there’s some indication that, that 00:27:19.438-->00:27:24.443 different between the 7-->000 number and the 2-->000 number is a decrease in popularity in people 00:27:27.613-->00:27:32.618 running OFX servers um which is sad but also good cause, cause it’s insecure. As the quickest 00:27:39.458-->00:27:44.463 side, um I got banned for life from Capital One. [laughter] [applause] It’s another story 00:27:50.669-->00:27:55.908 for another time but I was doing these like large uh cash transactions, there was some 00:27:55.908-->00:28:00.846 bitcoin, in retrospect maybe it looked like money laundering or very successful drug dealing. 00:28:03.248-->00:28:08.787 Totally legit though. Uh, I tried opening an account, it’s been 5 years, I’m still banned 00:28:08.787-->00:28:13.525 for life. Uh and I was a little worried though, I was a bit like oh my God, I was just like, I 00:28:13.525-->00:28:19.431 don’t have a bank account. Um, uh and I, had I know, like there’s, there’s 4,999 other 00:28:19.431-->00:28:23.068 people who are willing to take my money so, don’t, don’t worry about getting banned from your 00:28:23.068-->00:28:28.073 bank. So let's go into my, my investigation. Uh this, this now we’re going to go into 00:28:34.212-->00:28:40.319 implementation and deployment. I wanna do a survey. I love Showden. I love just like 00:28:40.319-->00:28:44.189 surveying the internet. I wanna like ya know, I wanna find out, how, how big is the problem? How 00:28:44.189-->00:28:50.796 big is the problem space? I wanna ask these 2 questions. Um, ya know, what financial 00:28:50.796-->00:28:54.166 institutions are going to be running these servers and what, what software they’re running. 00:28:54.166-->00:28:59.171 Two simple questions to ask. Uh here’s the point where I say, my research was only 00:29:03.542-->00:29:08.547 reconnaissance. I am sending packets at live production Fortune 500 company systems, I 00:29:10.682-->00:29:15.687 do not want to even accidentally take 1 down uh or, or gain unauthorized access. So I did 00:29:20.192-->00:29:26.465 very simple recon. Uh like uh enumerating the host and sending DATA requests. Enumerating the 00:29:26.465-->00:29:32.004 hosts, th-that’s the tricky part um up front but there’s this great OFX um, community who is 00:29:32.004-->00:29:38.010 sort of capped the database of these servers um fo4r several years. OFX home dot org uh is 00:29:38.010-->00:29:41.179 the best one, they’ve got a, they’ve got a great website. This is where you can find out 00:29:41.179-->00:29:46.084 how to talk to your bank directly. Uh GNUcash, keeps stop, is uh ya know you google, 00:29:46.084-->00:29:51.023 you google and you find them but OFX dot harm, dot home is the best. Commercial clients, 00:29:51.023-->00:29:55.560 Quicken they have what they call the branding service, you, you put in a name, it sends it off 00:29:55.560-->00:30:00.666 to their server and sends you back a, a URL um for that, that bank name. And the URLs look 00:30:00.666-->00:30:05.637 like that up at the top> Usually a sub-domain uh then some subdirectory in the path and 00:30:05.637-->00:30:11.543 then some uh some server handler. Uh interestingly this is, this is hard to mask scan 00:30:11.543-->00:30:17.582 like it’s hard to script this because you’re not looking for a port, you’re looking for a web 00:30:17.582-->00:30:22.320 service and a path and that path can be anything. Uh so I haven’t, haven’t come up with a 00:30:22.320-->00:30:26.058 good way of ya know sort of finding these out of the ether, you sort of have to know they 00:30:26.058-->00:30:31.063 already exist or ya know call the bank and ask them. So after I numerated a large number of 00:30:34.066-->00:30:39.638 hosts uh we just do a proof of life like just make a TLS connection and see if that 00:30:39.638-->00:30:46.011 things even alive. Uh lot of this data’s stale its from 2011 uh so it’s kind of an archeology 00:30:46.011-->00:30:51.016 adventure talking to servers ya know setup, um 5, 10 years ago. What I find, from a TLS 00:30:56.288-->00:31:01.226 connection uh stale DNS. 232 are still listed in DNS but the IP doesn’t, doesn’t accept a TCP 00:31:04.062-->00:31:10.268 connection, not a big deal like no exploit but it’s sort of like hinting at, at neglect, hinting 00:31:10.268-->00:31:15.040 at okay so someone ya know didn’t clean out their DNS how, how longs that gonna live there? 00:31:15.040-->00:31:20.045 15, that will accept a TLS connection but tell you that their cert is bad and expired 00:31:22.848-->00:31:27.853 for years. So we have 15 horsts that have assumedly my data still on them um but that no 00:31:33.225-->00:31:37.996 one's looking at, on ones maintaining these, these servers, bigger red flag. I’ve 00:31:37.996-->00:31:43.001 connected, let’s send get slash and see what we get like ya know web server profiling 101. Get a 00:31:51.977-->00:31:55.480 lot of banners, sure, okay so not the best ya know configuration didn’t turn off 00:31:55.480-->00:32:00.418 that you’re using IIS. Start getting uh OFX banners, hey this is, this is handy. This is the 00:32:03.722-->00:32:10.362 OFX server version, thanks build number, version number, data release time it was built, very 00:32:10.362-->00:32:15.367 useful for me to start planning my attack. More of the same. Anybody notice something weird 00:32:22.274-->00:32:27.279 about that build date? 2007. Okay, uh their web servers, let’s talk to the OFX web 00:32:31.983-->00:32:36.988 servers. What’s the simplest possible like valid protocol um, uh within spec that I can send, 00:32:42.928-->00:32:47.933 an empty, an empty tag, and empty ya know base tag. Let’s start sending that. Error. Java 00:32:54.573-->00:32:59.578 lang nullpointerexception. Okay parser error, not handling, non-handling, not getting the 00:33:02.214-->00:33:07.219 elements that you think are always there. That’s worth looking into. This is like a 3 00:33:09.387-->00:33:14.392 for. The header is like it starts but then it stops running the header and then the message 00:33:17.195-->00:33:22.133 has 2 spaces ‘cause I didn’t send, I didn’t send a financial IED so it’s doing some sort of 00:33:22.133-->00:33:27.272 print def, uh ya know string replacement of data that I sent in and it’s gonna reflect it 00:33:27.272-->00:33:33.278 back to me. Um this database error, quick google tell, google search tells you it’s uh it’s an 00:33:33.278-->00:33:37.949 IBM DB2 database that returns that error ya know straight from the database into the 00:33:37.949-->00:33:42.954 application server, back to the client. No scrubbing. Oooo. Stack trays, this is what I was 00:33:46.558-->00:33:51.563 looking for. [applause] Getting warmer. Stack trays with a full qualified path on the local 00:34:02.774-->00:34:07.779 system to where the code is and w-what line of the code failed, yes. That was like, I mean I 00:34:15.954-->00:34:20.959 sent nothing, I sent, I sent a header and 8 characters. So let’s switch, now I want like 00:34:24.696-->00:34:28.700 real data, like I wanna, I don’t wanna cause errors I don’t want it to just give me a profile, 00:34:28.700-->00:34:35.006 just tell me about yourself like, first, first question on a first date. Um, send the profile 00:34:35.006-->00:34:41.346 request first part of every transaction that Quickens gonna do. Uh and here’s that, here’s 00:34:41.346-->00:34:46.351 that session uh session token of sorts. Uh that I, I talked about. Um, I, I was signing it 00:34:49.421-->00:34:54.426 as anonymous so first it shouldn’t have given me a session token but it did. Uh and 00:34:56.928-->00:35:02.867 then it’s uh a year long. So this, this server gives out year long session tokens, if I ever 00:35:02.867-->00:35:08.773 steal 1 then I can read your account, ya know password equivalent for, for a year. Uh 00:35:08.773-->00:35:13.778 the profile, eh, response thankfully uh tells me all about the password policy of that 00:35:17.048-->00:35:21.886 server cause I have to send passwords so the client has to know how to validate. Uh this 00:35:21.886-->00:35:27.993 one, at minimum 4 characters, maximum 4 characters. [laughter/applause] Not case 00:35:27.993-->00:35:33.264 sensitive. No special characters allowed, no spaces. Uh I’ll do the math for you. Uh it’s about 00:35:33.264-->00:35:38.269 a million and a half total combinations if you could check 10 a second uh online, take you 00:35:47.345-->00:35:52.917 about 2 days to brute force the entire key space that is possible for all usernames at 00:35:52.917-->00:35:57.922 this bank. Thankfully I don’t remember what bank that is, so I can’t tell you. That was just 00:36:03.595-->00:36:08.600 asking for anonymous information. Uh third and last uh sort of query uh I did, uh 00:36:11.136-->00:36:17.776 was give me an account list for anonymous user which is ya know specified in the spec, you can 00:36:17.776-->00:36:23.348 send this anonymous user this well-known string uh I should definitely get an error right? I 00:36:23.348-->00:36:28.353 should get either uh unath- ya know authentication failed or no accounts found. Simple, easy to 00:36:30.388-->00:36:35.393 program, 2, 2 errors cases. Here is what that request looks like, this is the entire request, uh 00:36:37.862-->00:36:42.867 very small just asking for account info and here uh is the error message. Or error 00:36:46.471-->00:36:51.476 messages. Same request sent to about uh 2-->000 different servers, this is a subset of the 00:36:57.682-->00:37:04.155 error messages I got back. How, how many different implementations are running out 00:37:04.155-->00:37:09.160 there? How many different configurations, what. Sign on invalid. Unsupported operation 00:37:11.429-->00:37:16.434 for anonymous. General error. User ID password combination incorrect. How many, how many 00:37:19.070-->00:37:24.075 ways to say, like I failed login. So, let's talk about the financial vendors. Whose, who's 00:37:26.911-->00:37:32.917 building this software and how many implementations are there? Uh this is uh, this is a great 00:37:32.917-->00:37:37.155 little chart, not mine. It’s from 1 of the financial software vendors explaining bank 00:37:37.155-->00:37:43.995 software. 3 parts you need to know. On the left you have what they call the core. The core is 00:37:43.995-->00:37:48.900 a database and batch processing. It makes sure the bank knows how much money it has at the end of 00:37:48.900-->00:37:54.873 every day. Uh in the middle uh is middleware. Uh that’s every bank service customer facing 00:37:54.873-->00:37:59.878 server that you’re familiar with, bill pay and um remote deposit and dealing with your 00:38:02.280-->00:38:07.285 ATM. And then user experience, mobile web on, on the right. 3 pieces. Every square on this 00:38:09.587-->00:38:14.592 diagram can be provided by a single vendor or the same vendor in the financial software world. 00:38:19.397-->00:38:24.402 Imagine the combinations of complexity within the bank IT system when and this definitely 00:38:27.272-->00:38:32.277 happens, every one of these squares is a different vendor. These are not shrink wrapped 00:38:35.713-->00:38:40.718 boxes or apt installs or ya know app stores. Uh these are a high touch call to talk to sales 00:38:44.856-->00:38:51.429 negotiated deals for online banking solutions, all these servers don’t even have names 00:38:51.429-->00:38:57.302 they’re just the solution provided by the company. And OFX is, is 1 very small part of this 00:38:57.302-->00:39:02.240 ecosystem. Often a deployment like this, uh involves custom development per bank. Not custom 00:39:06.244-->00:39:11.683 deployment, custom development like code written just for bank A and then different code 00:39:11.683-->00:39:18.556 written just for bank B because ya know abstract uh doesn’t exist. I, I mean it’s vendor 00:39:18.556-->00:39:23.761 lock in obviously it’s a way, it’s a way for the vendor to, to ensure they’re be, they’ll get 00:39:23.761-->00:39:28.766 the re-up on the next contract. Here’s a list from Intuit on the banks that support, uh support 00:39:31.903-->00:39:38.042 the vendors that support OFX, this is their official list. I found 9 more not on this list. 00:39:38.042-->00:39:44.515 Assumedly they’re no longer like ya know preferred partners or some such. So we’ve got uh, 30 00:39:44.515-->00:39:50.755 plus different vendors of, of this singular protocol. Uh these are the big guys, I, I didn’t 00:39:50.755-->00:39:55.360 have enough data unfortunately to give you like who's the biggest uh apples to apples 00:39:55.360-->00:40:01.799 comparison. Just a couple of names FIS and fiServ. They’re uh multibillion dollar companies, 00:40:01.799-->00:40:07.405 there the, there the Microsoft and the Googles of, of banking software. Uh then Enterprise 00:40:07.405-->00:40:12.543 Engineering and Q2, they’re um, they’re sort of the up and comers, they they’ve established 00:40:12.543-->00:40:18.483 themselves, seeing a lot more severs um with advertising themselves as, as these 2 00:40:18.483-->00:40:24.989 companies. Uh it’s a little small but uh the Enterprise Engineering logo says, the name 00:40:24.989-->00:40:31.296 to trust for financial data solutions. I don’t want to make fun of them but it’s on their 00:40:31.296-->00:40:36.301 website which is not over HTTPS and they forgot to pay their Google platform API bill. You 00:40:40.138-->00:40:45.143 can go there right now, it still looks like this. We all have bad IT days like the people who 00:40:48.946-->00:40:54.152 built the website are not the people who build the OFX software, I know but if you put 00:40:54.152-->00:40:59.357 the trusted name in financial software on every page you should not have this page can’t 00:40:59.357-->00:41:04.295 load google maps correctly also there. And then there’s the hosting providers. Uh who play a 00:41:07.332-->00:41:12.870 big role, so 2 thirds of these, these FI’s are behind hosting providers uh now, it’s like 00:41:12.870-->00:41:16.708 everyone going to the Amazon cloud and Azure everyones, everyones ya know going to 00:41:16.708-->00:41:20.411 hosting providers. For a good reason right? They can do, they can do a better job at security 00:41:20.411-->00:41:26.117 than your ma and pa like credit union in your town of 4-->000 people. Uh their security is 00:41:26.117-->00:41:31.823 better. Not good, but better than the, the soft hosted ones. Um, I don’t fully understand all 00:41:31.823-->00:41:38.296 the backend details um between the OFX servers I’m just poking it from the front um, but uh a 00:41:38.296-->00:41:45.103 lot of these are batch jobs so like the, the, the ya know your OFX server sits in some data 00:41:45.103-->00:41:50.441 center and it pulls and gets you transactions like every 24 hours so that’s why if you’re actually 00:41:50.441-->00:41:56.214 using Quicken or something you don’t see you’re, you’re credit card um transaction ASAP. 00:41:56.214-->00:42:01.386 There’s a, there’s a batch processing in the back end. A bunch of different stacks of 00:42:01.386-->00:42:06.424 course across 35 development vendors. Um this is mainly just server headers there’s a lot of 00:42:06.424-->00:42:11.696 IIS but there’s plenty of Apache there’s a whole long tail. Some of these are custom HTTP servers 00:42:11.696-->00:42:16.701 written by the, the OFX provider. And there’s a ton of acquisition. Uh banks love M&A. 00:42:20.705-->00:42:22.707 Like, like divestiture and, and acquisition. Uh these are compilers and debuggers to 00:42:22.707-->00:42:25.309 banks. Like they just do this everyday over and over again. Spin this company out, buy that 00:42:25.309-->00:42:29.147 company back uh we do this in tech too, uh it’s not, it’s not a bad thing but we all uh if 00:42:29.147-->00:42:33.117 you’ve been through an acquisition you know like sometimes the new company 00:42:33.117-->00:42:38.122 totally forgets about the tool you wrote and it just atrophies uh so there’s a ton of that in 00:42:41.626-->00:42:46.631 this industry. This, this is from FIS, 4 of these names up here had ya know first party OFX 00:42:50.134-->00:42:55.173 servers and then they got acquired, and then, and then things went downhill. The 00:42:55.173-->00:43:00.111 vulnerabilities. So quick math this is not like a PhD level uh algorithm that I applied. Um, 00:43:07.785-->00:43:14.792 but across this much complexity I’m pretty sure there’s a lot of vulnerabilities and I mean as 00:43:14.792-->00:43:20.098 you saw like none of these are zero days and these are I got your money. But like from 00:43:20.098-->00:43:24.669 sending a get request there shouldn’t be this much smoke. The- it sho- there shouldn’t be 00:43:24.669-->00:43:29.440 this much bad from the level of effort that I had to put in with a web browser and curl. On the 00:43:29.440-->00:43:35.780 left uh it’s a list of stuff that I already talked about. On the right are things that I 00:43:35.780-->00:43:41.719 don’t have time to talk about. Uh I have a bank that still uses my social security number as the 00:43:41.719-->00:43:47.158 username for OFX. Not for the website but for the OFX protocol I gotta use my social security 00:43:47.158-->00:43:53.397 number. Um the, I found some unregistered URLs you can ya know you can, ya wanna start a 00:43:53.397-->00:43:58.402 bank? And reflexive, reflected process scripting, I know it’s not HTML and yeah I got an XSS 00:44:01.105-->00:44:06.110 attack here. Okay. Let’s play along at home. So uh everything I did, I, I hacked together in 00:44:14.886-->00:44:19.490 python but I wanted to give it to you guys so that you could try it too. Professional pen 00:44:19.490-->00:44:23.995 testers for financial institutions. For people writing this software let’s like lets 00:44:23.995-->00:44:28.699 build a tool let’s make this better. Uh it’s not actually on GitHub it’ll be there in a 00:44:28.699-->00:44:33.704 couple of days but it is real and it does exist and I’ll show it to you now. See my tool uh 00:44:46.851-->00:44:51.389 it’s gonna go through and sort of do what, what um what I showed you. Take us a couple 00:44:51.389-->00:44:55.826 arguments, the, the URL the server you want to talk to, optionally the financial ID if 00:44:55.826-->00:45:01.332 you know it, it’s not, it’s not always required. Uh you get this all from OFX home dot org. You 00:45:01.332-->00:45:06.904 can find your bank uh and, and run it against it right now. Send some queries, does some 00:45:06.904-->00:45:11.909 analysis, scroll back up and went sent that git to slash we sent the uh post OFX path we 00:45:18.182-->00:45:23.187 sent the empty OFX payload. We, we store those all uh locally and then we just scan through 00:45:25.189-->00:45:31.362 them. Uh from that profile data uh we’re gonna get financial institution, make sure that’s 00:45:31.362-->00:45:36.367 the real one you want to talk to. Um their address, their info uh we’re gonna get, that OFX 00:45:38.436-->00:45:44.976 sort of header version information. Running 102. Um, this is a service provider LAN 00:45:44.976-->00:45:49.981 extra. We’re gonna get the capabilities, uh sort of in this um markdown format, it’s a 00:45:52.316-->00:45:57.321 banking server, they do support transfers. Fingerprint, it’s throwing Apache Tomcat. Couldn’t 00:46:00.024-->00:46:06.430 figure out the web framework, software fingerprint, uh Finastra is the company uh that 00:46:06.430-->00:46:10.468 built the software, it’s called Cavion, figured that all out from what they told me, couldn’t 00:46:10.468-->00:46:15.773 get the version number and a couple simple tests, they fail MFA immediately cause they’re 00:46:15.773-->00:46:20.778 running 102 and their password policy is also not very good. So uh Sunday maybe, it should be up 00:46:24.081-->00:46:29.086 if not Monday. Um you can check my Twitter and I’ll, I’ll have, I’ll, I’ll post as soon as uh, 00:46:33.557-->00:46:38.562 up and available you can download and you can run it. [applause] OFX is your banks 00:46:46.637-->00:46:51.642 digital side door. It’s not a backdoor. Uh that’s like hidden in secret, the front door uh 00:46:55.413-->00:47:01.252 th-that’s the web app and that’s, that’s the mobile app. Uh it’s the front door but with 00:47:01.252-->00:47:07.458 less care and less security and less attention. It’s the side door. Uh we all know that 00:47:07.458-->00:47:12.463 attackers are gonna go for the weakest door into your finances. It’s a sad story. I don’t wanna 00:47:20.404-->00:47:25.409 be a downer but uh neglect is the word that kept like jumping into my mind. Uh it’s a lack of 00:47:28.479-->00:47:33.884 investment. Uh I’ve, I’ve talked to bankers, I’ve talked to bank IT guys, um they I, I mean, they 00:47:33.884-->00:47:38.889 literally say, uh we pay the system integrator, they, they install everything, um 5 months 00:47:41.959-->00:47:47.364 later I call them again they give us the upgrade. That’s, that’s the state of a lot of IT 00:47:47.364-->00:47:52.370 in 2018 at, at your local financial institution. It's an even sadder story for the 00:47:55.106-->00:48:00.044 consumer because this was 1997, like we had an open protocol with programmatic access to our 00:48:02.947-->00:48:07.952 finances, no vendor lock in, like no, no loss of privacy just you and your bank and it didn’t 00:48:11.155-->00:48:15.526 g- it didn’t go anywhere, it di- it didn’t take off like it should have. Like how much, how 00:48:15.526-->00:48:22.199 much better could our banking experience be today if Microsoft hadn’t like ya know stopped c- 00:48:22.199-->00:48:27.204 stopped competing? I wish my bank uh would have started when it was younger but it’s never 00:48:32.143-->00:48:38.649 too late to plan for retirement. When you set up a server like have a plan on wh- how you’re 00:48:38.649-->00:48:41.185 gonna take it down. When you deploy a TLS certificate like make a, make a Google calendar 00:48:41.185-->00:48:47.224 like message to when you, when you have to update it. Monitor you finances, monitor, monitor 00:48:47.224-->00:48:52.229 your network. Uh know, know what you’re running, uh know every service you’re running, not 00:48:58.602-->00:49:03.541 just, not just the front door. This was only recon. Uh 1 protocol, 1 endpoint in a rats 00:49:09.647-->00:49:15.286 nest of bank middleware. Uh I had fun, I’m gonna keep building off of this, I’m gonna keep uh 00:49:15.286-->00:49:20.758 building up that tool, uh if anyone wants to help, PRs are welcome. If anyone's from a bank 00:49:20.758-->00:49:25.763 and wants uh, ya know wants to tell me more. Good stories. Uh would love to talk to you. Uh 00:49:29.400-->00:49:34.405 all of you please take the research uh build off of it and, and help make our personal 00:49:40.911-->00:49:44.748 finances more secure. Thank you. [applause]