{"id":51888,"date":"2021-02-23T06:00:48","date_gmt":"2021-02-23T11:00:48","guid":{"rendered":"https:\/\/www.shamusyoung.com\/twentysidedtale\/?p=51888"},"modified":"2021-02-22T21:04:26","modified_gmt":"2021-02-23T02:04:26","slug":"source-code-theft","status":"publish","type":"post","link":"https:\/\/www.shamusyoung.com\/twentysidedtale\/?p=51888","title":{"rendered":"Source Code Theft"},"content":{"rendered":"<p>Heads up: This post is a bit more dashed-off than my usual columns. I actually think this would eventually make a good video for <a href=\"?p=51795\">This Dumb Industry<\/a>, but I need to do a ton of research before I can commit my thoughts to the indelible format of a YouTube video. For right now, this is mostly me thinking out loud.<\/p>\n<p>Anyway&#8230;<\/p>\n<p>So the news is that <a href=\"https:\/\/www.theverge.com\/2021\/2\/9\/22274035\/cd-projekt-hack-source-code-cyberpunk-2077-witcher-3-encrypt-data-ransom\">someone hacked into CDPR&#8217;s server, downloaded the source code for several games<\/a>, then locked the files and held them for ransom. When CDPR refused to pay, the hackers &#8220;<a href=\"https:\/\/www.theverge.com\/2021\/2\/11\/22278121\/cd-projekt-red-ransomware-hack-cyberpunk-2077-the-witcher-3-auction-sale\">sold it on the Darkweb for 7 million<\/a>&#8220;. The hackers obtained the source for Witcher 3, Gwent, and Cyberpunk 2077. From here on I&#8217;m going to talk about the Witcher 3 source, but most of this is applicable to all of the games.<\/p>\n<p>My question is this:<br \/>\n<!--more--><\/p>\n<p><b>What in the world are the buyers planning to do with the source?<\/b><\/p>\n<h3>This Makes no Sense<\/h3>\n<p><div class='imagefull'><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/column_hack_hacker.jpg' width=100% alt='I can&apos;t stress enough how important it is to wear a black hoodie when you&apos;re hacking a computer. Without the hoodie, people won&apos;t realize how crafty and dangerous you are.' title='I can&apos;t stress enough how important it is to wear a black hoodie when you&apos;re hacking a computer. Without the hoodie, people won&apos;t realize how crafty and dangerous you are.'\/><\/div><div class='mouseover-alt'>I can&apos;t stress enough how important it is to wear a black hoodie when you&apos;re hacking a computer. Without the hoodie, people won&apos;t realize how crafty and dangerous you are.<\/div><\/p>\n<p>Yes, it&#8217;s cool to have the Witcher 3 source, but 7 million is a LOT of money for something you fundamentally can&#8217;t use.<\/p>\n<p>Now, maybe you want to assume that the buyer is so fabulously rich that they&#8217;re willing to drop millions of dollars on something that can never yield a return and he&#8217;s just planning on printing out the source and putting in a little lightbox to look at once in a while. Like a lunatic. If that&#8217;s what you think happened, then fine. You don&#8217;t need to read the rest of this. We can all shrug our shoulders and marvel at the deeds of people with more money than brains.<\/p>\n<p>But let&#8217;s assume, for the sake of argument, that this buyer is a hopeful young criminal, looking to make some money with this. If that&#8217;s the case, then he&#8217;s probably looking to launch his own game studio. He bought this code, hoping to bootstrap his studio by buying the stolen source code rather than spending years developing his own game engine.<\/p>\n<p>Let&#8217;s call this outfit <a href=\"https:\/\/store.dftba.com\/products\/cgp-stamp-set\">Top Sneaky<\/a> Studios. The CEO is Brandon Sneakman. To give him a break, let&#8217;s assume he&#8217;s going to use this appropriated engine to make (say) <i>The Witchman Chronicles<\/i><span class='snote' title='1'>Clearly this name is way too obvious. I chose the name because it&#8217;ll hopefully be easier for you to remember. Hopefully Brandon has the sense to come up with more original branding.<\/span>. That&#8217;s smarter than trying to make a space adventure or an open-world modern city game from an engine designed for medieval fantasy. I&#8217;ve worked on both cities and pastoral landscapes. Trust me, they&#8217;re VERY different! It&#8217;s no good paying millions for an engine if you&#8217;re going to have to re-write the dang thing.<\/p>\n<p>But even if he just wants to just make a Witcher clone, Brandon is still doomed. How doomed? Listen&#8230;<\/p>\n<p><b>1. You would get caught like, right away.<\/b><\/p>\n<p>Keep in mind that it&#8217;s incredibly common for AAA games to attract a modding community. People regularly datamine games to see how they work and how they were made.<\/p>\n<p>(Now maybe you want to argue that Top Sneaky Studios aren&#8217;t AIMING for AAA. Fine, but paying 7 million for an engine is a very non-indie move. Most indies don&#8217;t MAKE $7 million, so you&#8217;re in the hole before you even begin work.)<\/p>\n<p>In any case, while doing this datamining people will notice things:<\/p>\n<p>&#8220;Oh hey, check out these data structures. There is a limitless variety of ways to represent game concepts in memory. I&#8217;m talking about things like an NPC, a weapon, a quest, etc. And yet this game JUST HAPPENS to have the exact same memory layout as Witcher 3. The odds of that being an accident are approximately 1 in impossible.&#8221;<\/p>\n<p>&#8220;Check it out! This game runs its rendering pipeline in a background thread, then it has three general workhorse threads for streaming in content as the player moves around the world. Then a physics thread, a thread for pre-streaming cutscene dialog, and another thread for playing audio. That&#8217;s the exact same setup they used in Witcher 3<span class='snote' title='2'>Not really, I&#8217;m just making up an example.<\/span>. The odds of two different engines randomly having the exact same thread structure is miraculous.&#8221;<\/p>\n<p>Remember, the public knows that the code for Witcher 3 was stolen. A lot of curious people are going to be looking for it now.<\/p>\n<p>Sure, if the folks at Top Sneaky Studios know what they&#8217;re doing then they would be able to change this stuff to cover their tracks. Still, there&#8217;s a ton of ways to get caught. There are a lot of different ways to uniquely identify data structures, program flow, savegame data, game asset storage, thread behavior, and the overall structure of game objects. And I&#8217;m willing to bet that the ways I know about are vastly outnumbered by the ways I don&#8217;t know about. Better hope you don&#8217;t miss anything, because getting caught opens your entire enterprise up to both civil and criminal charges.<\/p>\n<p><b>2. The two games would have the same <\/b><a href=\"?p=9557\"><b>dependencies<\/b><\/a><b>.<\/b><\/p>\n<p>We don&#8217;t need to engage in super-technical data mining to see what&#8217;s up. If you&#8217;ve got the game installed, then all you need to do is open up WitchermanChronicles\/bin\/x64\/ and look at the list of external DLLs. If you look in that directory you&#8217;ll see stuff like PhysX<span class='snote' title='3'>Physics engine SDK.<\/span>, NVHair<span class='snote' title='4'>Nvidia&#8217;s hair simulation SDK.<\/span>, APEX_Clothing<span class='snote' title='5'>I&#8217;ve never heard of this one, but obviously it&#8217;s a fabric solution for flowing capes and such.<\/span>. In fact, there are a total of 24 DLLs in your Witcher 3 install. If Top Sneaky doesn&#8217;t want to have the smoking gun of the same DLLs, then they need to either license something different or write their own. Either way, that&#8217;s a bunch of programming that needs to be done.<\/p>\n<p>I&#8217;m not sure how it works today, but back in the 90s you needed some sort of developer key to compile a library. I&#8217;m hazy on the details<span class='snote' title='6'>I THINK I remember your key was a simple file you kept with your source code, and inside of the text file was some huge 20-digits number.<\/span>, but you basically had to &#8220;sign&#8221; your particular install. From here you have four options:<\/p>\n<ol>\n<li aria-level=\"1\">Use the CDPR license key<span class='snote' title='7'>The key was certainly stored with the stolen code, so Brandon ought to have it.<\/span>, and thus announce to the world that this game is built on top of the stolen source.<\/li>\n<li aria-level=\"1\">Use a nonsense key<span class='snote' title='8'>This probably involves some DRM-removal, but I dunno. I&#8217;ve never tried it.<\/span>, thus making it really obvious that you don&#8217;t have the proper license for this particular SDK.<\/li>\n<li aria-level=\"1\">Roll your own replacement. This means giving your engineers time to familiarize themselves with this &#8220;new&#8221; engine. In a normal company, you&#8217;ve got old-timers to help guide the new coders through the code and answer &#8220;How do I do X?&#8221; type questions. But if you&#8217;re using a pilfered engine then everyone on the team needs to grope around blindly. Nobody knows how it works, and you can&#8217;t ask Google for answers because this sort of knowledge isn&#8217;t available to the public. I&#8217;m not saying it&#8217;s impossible, I&#8217;m just saying it&#8217;s really time-consuming.<\/li>\n<li aria-level=\"1\">You could obtain a fresh license for this stuff. However, that seems sort of unlikely to me. The sort of person who would purchase a bootleg game engine on the DARK WEB<span class='snote' title='9'>Seriously, the news media LOVES stories about the dark web. They don&#8217;t understand it, but it sounds exciting and illicit and it&#8217;s easy to get people to click on links about the DARK WEB.<\/span> is probably not the kind of person that will scrupulously adhere to licensing rules.<\/li>\n<\/ol>\n<p>However it works these days, I doubt this system has become LESS restrictive since the 1990s.<\/p>\n<p>And once you fix this problem, you <b>still<\/b> have the issue that Witcherman Chronicles is going to have the exact same \/ very similar profile of external DLLs.<\/p>\n<p><div class='imagefull'><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/column_hack_screen.jpg' width=100% alt='This obviously isn&apos;t REAL code. It&apos;s way too readable.' title='This obviously isn&apos;t REAL code. It&apos;s way too readable.'\/><\/div><div class='mouseover-alt'>This obviously isn&apos;t REAL code. It&apos;s way too readable.<\/div><\/p>\n<p><b>3. A game engine isn&#8217;t just the &#8220;game&#8221;, it&#8217;s also the internal tools.<\/b><\/p>\n<p>So Brandon has a problem. He wants to hire a team of artists to make his game. However, he can&#8217;t just create a job listing that says, &#8220;Preferred: 2+ years experience with the CR Projekt RED toolset&#8221;<span class='snote' title='10'>It&#8217;s actually called the RED Engine.<\/span>. That would be a dead giveaway.<\/p>\n<p>So he needs to find workers, but he can&#8217;t openly ask for the skills he needs. Worse, CRPR has shown off their tools in public videos like <a href=\"https:\/\/www.youtube.com\/watch?v=ljJNYG2MJpU\">this one<\/a>. Sooner or later he&#8217;s going to hire someone that sits down to work on the first day and thinks, &#8220;Holy shit. This looks EXACTLY like the thing CDPR uses to make their cutscenes and dialog sequences!&#8221;<\/p>\n<p>If Brandon is the kind of person to buy stolen source code, then he&#8217;s very interested in taking risky shortcuts. This means he&#8217;s <i>probably<\/i> not the kind of leader that&#8217;s going to spend a lot of time worrying about morale and the well-being of his staff. Top Sneaky Studios is probably destined to be a place with forced crunch and low pay, thus increasing the proportion of disgruntled workers.<\/p>\n<p>What are the odds that someone on the team will call the authorities, or send an email to <a href=\"https:\/\/en.wikipedia.org\/wiki\/Jason_Schreier\">Jason Schrier<\/a>, or just post the truth somewhere on Reddit? Actually, that&#8217;s the wrong way of looking at this. Instead we should ask: <i>What are the odds that everyone keeps the secret FOREVER?<\/i> This is quickly turning into a conspiracy that requires perfect loyalty from a large group of people who do not personally benefit from the secret, but would benefit if they divulged it.<\/p>\n<p><b>4. The Witcher 3 engine is friggin&#8217; OLD.<\/b><\/p>\n<p>If Brandon manages to get his studio off the ground this year, then he probably can&#8217;t hope to ship Witchman Chronicles before 2025. Witcher 3 came out in 2015.<\/p>\n<p>Is Brandan planning to spend additional time and money doing a drastic overhaul to the rendering code, or is he planning to release a game in 2025 with graphics that are a decade out-of-date?<\/p>\n<p>(Yes, the code for Cyberpunk is much newer, but it&#8217;s also incomplete and janky as hell. The programmers at CDPR might be able to patch the game up in half a year or so because they&#8217;re familiar with the code, but if you&#8217;re starting with a new team then that same work is going to take much, much longer.)<\/p>\n<p><b>5. The Unreal Engine is WAY Cheaper!<\/b><\/p>\n<p>You want to make a AAA game? You can use the latest, greatest Unreal Engine FOR FREE up front. You don&#8217;t need to pay anything until your game makes $1 million. After that, you just pay Epic 5% of any further sales.<\/p>\n<p>The crossover point here is $141 million. By that point, you&#8217;ll have paid $7 million to Epic. Above that point, and using the stolen engine is cheaper. Below that point, and Unreal is cheaper.<\/p>\n<p>So you can:<\/p>\n<ol>\n<li>Use the cutting-edge modern engine that costs nothing up front and only costs money if you make money. There are tons of people familiar with this engine and finding them is easy.<\/li>\n<\/ol>\n<p>OR&#8230;<\/p>\n<ol start=\"2\">\n<li>Pay 7 million up front for access to an outdated engine that needs millions of additional dollars to bring it up to date and conceal its origins. People familiar with the engine aren&#8217;t as plentiful, and you can&#8217;t look for them directly. This option carries the added risk that if you miss something, then your crime will be exposed and your entire company could be ruined. Additionally, you need to maintain an iron-clad conspiracy. This entire plan makes no sense.<\/li>\n<\/ol>\n<h3>So What&#8217;s Going on Here?<\/h3>\n<p><div class='imagefull'><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/column_hack_code.jpg' width=100% alt='Wait, you can do this? Just write the word &apos;code&apos; on a stickynote? Damn it. Turns out I&apos;ve been doing things the hard way all my life.' title='Wait, you can do this? Just write the word &apos;code&apos; on a stickynote? Damn it. Turns out I&apos;ve been doing things the hard way all my life.'\/><\/div><div class='mouseover-alt'>Wait, you can do this? Just write the word &apos;code&apos; on a stickynote? Damn it. Turns out I&apos;ve been doing things the hard way all my life.<\/div><\/p>\n<p>It&#8217;s conjecture time:<\/p>\n<ol>\n<li>The hackers didn&#8217;t actually sell the engine to anyone. This was all done with sock puppets so they could claim they pulled off a $7 million heist. Because that sounds better than admitting in public that nobody wanted their stolen goods.<\/li>\n<li>The hackers didn&#8217;t actually steal the source in the first place. Maybe they messed up at some point. They locked the files, but they didn&#8217;t successfully download the entire dataset before someone discovered the breach and locked them out. Think about it. They &#8220;sold&#8221; the engine to a buyer under the condition that the buyer would <b>never<\/b> release the source. This allows them to claim they stole the data without ever furnishing proof.<\/li>\n<li>Everyone in this story &#8211; CDPR, the hackers, and the buyers &#8211; is an idiot.<\/li>\n<\/ol>\n<p>I don&#8217;t know what the truth is, but I&#8217;m <b>extremely<\/b> reluctant to take the black-hat hackers at their word.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Heads up: This post is a bit more dashed-off than my usual columns. I actually think this would eventually make a good video for This Dumb Industry, but I need to do a ton of research before I can commit my thoughts to the indelible format of a YouTube video. For right now, this is [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[102],"tags":[],"class_list":["post-51888","post","type-post","status-publish","format-standard","hentry","category-weekly-column"],"_links":{"self":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/51888","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=51888"}],"version-history":[{"count":6,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/51888\/revisions"}],"predecessor-version":[{"id":51894,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/51888\/revisions\/51894"}],"wp:attachment":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=51888"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=51888"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=51888"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}