9 ms·
World of Warcraft: one simple line of code can cost you dearly
- Raphmedia 10y agoWho figured it would be a good idea to allow received chats to be interpreted as code?! That's a pretty big security fail if you ask me.
- keketi 10y agoRead the article. Received chats are executed only after the victim has run the script provided by the attacker. The real question is "why does the scripting system allow overriding functions like that?".
- dmoy 10y agoDon't most scripting languages allow overriding functions like that? My only experience hacking on Lua has been in game UIs.
- speeder 10y agoLua was created to be a configuration file system that was turing complete, to be used by a oil mining company. Lua was never intended to be used for games, UI, etc... It just proved useful to be used like that. Because of Lua "real" intentions, it was made in a way that you can assign "everything" to "everything", and you don't need () to refer or call functions. (in fact, many of the stuff that make Lua look like a "normal" programming language, like dot syntax, () and whatnot, are "synctatic sugar")
- wruza 10y agoPlease do not spread false misbeliefs. Wow's Lua is 5.1-flavoured afaik, and that's completely different language from 5.0, 4.x or what you describe. This entire thread mentions fatality of function substitution in Lua, but that is easily prevented (by setting proxy metatable on global table and system libraries, even any lua-noob knows that, blizzard devs are just losers). But even that missing protection is not what breaks security. In dynamic languages like lua or javascript you control the dynamicity via localization of global values at eval-time ('eval' as in repl). 'local trim = path.to.sys.lib.trim'. So, once trim function is localized in console code, you can assign anything to original location and that will not interfere with console logic. Lua is just too hot to handle for wow-devs, and python, perl, javascript have the same issue more or less the same way.
- Raphmedia 10y ago> Read the article. Received chats are executed only after the victim has run the script provided by the attacker. I did read the article, which is why I said that this was big security issue that the chat could be interpreted as code. This should have been tested against.
- slrz 10y agoIt is evaluated as code only after the (legitimate) player modified the environment to do exactly that. If I can convince you to paste some random code from this HN comment into a command interpreter, that could do similar things to your system.
- Twisol 10y agoThe attacker figured. WoW doesn't do this normally - the attack involves the victim explicitly replacing an innocuous "RemoveExtraSpaces" function - which ostensibly is used as a scripting hook to trim spaces from incoming chat messages - with an eval-equivalent "RunScript". They basically just tied the ends of the right wires together. I'm not even sure this is a vulnerability at the scripting level. I think it's just a bad idea to include `/run` by default.
- onetwotree 10y agoThe `/run` command is pretty essential for debugging mods. I think that it'd be a wise idea to disable it by default, and allow an advanced user to change a setting in a file to turn it back on.
- nkrisc 10y agoTo add to this, any barriers Blizzard introduces will just become an extra step in the social engineering portion of the attack, getting the victim to enable the feature.
- scrollaway 10y agoFacebook has had the same problem with the browser devtools. Fun seeing a repeat of it in a different sector.
- elliottcarlson 10y agoIt is reminiscent of "Press Alt-F4 for ops", used to troll Mirc users on IRC back in the 90's; or having people enter "+++ATH0,ATDT,911" from the BBS days.
- roghummal 10y agoTo tie the two together (IRC/++ATH0)... /ctcp #channel PING ++ATH0 :D http://everything2.com/title/%252B%252B%252BATH0 http://everything2.com/title/%252B%252B%252BATH0
- choward 10y ago> Who figured it would be a good idea to allow received chats to be interpreted as code?! They didn't allow it on purpose. They have a "RunScript" command that allows you to execute code on your machine. However, the attacker tricks the user into overwriting a function that is called when a message is received to run the "RunScript" function instead. > That's a pretty big security fail if you ask me. That's the point of the article.
- castratikron 10y agoPretty cool that they allow players to run their own scripts, and in a full Lua environment no less. I imagine that could be useful in a game with a lot of repetitive tasks.
- minimaxir 10y agoThe ability to run Lua scripts has been a WoW feature since its release in 2004-2005. To prevent the game from being easily being botted to death, there's not much you can script aside from automating UI interactions. This was a killer feature for the Master Plan mod last expansion, which automated clicking through poorly-designed menus for a poorly-designed mechanic, and it single-handedly broke the economy.
- rhaps0dy 10y ago> and it single-handedly broke the economy. Could you get money by clicking menus? I'm curious
- minimaxir 10y agoIf you had a number of characters optimized for it, you could get thousands of gold every day for a half an hour of menu clicking. This technique has just been removed from the game, however.
- Rovanion 10y agoFrom what I understand they essentially made a part of the expansion which worked like farmville where you through a UI sent out your followers on missions which would finish in a certain amount of real world time later.
- scrollaway 10y ago> it single-handedly broke the economy Let's be fair here. It's the Garrison's design that broke the economy - Master Plan just made it worse by turning "a few click every few hours" into "one click every few hours".
- jomclaughlin 10y agoIt's Lua not LUA.
- shabble 10y agoreminds me of people writing IRC bots doing something like: if $line =~ m/!calc (.*)$/ { return eval $1; } which is about the worst possible way you can easily write a calculator :P In fact, irc bot/script writing is a great place to learn about security and generally distrust of the rest of humanity. Even things like the pathological regex backtracking DoS from the other day turn up fairly regularly with popular bots.
- MaulingMonkey 10y agoIn some programming IRC channels I've seen similar done intentionally. On the plus side, they were sandboxed. On the minus side, the sandbox didn't prevent playing sounds on their locally hosted machine... needless to say, there was a lot of beeping.
- kalleboo 10y agoAhh... allowing users to run code they don't understand. The same reason Facebook tried to kill the Chrome Dev Tools[0] and Apple more recently killed the javascript: URL scheme in the address bar [0] https://news.ycombinator.com/item?id=7222129 https://news.ycombinator.com/item?id=7222129
- pmarreck 10y ago> and Apple more recently killed the javascript: URL scheme in the address bar wait, WHAT? This isn't good! This raises the barrier of entry for new programmers to play with Javascript! I had no idea this was done!
- Nadya 10y agoAnd for those of us who use Bookmarklets - it has made Safari a non-choice of browser.
- andrethegiant 10y agoJust enable `Develop > Allow JavaScript from Smart Search Field` in the menubar.
- kalleboo 10y agoBookmarklets still work for me (and as andrethegiant said, you can re-enable it in the Develop menu)
- Nadya 10y agoSo what is the point of trashing the Javascript URI? People with malicious intent will just have the person make the code into a bookmarklet and run it. Which is actually easier than explaining how the URL bar works. Or does it do what Chrome does and you can't copy/paste Javascript: until the URL bar you have to type "Javascript:"?
- erezyehuda 10y agoAll they need to do is open the developer console, which is probably better anyway.
- niftich 10y agoWhat's happening here is the 'RemoveExtraSpaces' function (ie. basically a trim) is called by the game engine every time a chat message is received. But apparently, you can rebind this name and point it to any other function, including 'RunScript', which is an eval. When this was revealed, Blizzard quickly patched in a warning dialog that warns against running scripts from untrusted sources, including being social-engineered to enter stuff yourself (which is what's happening here). That attitude seems prudent, but isn't entirely helpful, as many players in fact use Lua in their chatbox to do complex actions or calculations. Like this one that prints your current position in 'map coordinates': /script x,y = GetPlayerMapPosition("player"); map=GetZoneText(); c1=x*100;c2=y*100; print(string.format("%s: %.2f, %.2f", map, c1, c2)); or the 'CTC macro' that was used to calculate a value that raid tanks must have attained: /run DEFAULT_CHAT_FRAME:AddMessage("Need 102.4 combat table coverage. Currently at:" ..string.format("%.2f", GetDodgeChance()+GetBlockChance()+GetParryChance() +5)) It's true that users shouldn't run untrusted code, but realistically, they'll probably click through most warnings to run legitimate functions like this. A better fix is to prevent rebinding the 'RunScript' function to some other name, and to prevent rebinding the 'RemoveExtraSpaces' function by anything else.
- niftich 10y agoAnother contributing factor in this vulnerability is that the 'chat compose input' and the 'script console' are one and the same. While this was done to simplify UX, it's really not a good idea in retrospect. Even as something simple as a different chat frame that only allowed script commands, into which only local script output can go, would also serve as an effective mitigation.
- seanp2k2 10y agoOr do it like Quake and HL did and have tilde be the console. You can do things like "/say foo" or commands / settings through there, and in the case of quake at least, it can load scripts from files in a directory. This is not new stuff, and it's surprising that it doesn't do this already. Example: http://ezquake.sourceforge.net/docs/?scripting http://ezquake.sourceforge.net/docs/?scripting
- j_s 10y agoHere is an idea of what the actual Lua code would look like, a bit de-obfuscated: https://gist.github.com/Sharparam/11a3cddeaa51aa11dde69b46908bccd7 https://gist.github.com/Sharparam/11a3cddeaa51aa11dde69b4690...
- diziet 10y agoI did quite a bit of Lua WoW programming back when I was playing in WoW tournaments. The community really wanted to change a lot of the UI / UX of the default interface to be more friendly for high level play. Tournament rules did not allow usage of addons that pre-packaged such changes, but the admins of the tournaments did have permission to allow usage of light UI changing scripts. Some people took it really far and used automated cooldown trackers etc from macros that you would paste one line at a time, but the admins in tournaments would not allow that. There's still somewhat of an active community: http://www.arenajunkies.com/topic/222642-default-ui-scripts/ http://www.arenajunkies.com/topic/222642-default-ui-scripts/
- tomc1985 10y agoUnbelievable. Why give players the ability to override arbitrary functions like that?
- ajkjk 10y agoWhy are you.. outraged? Clearly allowing this attack was a mistake. Overriding functions is a language feature, so you'd have to think of the risk to think to block it.
- tomc1985 10y agoOutraged? C'mon now. Shocked with disbelief maybe? Because that is such an obvious attack vector that it is hard to believe Bnet allowed it. It's very hard to enforce language-level restrictions (like which functions may run when) when they can be circumvented with reflection. Besides, Bnet's WoW client code has been known to be janky, and their entire security setup seems to only care about protecting the business, and not users. Bnet is the only online gaming service where I have had multiple accounts hacked that I could not trace to any specific doxing/pw dump event... forcing me to conclude that their security infrastructure is absolute garbage
- Houshalter 10y agoWhy not? The user interface being modable is awesome.
- deleted 10y ago[deleted]
- slrz 10y agoBecause it's useful and it's their fscking computers and it allows them to tweak the interface to better suit their play? Should people's ability to receive email also be taken from them, because some of them might fall for the prospect of receiving a million bucks from a friendly Nigerian prince?
- usea 10y agoIt's a feature, which Blizzard has invested a significant amount of time and money into, and has definitely contributed to the game's success. It allows players to modify the game's interface, not just arbitrary game code. Think of it as crowd-sourcing UI improvements from the community. Blizzard is known to take great UI mods and implement them into the game directly. For example, on release I created a mod that let you examine a player's equipped items from any distance. By default, the inspection window would close when a function returned true. This function checked to see if the distance to your target was greater than 5 meters. An easy way to change that behavior was to rebind the function to one that always returned false. It's a natural thing to do in Lua, I think.
- gourneau 10y agoSlightly off topic. Are any of y'all going to be playing the next expansion? I am looking to join a very casual guild :)
- morganvachon 10y agoI'm sure the method was different, but way back in the day when I was playing Phantasy Star Online on the Sega Dreamcast, "digital mugging" was a common occurrence. The attacker would walk up the the victim, ask them to trade, and the victim's interface would lock up causing them to have to reboot the console. When they logged back in, all of their gear and money was gone. If the player hadn't been to the bank to make a deposit recently, they were screwed out of potentially hours of game-time work. I never did learn how this was accomplished; it happened to me only once, after that I ignored any player I didn't know in real life, which cut out the MMO part of the game for me.
- Hortinstein 10y agohahah this brings me back. I can shed some light...at least a little, there were exploits that crashed peoples consoles, this didnt give the thief any items, but cleared inventory or even saves for some players. http://dcemulation.org/phpBB/viewtopic.php?f=36&t=11941 http://dcemulation.org/phpBB/viewtopic.php?f=36&t=11941 great game would love to see a rerelease of the original or even PSO2 in america
- brokenmachine 10y agoSounds like a fun game. :-P