00:00:00.033,00:00:04.605 >>Today we're going to be talking about Hypebots, uhm, if you're acquainted, you already 00:00:04.605,00:00:10.210 know what this is. But if you don't, uh, you might see these online as "Sneekerbots", 00:00:10.210,00:00:15.249 "Supreme Bots", Adididas, ZZ bots, uh, they're everywhere and they're a big deal and they're a 00:00:15.249,00:00:20.254 big reason why I look so good today. So, we're gonna talk about Hypebots. So, who am I? 00:00:24.224,00:00:30.731 This was a, a good question [chuckle] Uhm, my name is Fennel Phoenix, I live in Shanghai, 00:00:30.731,00:00:36.136 China. I'm basically the Jane Goodhall of bots. I cam to live among them and learn about them 00:00:36.136,00:00:42.543 because China - as we all know, as security professionals, is where bots live. So, I started 00:00:42.543,00:00:49.182 in 2012, and, I wanted to buy a dress. This all started with a dress - it wasn't ZZ's or 00:00:49.182,00:00:53.820 anything like that, it was 1 dress and it was something I could never buy because it was 00:00:53.820,00:01:00.527 me and like a 100 other Chinese girls. And we were all fighting in 1 minute to get this Japanese 00:01:00.527,00:01:05.732 dress and I said "There has got to be a better way!". So, I decided, because I was working 00:01:05.732,00:01:11.571 in a marketing agency at the time, I had to write unit tasks. I had to optimize all my code 00:01:11.571,00:01:18.211 that there had to be the same way I could get this dress faster than everyone else, and 00:01:18.211,00:01:23.216 since I was writing code for bots to crawl, what if I became a bot? So, I got that dress and 00:01:26.386,00:01:31.391 then I became a little mad with power and I got sneakers and streetwear and everything else 00:01:34.328,00:01:40.801 and now I use it for Korean pop concerts and purses shaped like teddy bears. And why did I start 00:01:40.801,00:01:45.806 this? Because competition sucks, you want to look good, you want to be adored by all on Instagram 00:01:48.375,00:01:51.712 and you're fighting and you're fighting and you're fighting and you can't get anything. And I 00:01:51.712,00:01:56.717 said "I will become the Google, I will become a bot". Why bots? Why now? We built the internet 00:02:02.923,00:02:07.928 for bots. To be fair, I think we have done writing bots a lot longer than we remember. When I 00:02:10.263,00:02:16.636 was very young, I would write fortune bots IRCs because I thought the Unix fortune command 00:02:16.636,00:02:21.441 was the most hilarious thing ever, at 12-years-old. And so I liked to spam all the channels 00:02:21.441,00:02:27.114 on my IRC server with fortune commands. And, of course, that evolved into the ubiquitous 00:02:27.114,00:02:32.519 playing bots that everyone hates me for because no one wants to know that you're listening to 00:02:32.519,00:02:37.524 the "Dance Dance Revolution" soundtrack for the 30th time. And then, these IRC bots moved 00:02:39.860,00:02:44.865 to HTTP with the release of AOL web crawler. This was in 1994 - so that as a very long time ago. 00:02:48.235,00:02:53.473 And at the time web crawler was released, the internet was not written for robots. Web crawler 00:02:53.473,00:02:59.980 only did 1 thing - it scraped other web directories to make sure that AOL had the most 00:02:59.980,00:03:04.985 listings. Our, our bots on IRC grew up into bigger bots and then botnets and then in 2007 we 00:03:09.189,00:03:14.194 saw botnets move to the world wide web. And now, in 2019, 50 percent of the traffic on the 00:03:16.930,00:03:21.935 internet is automated. In 25 percent of that traffic are the bots we're talking about today. 00:03:24.237,00:03:29.176 They don't just purchase shoes, of course, they don't just purchase supreme super soakers - 00:03:29.176,00:03:34.181 which I lost. They purchase stocks and everything else. This is a large attack landscape. So, 00:03:39.152,00:03:45.625 this isn't about our IRC fortune bots, this is about web crawler and how we turned it into a 00:03:45.625,00:03:50.630 monster. Web crawler at the time was a good little bot. And then Google said "I have an idea, 00:03:54.367,00:03:59.906 instead of writing websites, like directories and just crawling those other 00:03:59.906,00:04:04.845 directories, you write your website for robots. You tag your HTML, you add metadata, no 00:04:08.882,00:04:14.554 double div-IDs" - all sort of things that we do now, as a web developer, to make sure that 00:04:14.554,00:04:21.194 Google can crawl our site as fast as humanly possible. And, of course, as our websites grew 00:04:21.194,00:04:26.800 up from geo cities into large scale web applications, we needed it to be reliable. Not 00:04:26.800,00:04:31.872 only because we didn't know when Google bot would do a health check, but because we wanted 00:04:31.872,00:04:36.877 reliable, predictable processes to support our ecosystems. So, we got into APIs and then 00:04:39.212,00:04:44.217 finally we need to make a reliable, stable FEO to the max website that allows you to 00:04:46.853,00:04:53.193 purchase and spend money as easily and fast as human possible. As, "as one-click as 00:04:53.193,00:04:59.499 possible", as Emma Zahn would say. This is the internet of today, it's not written for us, 00:04:59.499,00:05:04.437 it's written for robots. So, a lot of you know what test-driven is, driven development is. And, 00:05:07.974,00:05:13.513 as full disclosure, I hate writing tests, therefore I hate test-driven development. But, if 00:05:13.513,00:05:20.086 you're writing tests right now, you're writing bots before you even have a product to buy. 00:05:20.086,00:05:25.158 You're writing a botable website and you're writing the blueprints for this botable 00:05:25.158,00:05:30.664 website and you're 1 evil genius moment away from getting a closet full of sneakers and 00:05:30.664,00:05:35.669 supreme - like your speaker. So, why do we write tests? A lot of people have like super ethical 00:05:42.909,00:05:49.049 medium blog posts about them, you know, "I want to get 100 percent pass or 100 percent 00:05:49.049,00:05:52.552 coverage or I want to make sure my junior devs know what they're writing and not breaking". So, 00:05:52.552,00:05:57.557 these are all ethical reasons, but of course, we all know 1 thing - capitalism encourages 00:05:59.626,00:06:04.564 bad behaviour. When you add money into the mix, if I told you, you could make your monthly 00:06:07.734,00:06:14.674 paycheck written a unit test, would you do it? Of course you would! It would be much easier 00:06:14.674,00:06:19.679 to make your monthly paycheck on a Saturday, listing some supreme on, uh, Instagram, than it is to 00:06:21.715,00:06:26.720 solve complex problems. And this is where purchasing bots really shine. Because now we have an 00:06:30.624,00:06:35.629 ecosystem, of people encouraged by capitalism to act badly. So, I'm gonna put this in an "us 00:06:40.500,00:06:46.539 versus them" dichotomy. Because no one in this room or this stage is a malicious, uh, 00:06:46.539,00:06:51.511 corporate, money-making, reselling machine that just churns out, you know, tons and 00:06:51.511,00:06:56.516 tons of supreme. We are just victims of the free market, We just want likes and adoration 00:06:58.785,00:07:03.990 and clout, most important thing. And to write to our friends that we have the latest and greatest 00:07:03.990,00:07:08.995 from any one of these companies - Balenciaga etcetera. Why do we bot? Because resellers bot. We 00:07:13.933,00:07:19.506 are competing against people who are trying to make a profit ad we are just trying to wear nice 00:07:19.506,00:07:26.246 clothes. So the only way we can do this is to optimize our checkout process. Buy as fast as 00:07:26.246,00:07:30.884 humanly possible, well, that's not working anymore. Now we need to buy as fast as 00:07:30.884,00:07:37.590 programmatically possible. So, now we have computers using computers. This, of course, is 00:07:37.590,00:07:42.595 not why they bot. Now, I have friends that are resellers and as much as I want to think of 00:07:44.898,00:07:50.270 them a these fashionable demons, living in penthouses in San Francisco with hot tubs full of 00:07:50.270,00:07:56.142 Cristal and the latest kicks - I can't really hate them that much. So, I, I still love you 00:07:56.142,00:08:01.881 resellers, even if you make my life a little bit difficult. These people buy up all the 00:08:01.881,00:08:06.886 inventory of any given product and then they control the price of that product. Uhm, when a 00:08:09.289,00:08:16.129 hypebeast like me, loses a drop or a, a purchasing window - which is now only 1 minute or 00:08:16.129,00:08:21.134 less on very high in-demand items. We will do anything, we will pay any money, right after, 00:08:23.336,00:08:29.542 to say that we won. So that we can be like "Oh, yeah, I got that shirt, I got Akira, uhm, 00:08:29.542,00:08:34.547 jacket from Supreme." So, resellers will markup 2, 3 even 7 times the price right after 00:08:39.185,00:08:44.190 they have purchased all the inventory. And, hypebeasts are willing to pay 7 to 10 to even a 00:08:46.426,00:08:52.999 100-times the retail price for a pair of shoes, for a shirt, for a lighter that says "Supreme" on 00:08:52.999,00:08:58.004 it. We encourage this behaviour because we will pay anything to win. And so, they know that when 00:09:02.709,00:09:08.081 they have a market, a captive market with people looking for clout, so they scale this up to 00:09:08.081,00:09:13.086 a thousand, millions! So that they can make money off of us. And they make my salary in a 00:09:15.455,00:09:20.460 month - not just my paycheck. So, everyone's probably not here to hear about the ethics of 00:09:24.864,00:09:29.869 botting, but about how bots work. Bots are simple answers to complex systems. Now, bots that 00:09:36.342,00:09:41.181 you buy online will be like "We have some secret sauce", you know, "We had like the most 00:09:41.181,00:09:46.186 brilliant MIT graduate coder bot". But really, they all have the same core principals. There 00:09:50.723,00:09:57.530 are 2 types of bots in the wild - there's a low-level bot, these are the most stable bots. All 00:09:57.530,00:10:02.535 they do is they go behind the UX-layer and they use APIs that are built to support our site 00:10:05.972,00:10:11.678 and go from call to call to call. This is much faster than using a website as a human 00:10:11.678,00:10:18.585 being. And it's much faster than using a browser-based bot. But also, it takes a lot of time. 00:10:18.585,00:10:24.090 You have to reverse-engineer all the calls, all the headers, all the, the form data and 00:10:24.090,00:10:29.963 everything else. But it's also easily scalable and very cheap. So, you will see these bots on 00:10:29.963,00:10:35.735 scales of thousands to millions of calls per minute. On the other end, there's browser-based 00:10:35.735,00:10:40.840 bots - we'll take a look at how to code these today. Because, they're very easy to get started 00:10:40.840,00:10:46.513 and give you the feeling of how you should be coding these boots. Uhm, it's just a 00:10:46.513,00:10:52.318 puppeteer test, uh, and it mimics the user by loading the browser and walking through a 00:10:52.318,00:10:57.991 checkout flow. This is very easy to do and if you've ever write, written a puppeteer's test, you 00:10:57.991,00:11:04.731 know how easy it is. Uh, it's harder to catch because in puppeteer you can mimic , a 00:11:04.731,00:11:09.736 human being by mouse-clicks, or typing slower or adding waves, or scrolling around which you 00:11:12.405,00:11:17.110 can not do with a low-level bot.A low-level bot is programmatic, now matter how you 00:11:17.110,00:11:22.115 hide it - with weights, or with different unit agents. And, even though browser-based bots are 00:11:25.084,00:11:29.789 easier to write, they're more expensive to scale into the computing power that's required 00:11:29.789,00:11:34.794 to run, uh, Chromium or Firefox or what have you. No bot on the internet today is one or the 00:11:38.331,00:11:44.804 other - both bots, and I will show you, are both of them combined. Because companies are 00:11:44.804,00:11:49.642 not interested in making everything easy for us, so we must find new ways to solve the 00:11:49.642,00:11:54.647 solution. So, no bot is just one script, they're usually a team of guys no one 10 X bots here. 00:12:00.153,00:12:05.158 They all work together to get us what we need and what we need fast . So, the first ever crew 00:12:07.894,00:12:12.899 is the monitor bot - the monitor bot is our scout, he runs constantly, never tires out, he 00:12:15.501,00:12:21.374 scans websites all the time looking for the link or the droptime to make sure that you 00:12:21.374,00:12:26.379 get off the line at exactly the right time. Because if you're too late or even too early, 00:12:29.482,00:12:34.487 you're, you're out of the running. Next is the account bot, the account bot is 00:12:36.689,00:12:40.393 something that generates user accounts and you might say, "Well, why do I need user 00:12:40.393,00:12:46.699 accounts to purchase something?". Because a lot of sights, they, tor high-key items 00:12:46.699,00:12:51.704 or for link, very desired items, they don't let non-users purchase. And you need to access 00:12:54.173,00:13:00.446 an API ecosystem most of the time and those are only for auth users or authorised users. And, 00:13:00.446,00:13:04.884 of course, you're trying to make a little bit of a profit so they might have coupons or discounts 00:13:04.884,00:13:11.658 for logged in users which may make your profit margins a little bit higher. Buy-bot is 00:13:11.658,00:13:17.630 the most sexy of the bots, he's got the secret sauce, he's what everybody wants to see. Uhm, 00:13:17.630,00:13:24.170 he's also the most expensive, his only goals is to run through checkout, by any means 00:13:24.170,00:13:29.175 necessary,uh, so, we'll look at all of these guys today, except for sell bot. You remember a few 00:13:33.012,00:13:38.151 years ago that these bots on Amazon were getting into bidding wars with each other to resell 00:13:38.151,00:13:43.156 books, and they were bid up 1 cent more than the other bot and they got upto 3 to 13-million 00:13:45.325,00:13:50.329 for some used college textbooks. Which, fair, I felt college textbooks cost while I was in 00:13:53.933,00:13:58.938 college but these are what sell bots do - they list n Stock X, or Goat, or Grailed , uhm, 00:14:01.074,00:14:05.678 automatically and run through the selling processes as well because the scale that we're 00:14:05.678,00:14:09.982 talking about is in the thousands. And you're not gonna be able to sell thousands of 00:14:09.982,00:14:16.989 shirts thousands of lighters or thousands of K-pop tickets, uh, all on your own. So, we won't be 00:14:16.989,00:14:21.994 looking at sell bots today but they're basically buy bots in reverse. So, here is our first 00:14:25.031,00:14:30.036 bot - it's a very easy bot to write and if you've written a test before,you know what this 00:14:32.271,00:14:37.276 looks like. This is a puppeteer test that goes to a website and looks through a div and expect 00:14:40.713,00:14:45.718 it to be truthy. In fact, my first first bot that I wrote was a bastardised version of a just 00:14:49.288,00:14:55.661 test that went through and even did, like expect true, expect false, the entire time it was 00:14:55.661,00:15:00.666 running through the purchase which wasn't necessary but made me feel better to see all that 00:15:00.666,00:15:05.671 black and green scrolling down. And I was like, uh, I finally have hacked my way into fashion. 00:15:08.574,00:15:13.579 Okay, so, this doesn't really purchase anything. Let's make it work, if you look at this, this 00:15:15.882,00:15:21.687 is the actual purchasing bot. We're going to a target site, we're looking for a specific 00:15:21.687,00:15:26.692 product and then I used the, uhm, keyboard to make it look, uhm, like a user was typing in 00:15:30.029,00:15:36.068 and going through the website to make it more credible. Their user was gonna come by, a 00:15:36.068,00:15:41.774 legitimate user instead of a robot. Then, we go through the checkout and as you would see at 00:15:41.774,00:15:46.779 the bottom, like, the checkout form being filled out. So, I'm going to show you this in 00:15:49.215,00:15:54.220 action. Making this... I haven't used Windows in a long time. Oh, there was a full screen button 00:16:20.112,00:16:25.117 right there, so, here's a test, it's 50 lines of code. You can see there, and all we're doing 00:16:29.455,00:16:34.460 is running to a website and trying to purchase Happy Pap mode. I used Bodega sotre which 00:16:37.663,00:16:43.502 is a streetwear store, hosted by Shopify, I'm sorry, Bodega Store. And you can see, it, it's 00:16:43.502,00:16:48.374 kinda slow this is because I'm running it in head full mode which opens the browser and goes 00:16:48.374,00:16:54.213 through and shows you, like what the bot is actually doing and you can see it's just running 00:16:54.213,00:16:59.418 through the check out as fast as I can. When you run it in headlift mode, it's obviously 00:16:59.418,00:17:04.357 quite a bit faster. So, you go ahead and auto-fill out all of the shipping. A lot of bots like 00:17:06.459,00:17:11.864 to use paypal because paypal cookies can be stored in a script and you can just run 00:17:11.864,00:17:17.136 through paypal with a cookie for their one touch, like we said, it's as quickly as one quick as 00:17:17.136,00:17:22.875 possible. Uhm, and go ahead and, and purchase, so, you can see it's all going to paypal and it 00:17:22.875,00:17:28.748 all automated. So, that is your first bot and that was actually my first bot too. Back in 2012 00:17:28.748,00:17:34.620 it was like beautiful suits at the time and not fancy puppeteer. Uhm, but yea, so, it 00:17:34.620,00:17:39.792 was an easy first bot. I think that everyone here could write that - it took me about 20 00:17:39.792,00:17:45.464 minutes. The problem with these bots is that their'e not very stable because they depend on 00:17:45.464,00:17:50.469 the UI. So, if, between submitting my CFP for DefCon and today - I've had to write, 00:17:52.838,00:17:59.412 rewrite this bot twice, uh, because they changed the div for the search and they changed the 00:17:59.412,00:18:04.350 div for, like, the actual checkout. Okay, let's check out more bots. So, when do we run 00:18:19.365,00:18:25.504 this simple bot? Well, there's one rule of botting - " always be checking" And not just one 00:18:25.504,00:18:30.509 site either, all sites, you know we'll have the, the item you're looking for, in stock. So, how 00:18:32.578,00:18:38.684 do we check... Well that's the job of our monitor bot, so let's look at the code for a simpler 00:18:38.684,00:18:43.589 monitor, you might be like "Oh my goodness, this was just an XML parses - and you're 00:18:43.589,00:18:48.861 correct!. Remember when we talked about Google coming in and saying "Hey, alsides, code 00:18:48.861,00:18:55.601 your, code you're web, one way for my bot. But we're gonna piggyback off of that. All sites 00:18:55.601,00:19:01.507 for that bot, for that Google bot have to have a site map and the site map usually now is 00:19:01.507,00:19:06.979 automatically generated by a content management system. And, generally, when we're look at 00:19:06.979,00:19:13.052 these e-commerce stores, they have the drop ready to go, just not published or visible from 00:19:13.052,00:19:18.057 the front end. Well, it's still in the sitemap so all we have to do is look at the sitemap and 00:19:20.393,00:19:27.366 grab it and then query the page until it goes live. So, this is what we're doing here. We're 00:19:27.366,00:19:32.371 just going into the sitemap and searching for what we're looking for. So, we're gonna look at a 00:19:36.175,00:19:41.180 simple monitor. So, you can see this one is only 54 lines of code. And that's it, it just 00:20:05.738,00:20:12.044 looks up from the sitemap and the sitemap is always updated when Shopify updates the store. 00:20:12.044,00:20:18.284 So, now you have the link, the go live link for the, uh, given to Google before it's given to 00:20:18.284,00:20:23.289 the consumer - I'm sorry, Shopify. So, how can we make this monitor bot better? Well, 00:20:32.998,00:20:39.038 because we'll be querying this XML a lot, we need to run these through a proxy because we don't 00:20:39.038,00:20:44.043 want this to be, we don't want to show people that we're just 1 guy at 1 IP, running the same 00:20:46.345,00:20:49.882 request over and over - that's a good way to get blocked. So, let's run through a rotating 00:20:49.882,00:20:56.288 proxy. And then let's make it a little better and let's also change our user agent each time 00:20:56.288,00:21:02.695 we query and we need to make some money, because we're obviously going to be spending a 00:21:02.695,00:21:08.000 lot of money. So, within the hypebeast community and the people who run these bots, there 00:21:08.000,00:21:13.305 are these groups of people called "Cook Groups" they run in Discord chats and you have to 00:21:13.305,00:21:19.311 pay 15 to 30 dollars to be friends with these people. I used to pay money for Ops and 00:21:19.311,00:21:24.316 IRC and now I have to pay money for fashionable friends. [laughter] So, we need to make 00:21:27.319,00:21:33.192 this bot close to Discord so that I can be cool and get money. You can also create an 00:21:33.192,00:21:38.197 API endpoint for these bots and have people subscribe to that but that's not as pretty. So, 00:21:38.197,00:21:45.070 let's look at a fancier bot. You can see that this just runs through a public proxy API, 00:21:45.070,00:21:50.075 grabs the closest public proxy and then, uh, goes ahead and posts to discord. And if it 00:21:54.747,00:21:59.752 fails, try and try again. Cause you should always be checking. So, you can see this bot is a 00:22:04.990,00:22:09.995 little bit longer because we have the user agent, randomizer and also the proxy. So, one 00:22:18.304,00:22:25.010 thing I want to say after seeing this, I used a note package to describe a random user agent. 00:22:25.010,00:22:28.581 [laughter] Please restrict your user agent to something believable, this one is running 00:22:28.581,00:22:33.085 Linx, which is not very believable and probably will make you stand out like a sore 00:22:33.085,00:22:38.090 thumb when you're trying to, uh, request some, some sitemaps. So, this one ahead found the item 00:22:41.227,00:22:46.532 which was a sock. And then posted it to Discord and now people can pay me money to 00:22:46.532,00:22:52.905 subscribe to my bot. This is very often for people, or common behaviors for people who are new 00:22:52.905,00:22:59.044 to the entire scenes, is they will subscribe to a monitor bot that has been configured and 00:22:59.044,00:23:03.983 have to do less work. But we'll talk about that a little bit later. Oh... Okay, so now it's 00:23:22.868,00:23:28.774 time for the piece de resistance. The most realistic bot we have today, which I call 00:23:28.774,00:23:33.779 the "complicated bot". This bot waits for the monitor bot to return an "Okay" in the link and 00:23:35.848,00:23:40.853 then runs through an API-based purchasing flow. So, you can see, this is a very long bot. 00:23:53.399,00:23:58.404 Uhm, because we have basically promise chain help but it works. The other thing to know is that 00:24:01.407,00:24:07.246 shopify does have an anti-bot measure, so this is what would, would be considered a hybrid bot 00:24:07.246,00:24:11.884 because each time in the checkout process, you must download the Dom and then pull 00:24:11.884,00:24:17.923 out the secret key that is embedded in the form field. And then pass it along for the next 00:24:17.923,00:24:24.163 request. This slows my bot down by, like, point 2 seconds each time. So, it's not a very 00:24:24.163,00:24:29.168 effective way but this is a very common way for websites to have an anti-bot measure. They say 00:24:31.870,00:24:37.543 bots are only using APIs, they will never query the Dom so they will never see this secret key. 00:24:37.543,00:24:41.347 But when you're reverse-engineering you see that secret key, you're like where's 00:24:41.347,00:24:46.785 this security key coming from? Well, it's coming from the Dom and another popular e-commerce 00:24:46.785,00:24:51.790 site that uses this secret key is Blue Commerce - they hide it in C-data at the top, they 00:24:54.893,00:25:01.567 generate the secret key and the nonce in Javascript. Uh, so you can just pull it out. We'll talk 00:25:01.567,00:25:06.572 about why that's important in a little bit. I don't know if that's an O-day or just sad. So, 00:25:15.314,00:25:19.084 how can we make this better? It's gotta be something complicated cause these bots 00:25:19.084,00:25:24.089 cost a lot of money online, uhm, so there's gotta be something more that has to happen to make 00:25:26.792,00:25:31.964 this bot worth 15- to 20-thousand dollars. Uhm, one thing you should be doing is 00:25:31.964,00:25:37.035 monitoring multiple outlets. [sneeze] There are many, uh, e-commerce retailers that will 00:25:37.035,00:25:42.040 have a drop of the same item. Try everything, it increases your odds. Uh, another thing 00:25:44.510,00:25:49.214 that you would do is you purchase verified accounts in bulk, off of LE express - and 00:25:49.214,00:25:54.920 we'll talk about how those happen in a second. If it can be a variable, it should be. Right 00:25:54.920,00:26:01.026 now you're creating thousands, if not millions of requests to 1 website. So it's really hard to 00:26:01.026,00:26:07.433 get lost in a crowd unless you are the crowd - so, change your, your user agent, change your 00:26:07.433,00:26:12.171 proxy, change a little bit of each thing, each time and become the crowd. Cause it's really 00:26:12.171,00:26:18.177 embarrassing if you tried a million requests against Adidas and you notice that all of your 00:26:18.177,00:26:23.148 requests have the same user agent string. And, of course, cluster deploy to increase 00:26:23.148,00:26:28.987 chances. You need to be scaling this and scaling this is incredibly cheap so, there's no 00:26:28.987,00:26:34.860 excuse not to. I wrote all of these bots in Javascript because Javascript is a bit of a joke in 00:26:34.860,00:26:40.098 Infosec. And so, I wanted to show you that these bots are so simple that you can write them 00:26:40.098,00:26:46.104 in Javascript. A lot of the bots that you buy online, are in Java and you can buy, you can look at 00:26:46.104,00:26:52.144 the source code online of all of these Java bots and they're the exact same thing in a language I 00:26:52.144,00:26:57.149 don't care for. So, this is all about money, it never was not about money, so, let's talk 00:27:00.352,00:27:06.892 about the economy. Because of this, this isn't about just shoes or about shirts or about 00:27:06.892,00:27:11.897 Supreme super soakers. There' an economy based around these scripts itself. If there's a 00:27:14.733,00:27:19.771 market, there's a profit and there's not just a market for sneakers, there's a market for 00:27:19.771,00:27:25.878 these bots themselves and we're going to see that you can purchase every little part of 00:27:25.878,00:27:30.883 this, the team that we introduced earlier, for a pretty penny. So, let's talk about what 00:27:33.018,00:27:38.590 you need to purchase to make this enterprise an enterprise. So, first you're going to need 00:27:38.590,00:27:45.464 to buy accounts. A lot of sites need you, need you to have verified accounts via like, uhm, 00:27:45.464,00:27:51.436 multi factor authentication or something else. So, there's literally sweatshops in China, 00:27:51.436,00:27:58.010 and I'm not making this up. There are tables and tables full of iPhones and Androids and SIM 00:27:58.010,00:28:04.650 cards that run through account creation scripts for these websites. They cost about 5 to 00:28:04.650,00:28:09.655 10 dollars for 5, uh, 500 to even 10-thousand accounts at a time. You use 1 and then you're 00:28:11.790,00:28:18.297 done with it because you can not continue to bot with the same accounts. You are creating 00:28:18.297,00:28:23.669 suspicious behaviour and you do not want to be trapped because you don't want to rewrite all of 00:28:23.669,00:28:29.908 your code and you have a signature each time that you bot. Secondly, we need to buy a 00:28:29.908,00:28:34.880 cook group. these are our friends that always know what's up and can help you configure 00:28:34.880,00:28:40.252 your bots; uh, help you create your own bot, give you a monitor bot. Uh, they're like a private 00:28:40.252,00:28:46.058 Stack overflow community and so these are 15 to 30 dollars and a lot of the times it's just a 00:28:46.058,00:28:52.164 bunch of fashionable dudes on discord and some of them have God-complexes and you're like 00:28:52.164,00:28:58.003 "Okay, I get it," but it's important if you're starting to join a cook group. And, finally, 00:28:58.003,00:29:04.843 the most expensive thing is the purchasing scripts, uh, these are just, saw, the scripts we 00:29:04.843,00:29:11.383 saw earlier, that managed to hire somebody to do UX. And they often wrap everything up into a 00:29:11.383,00:29:16.388 single console that you run repeatedly. If you can find a way to automate any part of 00:29:20.025,00:29:25.030 these, there will be plenty of people lining up to pay you money for your script also. 00:29:27.366,00:29:32.371 Let's see where we can invest our time. We have the "Buy Bot", these, like, AIO bot or Project 00:29:34.640,00:29:39.645 Destroyer, range anywhere from 300 dollars to 15-hundred dollars. And, there is a resale 00:29:43.849,00:29:49.154 market for these bots cause these bots are only released in small batches, just like what 00:29:49.154,00:29:54.159 we're trying to buy- of 100 to 500 each season. And they sell out almost immediately, so you 00:29:56.261,00:30:02.768 can always resell these for profit. These expensive Buy Bots, especially like Project 00:30:02.768,00:30:08.240 Destroyer, have everything in one console. They have the account creation, the monitor 00:30:08.240,00:30:13.245 bot, they often come bundled with a support group and it's important if you're new, also, 00:30:15.247,00:30:20.252 if you invest in a Buy Bot. You will get dedicated support. Because companies will often be 00:30:22.387,00:30:28.894 trying to work against these bots and you want an active purchasing bot with an active 00:30:28.894,00:30:35.167 development core, Because you're gonna want somebody who's trying to sidestep new protection that 00:30:35.167,00:30:40.172 are put in. On the other hand, the monitor bots, which I call the Adobe Cloud Subscription 00:30:43.408,00:30:50.015 model, uh, start at 15 dollars per month and go up to 30. You can also buy these, they're 00:30:50.015,00:30:55.087 rather cheap but it's really hard to configure them, it's, you're just buying, basically, 00:30:55.087,00:31:00.025 an XML parser or just a, something pinging a site and you're hoping that you 00:31:02.694,00:31:08.900 configured the right site or the right skew. This is why more, more often than not people would 00:31:08.900,00:31:14.973 join or subscribe to an, uh, monitor bot that's already running. Since these come mostly 00:31:14.973,00:31:21.513 with cook groups, uhm, you, they come with three real friends. [laughing] As real as a discord 00:31:21.513,00:31:27.886 friends can get and they usually integrate with you purchasing script. So, they will have like 00:31:27.886,00:31:32.891 a little API endpoint, uh, that you can plug into your fancy Buy bot and the Buy bot will know 00:31:38.196,00:31:43.201 what to do from there. So, we saw the prices and what I love about these prices is that these 00:31:48.039,00:31:54.045 are for resellers and if there's one thing that resellers know how to do is resell. So, I 00:31:54.045,00:32:00.252 thought, what do coders know how to do best? And I said - I know how to code best. So, I wrote a 00:32:00.252,00:32:05.257 bot that buys other bots and then resells these bots. [laughing] So, I went to AIO 00:32:09.194,00:32:14.199 bot, which is one of the cheaper bots,that we have here. And I went through, this is it - this 00:32:17.035,00:32:22.040 is the script! To buy a bot, on a side note, Project Destroyer, AIO bot, and many of the other 00:32:25.710,00:32:32.083 high-end bots, are all running on Woo commerce, and we talked earlier about if you just 00:32:32.083,00:32:38.190 download the dom, you can get all the secret tokens. So, if you really are interested in the 00:32:38.190,00:32:42.994 bots that buy bots and resell bots, the resale rate is probably a thousand to 00:32:42.994,00:32:48.633 15-hundred over what you invest. Uh, so, if anyone's looking for a job. So, let's look at this 00:32:48.633,00:32:53.638 guy in action. So, it's another puppeteer test. And you can see how expensive these bots are if 00:33:11.723,00:33:16.728 you add twitter bootstrap to any script. You can add it an extra 150 dollars To the price. The 00:33:26.905,00:33:31.910 logical end of this script is to add a twitter bot or a reditor posting bot the posts the, a for 00:33:34.479,00:33:39.618 sale, and there's lots of markets on Twitter where you just buy and sell bots. That's 00:33:39.618,00:33:45.790 all they do. Uhm, so if you take this to the end and create a Sell bot, at the other end of 00:33:45.790,00:33:50.795 this But not - now you have an entire bot ecosystem for other bots. I'm gonna learn this 00:34:01.306,00:34:06.311 one.... full screen mode. full screen mode! Okay. So, finally, we come to the future, I have a 00:34:11.449,00:34:16.454 lot of questions - mostly, will I have to become a robot to wear more Supreme? Am I a robot for 00:34:18.790,00:34:23.695 wanting to wear Supreme in the first place? The questions and more, we will answer in this 00:34:23.695,00:34:30.435 question. So, when the web started with bots with web crawler, it was not written for 00:34:30.435,00:34:36.808 web crawler. Web crawler was written for the web. Nowadays when we write the web we write 00:34:36.808,00:34:41.813 the web for Google bot. So, this creates a problem but for a lot of you in the audience may be 00:34:44.215,00:34:50.121 saying is this a problem? Because companies are getting paid. People are getting product 00:34:50.121,00:34:55.927 eventually, so, why do we think this is a problem if, if the money's flowing freely, 00:34:55.927,00:35:00.699 everybody looks good on Instagram, it doesn't matter. Because companies care about 00:35:00.699,00:35:05.704 money. This is the, the truth of it and resellers suck, from a company's prospective. When you 00:35:08.673,00:35:13.678 create a 50 dollar box logo t-shirt and you see somebody reselling that 50 dollar t-shirt 00:35:15.780,00:35:21.686 for 500 and you spent the money designing the red box with "Supreme" in it, tilting the 00:35:21.686,00:35:26.691 future of font a little bit to the left, making it so the every rapper wears your, your new 00:35:29.127,00:35:34.299 shirt - that's a lot of money! So you want to make a lot of profit from these shirts. And 00:35:34.299,00:35:39.304 then some guy who happens to know a bit of Java managed to make 4 to 5 to 10 times your 00:35:41.673,00:35:48.246 profit, on the same thing? Well that really grinds my gears. I don't actually make Supreme, by 00:35:48.246,00:35:53.251 the way. And another thing is that resellers crowd real consumers out, if you know a 00:35:56.087,00:36:02.427 site is only for resellers, you're not gonna go to it. And so now you are sending, you as a 00:36:02.427,00:36:07.432 company are sending all your products to some random guy in, uh, with a penthouse in SF and 00:36:09.834,00:36:15.840 his hot tub full of Cristal. And he decided the price for your product and he decides how much 00:36:15.840,00:36:20.845 it will cost. And then finally, it's about fairness, this is the most obvious, in my opinion 00:36:23.181,00:36:28.186 about why we, about why bots are bad - because it's not fair. Robots can't even wear t-shirts. 00:36:32.924,00:36:37.929 [laughter] Only me! [laughter] So, why should I be competing with robots to buy clothes? When 00:36:42.300,00:36:47.672 we were little, we said, you know, "This isn't fair, I'm taking my ball and I'm going 00:36:47.672,00:36:53.778 home!". This is what companies are really worried about and why this is a problem. Because, one 00:36:53.778,00:36:59.451 day, instead of waiting in line, with a bunch of robots that look like Pepper, you're going to 00:36:59.451,00:37:05.523 take your ball and go to a brand that actually has some stock for you, so that you can wear 00:37:05.523,00:37:11.930 whatever brand that is and it will make it more popular. So, bots aren't fair, resellers 00:37:11.930,00:37:16.935 aren't fair, so, what can we do about it? I know! There's accounts, we can just blacklist 00:37:19.504,00:37:26.077 it. It's a universal truth that every company that can not hire a security engineer is in 00:37:26.077,00:37:31.416 possession of a pretty useless blacklist. Most of the time you'll be blocking real 00:37:31.416,00:37:38.089 consumers or these purchased accounts are what you're gonna block. Or the proxy IPs are what 00:37:38.089,00:37:44.529 you're gonna block. You're trying to find a whack-a-mole game - everything is changing, 00:37:44.529,00:37:49.501 we made everything random so that we would not get caught. And as companies try to whack 00:37:49.501,00:37:53.972 the mole to try to get you to stop running your not against their website, their blacklist 00:37:53.972,00:37:59.677 gets longer and longer and more useless and useless. Blacklisting doesn't work and 00:37:59.677,00:38:05.884 I'm at DefCon, so, we all know that blacklisting doesn't work. So, what else can we do besides 00:38:05.884,00:38:10.989 blacklisting? There's got to be a better way, right? Well, companies are doing a lot of 00:38:10.989,00:38:15.994 superficial things to make it worse. I'm going to tell you a story about my friend, he, he 00:38:20.632,00:38:25.637 trains every night before a drop or a purchase drop, to click through a website as fast as 00:38:28.039,00:38:33.945 possible. He has an Excel sheet of times and he memorizes where the mouse should go and he 00:38:33.945,00:38:39.717 trains like an Olympian to purchase shoes, right? Uh, he's very proud of this for some 00:38:39.717,00:38:44.722 reason, I do not know. He thinks he is more ethical or holier than thou because he has not 00:38:47.258,00:38:52.263 resorted to scripts. And he does make a fair bit of money. But, uh, a sneaker website which I 00:38:54.966,00:39:00.605 won't mention, created a fake page. The first and the usual button said "If you click this 00:39:00.605,00:39:07.145 button, you will pay 10-thousand dollars for a 100 dollar sneaker" and people bought those 00:39:07.145,00:39:13.251 10-thousand dollar sneakers, because, if a human, this is what the company thought, reads 00:39:13.251,00:39:19.157 the text on the page he will see that it says, clearly, this is to the purchase button - "If you 00:39:19.157,00:39:25.063 click this button, you will pay 10-thousand dollars". This worked, somewhat. But then I 00:39:25.063,00:39:31.569 remembered my friend who, for some reason trains every night before a shoe drop to purchase 00:39:31.569,00:39:36.774 through clicking. I also do this! I click as fast as possible, I'm trying to charge 00:39:36.774,00:39:42.747 my card as fast as possible and so, false listings are gonna confuse me. I, most likely, will 00:39:42.747,00:39:47.585 click the wrong button. Because I have less than 30 seconds to click through a UI to charge my 00:39:47.585,00:39:52.590 card. I live in Shanghai, Shanghai has so many hypebeasts. It's not, it's not really hype 00:39:55.827,00:40:02.767 anymore, it's just the norm. We have many sneaker shops near where I live and you will see a 00:40:02.767,00:40:08.906 line around the block of middle-aged women, these women are not wearing the latest 00:40:08.906,00:40:14.312 kicks, they're not wearing supreme, they were charged 20 Renmindi, about 3 dollars, to 00:40:14.312,00:40:20.551 wait in line for the resellers for shoes. So, now, you have this kind of economy based on 00:40:20.551,00:40:25.556 paying middle-aged ladies to wait in line so you can charge 200, 300 dollars more for those 00:40:29.427,00:40:36.434 shoes. In person sales means in person retailers - it's distributed reselling. And, 00:40:36.434,00:40:41.039 finally, this is the one that I hate the most because it doesn't make much sense to me, they have 00:40:41.039,00:40:47.545 lottery systems in a lot of the latest releases. Bots can buy anything, we just talked about 00:40:47.545,00:40:52.884 it - they buy teddy bears, they buy K-pop concert tickets, they buy stocks. What means they can 00:40:52.884,00:40:59.090 not buy lottery tickets? And, so now you'll see a lottery ticket and you as a human being get 1 00:40:59.090,00:41:05.897 lottery ticket - and a bot gets 5-million. The odds aren't in your favour, even if it's 00:41:05.897,00:41:10.902 supposed to be statistically random. So, all of these suck. They're very superficial and 00:41:13.071,00:41:19.711 the, uh, it's easy to poke holes through these solutions. So, we need to find a way to do this. 00:41:19.711,00:41:24.716 And it's very easy. We need to go back to unpredictable web. We need to go back to a web before 00:41:27.385,00:41:32.390 web crawler. We need to go back to a random human-curated web. Adding entropy to your system 00:41:37.495,00:41:43.901 does not mean breaking your system. When we wrote code earlier, we wrote code to be as 00:41:43.901,00:41:49.874 random as humanly possible - it still worked! It was a little bit of extra effort, it didn't 00:41:49.874,00:41:56.447 break anything. If you add just a little bit of unpredictability, bots can not 00:41:56.447,00:42:03.287 handle it. Encrypt your process - encrypt little beet, little bits and pieces of everything 00:42:03.287,00:42:10.261 you do. Do not make it clear one click - easy as humanly possible. The easier you make a 00:42:10.261,00:42:15.900 process, the more you code your website for SEO, the easier it is for bots to get on your 00:42:15.900,00:42:20.905 website. And in the great words of a mid-1000s emo band that everyone forgot but me - Fall 00:42:23.541,00:42:28.546 Out Boy - "This ain't a scene, it's an arms race". There's not going to be 1 answer or 1 00:42:32.450,00:42:38.189 nuclear weapon against bots. Because there's a profit to be made. What I get paid for 00:42:38.189,00:42:43.961 writing websites, others get paid to write bots against those websites. They get paid probably 00:42:43.961,00:42:48.599 more than I do. Which is sad because they're probably better dressed than I am too. 00:42:51.569,00:42:57.975 [laughter] The only way forward is to, to deal with bots in only the way that a human can. And 00:42:57.975,00:43:03.748 humans are very good at one thing - and that's dealing with the unfamiliar. Bots can not 00:43:03.748,00:43:10.121 handle the unfamiliar and if we start to make the web unfamiliar with, to bots and more familiar 00:43:10.121,00:43:16.360 to humans I think we have a way forward. This ain't a scene and it's not just about sneakers. 00:43:16.360,00:43:22.633 It's not just about Supreme. It's about everything and it's an arms race for all of use to 00:43:22.633,00:43:27.638 be able to be the best dressed at DefCon this year and every year forward. Thank you! 00:43:34.445,00:43:39.450 [applause] [cheering] Wooh! I'm thirsty.