World of Warcraft: one simple line of code can cost you dearly
blog.gdatasoftware.com
blog.gdatasoftware.com
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.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.
The attacker is executing script through the RemoveExtraSpaces function that gets run on every chat message, not by executing it with either player's chat console.
Breaking a huge number of addons in the process, for literally no benefit because the attacker can just use that other name.
> and to prevent rebinding the 'RemoveExtraSpaces' function by anything else
Which wouldn't really solve anything because the attacker can just find some other function that is regularly executed with attacker-supplied input and use that instead.
Or maybe forbid rebinding any system-provided global symbols at all?
if $line =~ m/!calc (.*)$/ {
return eval $1;
}
which is about the worst possible way you can easily write a calculator :PIn 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.
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.
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
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.
Could you get money by clicking menus? I'm curious
This technique has just been removed from the game, however.
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".
On the other hand, I did write a handy few handy little addons despite this restriction. For example, when you're doing lots of wheeling and dealing at the auction house (a perfectly legitimate way to make in game money), you tend to receive a huge amount of "mail". When another player buys an item you're selling, you receive the payment via your mailbox. It can be tedious to go through all the messages and take the money or items (mostly a UX issue if you ask me). To get around this, I just added a "take all AH stuff" button to the mailbox UI. There were a few problems, in particular that you'd have to "pump" it, because moving to the "next page" of mailbox items was an asynchronous operation, and the callback wouldn't be able to do the "take item" action.
Users contribute huge numbers of useful addons despite this restriction - for example, auction house addons can remember price data and show you items that are substantially above or below their general market value. The famous "Carbonite" addon made gigantic improvements to the in-game map, most of which were later incorporated into the default interface. And no serious raider would go into battle without a host of combat helpers, DPS meters, and so forth.
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!
Or does it do what Chrome does and you can't copy/paste Javascript: until the URL bar you have to type "Javascript:"?
There's still somewhat of an active community: http://www.arenajunkies.com/topic/222642-default-ui-scripts/
https://gist.github.com/Sharparam/11a3cddeaa51aa11dde69b4690...
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
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?
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.
This particular language feature is not something that is solely responsible for WoW's moddable UI. While it might be nice in certain circumstances, you can build flexible UI without having to hook or reassign critical functions
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")
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.
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.
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.
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.
:D
My issue is that this exploit was possible AT ALL and that this wasn't tested. As a web developper, this is the kind of exploits I keep in the back of my mind every time I develop something.
Yes, this bug involve some social engineering but the bug itself is big. This is not a bug but a really bad oversight. If someone made it so that the field of a website's form called eval() directly we would all be pointing fingers right now. This bug is the exact same thing.
Yes, the user has to be tricked into writing a piece of code into the console. The problem here is that this piece of code shouldn't have been able to be executed at all. Who in their right mind would allow incoming messages to be parsed? They should have caught that bug in development!
As a web developer, you should also know that there is absolutely nothing you can do to prevent attacks performed through the developer console. This is the moral equivalent.
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.