I hacked Magic the Gathering: Arena for a 100% win rate
504 points by danielwmayer 1 year ago | 172 comments- Bluecobra 1 year agoMy first real foray into Linux was inspecting network traffic with a program called ShowEQ for EverQuest. At the time, the traffic was unencrypted and had lots of juicy info in it. I used a hub to replicate traffic to my Linux box, and it would draw a live map of the zone and showed where the mobs, NPCS, and users were. It even showed what loot the mobs had on them so you could cherry pick certain ones. The beauty of this was that it was passive and impossible to detect. Eventually SOE wised up and started to encrypt the traffic.
- acters 1 year agoThe data has to be decrypted and read, so eventually you reverse engineer the client and figure out how to decrypt on the fly, then they wise up and introduce key based signing, which you eventually try to steal from the client and breaking the encryption again, then anti cheat is implemented... thus, the cat and mouse game is born, lol
- rtkwe 1 year agoOnce the siphoning happens on the same machine your client is running on it's easier to detect through anti-cheats at least. If it can run on a completely separate machine it seems like it'd be essentially impossible to detect except through changes in how a user acts like only going directly to the mobs with the juicy loot and ignoring the trash but that's really tough to detect.
- kqr 1 year agoHypothetically the client doesn't really have to know about the juicy loot until it's dropped, right? On a sufficiently fast internet connection, the client doesn't need to know about anything until exactly the time when the player needs to know it, at which point revealing it in a cheating tool is meaningless.
- Log_out_ 1 year agoThe final stage beeing the Opt player kill & Bann. Compute a all knowing AI and hold it's behavior against that of players, then cull the closest percentage.
- kqr 1 year ago
- Cpoll 1 year agoIt would also help to not send the high-value information to the client until required. Especially loot drops!
- Workaccount2 1 year agoBut then you have to pay for more server side compute! Think of the profit margins!
- Workaccount2 1 year ago
- rtkwe 1 year ago
- gnyman 1 year agoI'll admit I did something similar for a game called Dark Age of Camelot as a teenager. Very educative, learned about both network sniffing, hubs vs switches and Linux. Was it worth it to give me an advantage in the game? No, I never played the game seriously enough to be able to use it, I think I used it for a week after spending two setting it up, but it was a great learning experience.
- zdware 1 year agoI also fell into my first programming experience with DAoC! I worked on fixing some very simple bugs/exploits on an emulated server (C#) back in 2005.
There's a ton of fascinating stories coming out in the last decade around hacking/exploits/etc of games of that era; DAoC, UO, Shadowbane (this one was real bad).
I'd highly suggest checking out these two episodes of this podcast - https://darknetdiaries.com/episode/7/
- zdware 1 year ago
- michaelcampbell 1 year agoThat brings back some memories. IIRC, showEQ was used to prove several theories and bugs that Verant/Sony steadfastly denied:
- there were hell levels
- Halflings instead of Humans got the XP bonus (and that there actually WERE race/class XP differences?)
- early Shaman alchemy actually WAS broken
Also wasn't it what lead to eqemulator.org?
- stocktech 1 year agoiirc, eqemu reverse engineered the server based on the traffic. I remember being impressed.
- stocktech 1 year ago
- Kiro 1 year agoHow does encryption help? Your client obviously needs to decrypt it so can't you just piggyback on that?
- Scarjit 1 year agoIf you don't encrypt your network traffic, you can quite easily decrypt it on another PC (as you can just set promiscuous mode on your 2nd PC NIC), giving you undetectable read-only hacks like "radar", where you basically have a map of the game with the enemy positions, health, gun, ...
If you encrypt it, this is no longer possible. If a cheater wants to decrypt it, he has to get access to the decryption key, which usually is send over an TLS encrypted connection (with certificate pinning in place) [Or in some cases self made encryption :/].
Therefore he has to either reverse the game to get the certificate or has to attempt to read it while the game is running. In the first case the game developers (and the Anti-Cheat providers) will try there best by obfuscating the specific regions. And the 2nd case is basically what AC is all about, and therefore difficult for modern Anti-Cheats.
- devit 1 year agoI think reading the encryption key from memory is usually easy and cannot really be detected in any way if done from the kernel or hypervisor by parsing page tables and accessing physical memory (except by looking for known code if the anti-cheat has as much privileges as the extractor, which the hypervisor approach avoids).
- maldev 1 year agoYou can just hook the networking system calls and you have the unencrypted buffer. TLS encryption doesn't do anything since you can just look at it unencrypted on the network function when they pass in the buffer.
If they encrypt before the network functions, you can just look at the callstack and trace the variable containing the buffer backwards until it's non encrypted.
- devit 1 year ago
- vasco 1 year agoYou need to hack the client for that vs just binding to a network port, or at least have access to a decryption key.
- speedgoose 1 year agoYes. Sometimes software will encrypt HTTP calls while relying on the operating system certificate authorities, so it's easy to intercept again using tools such as mitmproxy.
Sometimes you will be forced to hack the software, to allow interception or to replace a key. Unless they use a symmetric key that is easily found, but I have never seen that.
And then you have the monsters such as Widevine.
- speedgoose 1 year ago
- dbttdft 1 year agoIt doesn't, we are just in 90's security mindset. We even have the typical idiot here chiming in, "it doesn't have to be perfect". Meanwhile in adult software engineer world, we know we can just not send the state of the entire world to every player and that would also save costs.
- low_tech_love 1 year agoDecompiling (in a meaningful way) an optimized binary generated from C without debug symbols is much harder than what the author has shown in C#. It is not impossible, but probably very time consuming.
Versus just reading clean packages from a network.
- neonsunset 1 year agoYou don't need to obfuscate the code if you apply sufficient amount of acronym-driven coding practices to it!
- neonsunset 1 year ago
- bcrosby95 1 year agoIt's not about finding a 100% solution. It's about deterring as many people as you can.
- Scarjit 1 year ago
- sprite 1 year agoShowEQ still works, there is also MySEQ which is Windows based but just reads memory instead. They are fine to use as the current owners of EQ don't really seem to care. Neither app has ever been able to show what loot a mob has except for visible pieces. Some of the data has changed over the years, for example exact mob HP used to be sent, now they just send percentages.
- Bluecobra 1 year ago> Neither app has ever been able to show what loot a mob has except for visible pieces.
ShowEQ definitely showed drops at some point. I vividly recall farming lightstones from Willowisp and using ShowEQ to ignore the ones with burned out lightstones.
- sprite 1 year agoYes lightstones go in primary weapon slot so they are one of the items that are considered visible.
- sprite 1 year ago
- Bluecobra 1 year ago
- IG_Semmelweiss 1 year agoCurious since I don't know about this topic:
Is this sort of packet sniffing (to cheat) far more difficult (impossible?) for browser-based games ?
Assume of course a modern browser fairly standard use of the browser itself
- tga_d 1 year agoI would suspect "modern" has a lot more impact than "browser" (notably, aside from more developer awareness of cheating, I would suspect TLS is far more common now, though that can of course be worked around when you control the client). Browser traffic isn't any different from any other type of traffic, the standard packet sniffing tools (tcpdump, wireshark, mitmproxy, etc.) work just fine.
- tga_d 1 year ago
- acters 1 year ago
- Sweepi 1 year ago"I was totally surprised by this, because it means that a (mostly) fully-functioning bot capable of playing arbitrary games of Magic: The Gathering has a small enough footprint to run locally on your machine"
I dont get that. Maybe I am missing something.
Lets say, the MTG AI was so intensive to run that it would be unreasonable to run on the customer's machine - then I wouldn't run it on the server either, since it would be quite expensive (and bot games in card games are usually not pay per play).
Also, servers are not magic - most of them run on the same x86 CPUs as the local machine, with a lower clockspeed than their desktop counter parts (but higher than (most) notebooks). Therefore, the only way to archive a lower Bot turn timer compared to running locally would be to use significantly more cores than the customer (usually 4-8, hence 8-16 allocated cores per player?!). Sounds like a nightmare, especially during peak concurrent player hours/days!
If the CPU Player does not support multi-core, running locally should be faster in any case.
- Ensorceled 1 year ago>> "I was totally surprised by this, because it means that a (mostly) fully-functioning bot capable of playing arbitrary games of Magic: The Gathering has a small enough footprint to run locally on your machine"
> I dont get that. Maybe I am missing something. Lets say, the MTG AI was so intensive to run that it would be unreasonable to run on the customer's machine - then I wouldn't run it on the server either [...]
They said "footprint", not "processing power". The bot's rules engine is small enough to run in the memory footprint on older iPhone or Android devices, a server could have a lot of memory dedicated to holding a state machine or rules engine and still use very little processing power to execute the engine for any particular request.
- themoonisachees 1 year agoFair enough for desktop, but also remember that MTGA runs on phones.
- lima 1 year agoMTG is a very complicated game with a complex ruleset.
- apetresc 1 year agoHis point wasn't that an MTG bot should be easy to run, his point was that it shouldn't be any easier/cheaper to run server-side than client-side.
But to address your point, while that is true, Sparky itself plays with very basic decks, and plays even those very poorly. The goal of Sparky is to introduce players to the rules, not to be a competitive MtG agent; playing badly is intended. I wouldn't be surprised if Sparky's code is actually just a bunch of very simple heuristics (maximize your mana utilization this turn, attack with any creature that can trade evenly or better, etc).
- apetresc 1 year ago
- Ensorceled 1 year ago
- hfuaiobfa 1 year agoCongratulations again for the top story, Daniel! I was hacking on MTGA since you posted this article and spoke a little about that with you on GitHub [0].
For anyone interested, I'm _inactively_ working on an unofficial client of MTGA which does hardly anything meaningful for now. The vision is to provide some automation for playing ranked games and stronger bot opponents. Sadly I was distracted lately away from the project and am still puzzled how to make a good UI to see things clearly. I can't even estimate when it will be barely useful.
Beside that, I'm still very interested in any game hacking story of Daniel and anyone else! Please tell me more about how to spot such bugs, how not to worry being banned after such hacking, how to `disclosing the bug to them` like @aethros commented, how to structure an unofficial card game client, and other stories. Thank you!
[0] https://github.com/MayerDaniel/mayerdaniel.github.io/issues/...
- extraduder_ire 1 year ago> I would have thought that a game as complex as MTG would require a lot of overhead in terms of creating an AI opponent. But nope! You can actually check out all of the logic for Sparky, including a few places in the debug UI where WOTC developers reached a corner case that they felt was not worth implementing. I don't blame them - MTG is a beast of a game to try to have full coverage for!
This is a huge understatement, since the game is nearly (no infinite loops) Turing complete, and people have a lot of fun with that. I assume there's a lot of work already done on AI strategy for it though.
The post title should probably have a "Show HN:" on it too, since you're posting it yourself.
- Dylan16807 1 year agoShow HN is for projects people can play with, not blog posts. https://news.ycombinator.com/showhn.html
- mgdev 1 year agoThe sample code plus walkthrough sounds like "things people can run on their computers". :)
- Dylan16807 1 year agoDon't make me regret removing the sentence that explicitly pointed out that the sample code in an appendix is not the point of the linked page.
- Dylan16807 1 year ago
- mgdev 1 year ago
- dmurray 1 year ago"The game can be used to encode a Turing machine" is not at all the same as "it is difficult to write a program that can play a legal action in every situation". It's the latter that seems to be difficult for the bot authors.
- jprafael 1 year ago> "it is difficult to write a program that can play a legal action in every situation"
This is trivial (just forfeit).
The hard part is figuring out the best possible action to select from. MTG is particularly hard at this because: * Some actions are only allowed in certain conditions (e.g. in response to, in a specific phase, etc) * Actions vary significantly not only in their effects but also in their inputs (some require targeting a creature, a player, an opponent, a card in hand, a card in exile, a name of a card that could exist). Some have a varying list of inputs (target many creatures). This variance makes it hard to encode the action space. * The state space is huge. It is not only determined by the cards in play, but is also affected by the meta-game (to play optimally players have to play in a specific way to avoid getting countered by a card that could be in play by the opponent, because that card is legal to play and is commonly used by decks that look like what the opponent is playing). * Technically the state space is also infinite because you can create infinite loops that keep creating more and more triggers/creatures/etc.
- dmurray 1 year agoOh I completely agree, I'm just shitting on the idea that this has anything to do with the game being "Turing-complete".
- dmurray 1 year ago
- jprafael 1 year ago
- fauria 1 year agoIt is actually Turing Complete: https://arxiv.org/abs/1904.09828
- tcbawo 1 year agoThe game is constantly changing because new sets are rotating through, but I believe it is possible to create infinite loops with certain dynamics, or at least it has been possible at various points. ie. something like creating/killing token characters with "on entry"/"on exit"/"untap" mechanics, etc. Not all of them result in either player taking damage.
- jncfhnb 1 year agoIs there any practical strategy that approaches this complexity at all? I have never played. But I assume this claim is just that you can technically create some stateful stuff if you’re explicitly not trying to win
- squeaky-clean 1 year agoTuring machines? Not really. Infinite loops[0]? All the time. The designers generally try to avoid those being legal in "Standard" unless it's extremely unlikely to happen (only the most recent few years of cards are legal in tournament play. In casual play anything can be legal if your group is okay with it).
A common trope is to have a card that allows you to create mana, and then a way to infinitely bring that card back from the discard pile, allowing for infinite mana. Then you play a card that says something like "spend X mana to deal X damage" and you deal a trillion damage.
[0] the above commenter is correct that a true infinite loop is not allowed. But you're allowed to create a scenario where an infinite loop happens according to a repeating choice you can make (essentially a while loop) and repeat as much as you want within the match timer while still allowing time for your damage card. The general etiquette is just to say "I can do this a billion times and so I deal a billion damage".
I've actually been at a local (mostly informal) tournament where someone with an Elf deck managed to pump their life into the thousands (you start with 20 or 40 depending on the ruleset), and his opponent with a Goblin deck got an infinite combo for infinite damage. But the Elf player refused to accept "I can do this infinity times" and made him actually try to perform his card combo over a thousand times before the round timer ran out. Goblin deck did not win.
- aidenn0 1 year ago> I've actually been at a local (mostly informal) tournament where someone with an Elf deck managed to pump their life into the thousands (you start with 20 or 40 depending on the ruleset), and his opponent with a Goblin deck got an infinite combo for infinite damage. But the Elf player refused to accept "I can do this infinity times" and made him actually try to perform his card combo over a thousand times before the round timer ran out. Goblin deck did not win.
So the Goblin-deck owner allowed the Elf-deck owner to do a "I give myself 1000 life" with a combo but the Elf-deck owner wouldn't let the Goblin-deck owner do the same with damage? That's kind of a jerk move if so.
- YurgenJurgensen 1 year agoAn interesting result of how MtG handles infinite loops plus how it handles priority is that in a scenario where two players attempt to go infinite whoever gets to name their number last wins. And that most infinite loops are non-reloadable, in that when you stop repeating them, you can't restart them for free. I have seen a game that was lost because one player had an infinite life combo, named "a hundred trillion" and wrote their life total down on a piece of paper, and later in the game an opponent who had apparently mis-heard "a hundred billion" and didn't think to check only elected to repeat their infinite combo a trillion times.
So the moral of this story is, uh, always name Graham's number. Or don't because I'm not sure what a Judge is to do if two people name numbers so large that the Judge can't work out which one is bigger on a pocket calculator.
(I think that in a Comp REL game, in your scenario, the Goblin player should have won unless the combo was non-deterministic.)
- gpderetta 1 year agoI'm not terribly familiar with tournament rules, but AFAIK in paper games you can always shortcut truly infinite actions by picking a number and the opponent has to accept it, it is not just etiquette.
- fishe 1 year agoThe elf player cheated, your opponent can't stop you from shortcutting a valid loop.
- aidenn0 1 year ago
- sciolist 1 year agoHere's a paper on creating a Turing machine in Magic:
- sdenton4 1 year agoLet us listen to the sweet stories of Sherazad...
https://gatherer.wizards.com/pages/card/Discussion.aspx?mult...
- x86x87 1 year agoIt's not that easy. There are strategies but they depend on the game format (standard, legacy, modern, etc) and on a deep understanding of the game meta. You cannot devise a strategy that works under any conditions. Lookup the rules + understand that new abilities and cards are introduced all the time.
- saghm 1 year agoI'm not sure what level of complexity you're looking for, but there are some pretty complex combos that have been viable over the years, even in formats that don't use some of the older "broken" cards. One popular strategy for a while in the "Modern" format, which doesn't allow cards for the first 10 years or so of the game, used a mechanic called "Storm" where a spell would be copied for every spell you previously cast in the same turn. A card called Grapeshot had this ability and did 1 damage, so the deck played creatures that made your spells cost less mana and spells that gave you extra mana or draw cards, and the goal was to cast 19 spells and then grapeshot your opponent for their entire starting life total of 20, often as early as on their fourth turn. It was consistent enough that it was a staple in the format for at least a few years (although I haven't kept up with the meta as much for a few years now). Another higher variance but potentially even faster combo used a creature called Griselbrand, which let you pay 7 life to draw 7 cards, a bunch of mana "rituals" like storm, and used a card called Nourishing Shoal to let you exile certain cards from your hand to gain life. The win condition was typically to draw at least 7 lands and cast a creature that let you discard a land to do 3 damage, and it could potentially do this on the very first turn, although eventually one of the cards that was necessary for it to function got banned in modern, although by then Griselbrand decks weren't really ever played due to there being far more consistent options with better ability to deal with an opponent trying to thwart their game plan. If you include Legacy (which allows cards from any point in the history of the game but still with a custom ban list) or Vintage (where all cards are allowed but some are "restricted" to only one copy instead of the typical 4 per deck), there are even more powerful combos you can take advantage of.
Combo decks have always and likely will always be a part of the meta for most formats, although to varying degrees depending on how many cards the format has available and how effective it happens to be in the current meta. It's considered one of the three main deck archetypes along with "control" decks that attempt to shut down what the opponent is trying to do and slowly build an advantage over time and "aggro" which use a more straightforward approach of just attacking the opponent with creatures or spells (or both). Not everything cleanly fits into one of those strategies of course, and even a deck that has a win condition that fits into one archetype might dip into the other as a backup plan (e.g. a combo deck with control elements that help it buy time if it can't get off the combo as quickly as it would prefer, or a control deck with some efficient creatures that it can use for a surprise attack if the circumstance makes sense), but even in a setting like playing a few games at a card shop on a Friday night, seeing a combo deck with the level of complexity described above isn't really uncommon at all.
That said, I've read that a lot of the hardest cards to program tend to be the ones that subvert the basic expectations of the game. One infamous example that comes to mind is a creature that after being cast added an extra turn after yours where you controlled your opponent, after which they took their regular turn and the turn order resumed its previous alternation. Programming that would require adding in the ability to show one player's hidden game state to the other, let them make any sort of decisions using their cards that the player would normally do (short of literally conceding the game) and inserting an extra turn in the order with that weird control mechanism...all just for one card out of tens of thousands! Obviously most cards are not that complex, and Arena specifically doesn't attempt to support literally every card in existence and instead supports cards going back to its initial stable release along with explicitly chosen cards added to special Arena-only sets in order to introduce them, but when its an explicit rule that the text on the card overrides the normal rules of the game when they disagree, it very quickly gets to the point where you need to consider that there will likely be an edge cast for almost any possible state transition.
- squeaky-clean 1 year ago
- asmor 1 year agoArena's rule engine and AI is based on Duels of the Planeswalkers, so they had several years to develop the AI player.
- apetresc 1 year agoArena's rule engine was explicitly not based on Duels; this was a big selling point when it first launched to replace Duels, and they've gone into some detail since then describing how it works. See https://magic.wizards.com/en/news/mtg-arena/on-whiteboards-n... for instance.
- ugexe 1 year agoThe AI player just casts the first card it has the mana to cast, regardless of if any normal player would do it. As an example Sparky will gladly cast a kill spell on their own creature if the opponent has none, or cast protection spells on the opponents creatures if it has no creatures itself. This is far different than duels of the planewalkers.
- Ensorceled 1 year ago14-15 years ...
- apetresc 1 year ago
- Dylan16807 1 year ago
- JimWestergren 1 year agoOn a related note, I have a blast playing old school magic 93/94 with my son. Of course using physical cards. We travel to Madrid each year to participate in the world championship of 7pts Singleton. This summer my son placed #9 which I am very proud of. 7pts Singleton is such a wonderful way to play the game with diverse affordable deck-building and balanced gameplay ( https://7pts-singleton.com )
- indigo945 1 year agoI wouldn't call a format where Black Lotus, Ancestral Recall and the Moxen are legal "affordable" - even though you can't play all of them in 7pts Singleton, even any single one of them costs thousands (or tens of thousands) of dollars. However, I'm glad you and your son enjoy the game, and congratulations on his placement.
- JimWestergren 1 year agoYes, I agree. And we don't own them. I find it a very stimulating intellectual exercise to construct a deck without those cards and still perform great. Those powerful cards have several points and only 7 points total are allowed in your deck. For example I currently choose to play Sol Ring instead of 2 of the moxes.
- JTon 1 year agoYou can get professionally printed proxies [1]. I've been told there's often a "don't ask, don't tell" policy around many unofficial mtg tournaments regarding proxies. It obviously upsets some people, but others see it as requirement for new players to enter legacy format (and keep it alive).
- JimWestergren 1 year agoIn the old school community: counterfeits absolutely not ok. Proxies normally ok except in some tournaments.
- JimWestergren 1 year ago
- chimeracoder 1 year ago> Proxies are allowed. We encourage the use of easily recognisable proxies as long as they are undetectable under sleeves and are easily recognizable and nicely made, but no counterfeits!
A proxy can be as simple as a basic land with Sharpie writing on it, so this format is by definition as affordable as Magic can ever be.
- JimWestergren 1 year agoExactly. Except that they should be easily recognizable and nicely made. So for example a basic plains that you draw over and make look a bit like the card is very recommended.
- JimWestergren 1 year ago
- Reubachi 1 year agoOfficial MTG tournaments "allow" proxies, cost is not and never has been a prohibitor to any paper magic.
WoTC as a card distrubtor on the other hand, does not agree with this. Thankfully they have no input on the matter. And is why they push the online avenues as much if not more than paper.
- phone8675309 1 year ago> Official MTG tournaments "allow" proxies
This is categorically false - any WPN/DCI sanctioned tournament forbids proxies except in extremely limited circumstances:
Section 3.4 - Proxy Cards A proxy card is used during competition to represent an otherwise legal Magic card or substitute card that can no longer be included in a deck without the deck being marked. For a proxy to be issued, the card it is replacing must meet at least one of the following criteria: • The card has been accidentally damaged or excessively worn in the current tournament, including damaged or misprinted Limited product. Proxies are not allowed as substitutes for cards that their owner has damaged intentionally or through negligence. • The card is a foil card for which no non-foil printing exists.
Players may not create their own proxies; they may only be created by the Head Judge who has sole discretion as to whether the creation of a proxy is appropriate. When a judge creates a proxy, it is included in the player’s deck and must be denoted as a proxy in a clear and conspicuous manner. The original card is kept nearby during the match and replaces the proxy while in a public zone as long as it is recognizable. A proxy is valid only for the duration of the tournament in which it was originally issued
- phone8675309 1 year ago
- JimWestergren 1 year ago
- indigo945 1 year ago
- onetimeuse92304 1 year agoPure client side game logic...
I once developed a small game. Sometimes, for responsiveness, you need to implement game logic on the client. But nothing says you can't redo the logic on the server and that's what I did.
It can be hard on a real time game like FPS or RTS, but there simply is no excuse for a card game.
I think for a card game like this you really want to send no more information to the client than a real player would see. So for example, rather than send the cards that the opponent has in hand, just send the number of cards that he has -- no more and no less than what you would see in a real game situation.
It goes without saying that any actions sent to the server are only speaking for you and not your opponent. So no, you should not be able to declare forfeit for your opponent. You should only be able to say "forfeit!" which the server interprets as your forfeit because you are the only player you have power over.
- lewisedc 1 year agoI'm pretty sure the article declares the game was programmed in exactly the way you are suggesting it should be, where you only get the information required at the time it's needed, and you only send actions for yourself.
The exploit was that one was able to set up a second client and connect to the currently ongoing game but in the opponents seat, once this was done they could sene actions as the opponent including the forfeit action.
- Ensorceled 1 year ago> It can be hard on a real time game like FPS or RTS, but there simply is no excuse for a card game.
As the article clearly states, the game play is entirely server side. The author exploited a problem in the authorization and game connection code, not any client side game logic.
> It goes without saying that any actions sent to the server are only speaking for you and not your opponent. So no, you should not be able to declare forfeit for your opponent. You should only be able to say "forfeit!" which the server interprets as your forfeit because you are the only player you have power over.
You are simply repeating how exploit that the author found works.
- mkonecny 1 year agoThe author explicitly mentions this is how the game is implemented in the first 1/3 of the article
- PawgerZ 1 year agoReading the post explains the post.
- lewisedc 1 year ago
- chupasaurus 1 year agoIn League of Legends there was a division-by-zero bug with a certain champion and item which caused server to kick all players and then crash. Because the exploiter was being kicked last, their team gets the win while opponents get Loss Prevented because the game doesn't have a normal result.
- MaxikCZ 1 year agoIf the enemy doesnt get loss because game doesnt have normal result, winning team should not get win aswell...
- chupasaurus 1 year agoIIRC it was added to the game because of serial leavers (and cheaters, which is funny with this exploit) and then sometime later applied to deal with server instability issues.
- chupasaurus 1 year ago
- 1 year ago
- BlorpyHuman 1 year ago[flagged]
- MaxikCZ 1 year ago
- ProjectArcturis 1 year agoI love the accessible yet insightful level of detail in this post.
One thing I don't understand is, in the case where you connect your bot during a real match, 1) why does the game allow someone to join mid-match, and 2) when the bot resigns, why does that count as your opponent resigning? If it's creating a 3-player game, Player 3 conceding shouldn't also make Player 2 concede.
- squeaky-clean 1 year ago> If it's creating a 3-player game, Player 3 conceding shouldn't also make Player 2 concede.
It stays a 2 player game, his code has to figure out which "seat" index his account is, and then has the bot join the other seat index.
The problem is that they're not validating that the joining user is the correct user that should be in that seat.
There's also the thought that you shouldn't allow a player to connect to an already connected seat. But since this game is also available on mobile, you probably want disconnection timeouts to be fairly long, and you don't want to interrupt a player who briefly disconnected and then reconnected before the timeout has recognized their early connection is broken. I've seen this in other games, where you try to reconnect and get a "cannot join game in progress" for about 10 seconds until you're actually able to reconnect.
Basically imagine showing up to an MTG tournament at your local game store, pushing someone out of their seat, sitting in it and shouting "I concede!". And then the judges agree that player B forfeited the game because the person in their chair declared it.
- Vicinity9635 1 year agoThanks for this simple explanation! I got distracted by the [FULL VERSION] Magnus Carlsen Blind & Timed Chess Simul at the Sohn Conference in NYC (https://www.youtube.com/watch?v=xmXwdoRG43U) video and now I'm late for dinner!
- Vicinity9635 1 year ago
- virgildotcodes 1 year ago1) I'm guessing this is how they handle people reconnecting after a disconnection. You terminate the old connection? 2) The bot replaces player 2, then submits a resignation. The server registers it as player 2 resigning.
- ProjectArcturis 1 year agoAh, makes sense. I guess they just assume that any client who is requesting to sit in that seat is authorized to.
- Ensorceled 1 year agoYeah, the seat is the problem. There are a LOT of security systems that depend on assuming the holder of a large random string, like a guid, is the proper holder of that string so it's not necessarily a bad thing for the match. They should have made the seat index random as well though they are probably now just checking credentials.
- knallfrosch 1 year agoLooks to me like they only verified match ids, not the seats at all.
- Ensorceled 1 year ago
- Ensorceled 1 year agoYes, I had my desktop version of MTGA hang and when I connected to the match with my iPhone it immediately disconnected the desktop.
- ProjectArcturis 1 year ago
- YawningAngel 1 year agoMTG: Arena doesn't allow three player games, so what the bot is doing is joining _in_ the opponent's seat. Presumably this is why it can concede on their behalf. I guess the game doesn't check for this because its developers didn't see why anyone would even care to try.
- squeaky-clean 1 year ago
- r1ch 1 year agoThis takes me back to the Diablo 2 days when you could connect an open server character (LAN) onto the official bnet (internet) servers by reusing the same connection packets. Since open server data was all saved locally, you could create all kinds of items that aren't supposed to exist and the official server would still accept them.
- w-ll 1 year agoLol, i recently got into MTG again with MTGA. I did a quick decompile as its a Unity game and not il2cpp (not that it would have protected it that much) but I found some fun stuff too. Keys for their epic launcher build, some undocumented apis.
I never wanted to use it to cheat, i really just wish there was a battle log. What matches I won, what I lost, view the battlefied of a finished game, etc...
Gonna check this out, but hopefuly its patched quick.
- danielwmayer 1 year agoThis vulnerability was patched before I wrote the post - I disclosed it to MTG.
In terms of viewing your history, you should check out https://untapped.gg/en. I have talked to them a bit and they essentially do what you want. They take most of their info from MTG's debug log, which you can find in MTGA's application directory, so you could also make your own tracker as well if you want. They talk about it on their site: https://help.hearthsim.net/en/articles/3620440-how-do-i-supp...
- 59nadir 1 year agoWhat is the Twitter post for? I'm assuming this was not you "disclosing" it to them, but it's basically some kind of advertisement for yourself? You did contact them via a proper, private channel to disclose and make sure they fixed it before the Twitter post, correct?
- danielwmayer 1 year agoThey didn't respond to my email so I tried twitter. That got a prompter response! No details about how to actually perform the insta-win are visible in the video so I wasn't too pressed about someone replicating it from the tweet
- danielwmayer 1 year ago
- aethros 1 year agoWhat was the process like disclosing the bug to them? One part of your post that you left out and I was curious on. Was it friendly/straightforward? Were they surprised at all that this was possible?
- danielwmayer 1 year agoPretty nondescript. I just sent them the code and explained how to replicate it. They said they'd patch it and then they did haha. They offered me some in-game currency as a reward (20,000 gems, which I think is equivalent ~115 bucks).
- danielwmayer 1 year ago
- 59nadir 1 year ago
- maxwindiff 1 year agohttps://www.17lands.com/ collects your limited game win/loss stats, and it also records your turn-by-turn game history for both limited and constructed games. (I was a contributor)
- Namahanna 1 year agohttps://mtgaassistant.net/ is the most common one I know of for collecting your play data.
- tayo42 1 year agoI'm pretty sure this exists. I think it's player log. There are a bunch of apps that do tracking that use it iirc
- blargpls 1 year agoThere is mtgatool, an open source app to read the logs and generate a history of played games and some statistics: https://github.com/mtgatool/mtgatool-desktop
- blargpls 1 year ago
- danielwmayer 1 year ago
- no_time 1 year agoHow hard would it be to write a server emulator that facilitates LAN matches with all cards unlocked?
I have no interest in interacting with a glorified skinnerbox.
- bodangly 1 year agoYou can just use Cockatrice for that. Sure it’s not as pretty or as easy, but it supports every card since you pretty much are playing paper magic and it’s not trying to be the referee.
- asmor 1 year agoI think a lot of people explicitly do not want to bother with playing essentially paper magic, because it requires quite a bit more concentration if your board state is complicated to not miss any triggers or phase change too far accidentally.
- bodangly 1 year agoUnderstandable. I do think knowing how to play paper magic leads to a better understanding of the game but being a spike isn’t everyone’s goal.
- bodangly 1 year ago
- asmor 1 year ago
- frameset 1 year agoThe project you want is http://xmage.today/
All cards available, and full rules engine.
- no_time 1 year agoThis is what I was looking for, thanks. Gonna give it a spin with friends.
- no_time 1 year ago
- RALaBarge 1 year agoThere was an app called Apprentice that was popular around 1996, and that is how we would lay MT:G via IRC. It was a generic tabletop simulator and you create or import he cards.
- bodangly 1 year ago
- squeaky-clean 1 year agoThat's very fun. This is a "simple" enough exploit that I sent it to my MTG group chat, I bet they can understand it without needing to understand any programming jargon beyond client/server.
I'm simultaneously surprised something this simple worked, and also not surprised at all. He does make a good point, this is an effective way to provide a practice bot and not need to make many server side modifications. I understand why they did it this way. The problem is they didn't make any server side modifications haha.
Edit: so far 3 of them have given me a lol or laugh emoji. This is excellent writing.
- adw 1 year agoIt’s shown up in one of the bigger Magic-podcast Discords too. You nailed the writing on this. And “always validate your inputs”!
- danielwmayer 1 year agoThank you!
- adw 1 year ago
- 1 year ago
- althea_tx 1 year agoGreat post. Thank you for highlighting that hilarious code comment.
- ljlolel 1 year agoThis is buried but fascinating: magic the gathering is turing complete, probably even more complicated than simply uncomputable , and possibly the most complicated major real world game
- partomniscient 1 year agoThe thing that weirded me the most in the article out was seeing the 'goto IL_1894' statements in C# code.
It brought back memories of error handling in VB6, and was rather unpleasant. I presume this is being done for performance reasons?
- neonsunset 1 year agoThis is simply how C# decompiled from IL looks like - sometimes you can turn IL-level gotos back into control flow idioms and sometimes not.
- neonsunset 1 year ago
- MountainMan1312 1 year agoWish we could hack the card-shuffler for MTGA. I can't remember the last time I had a match where at least one of us didn't have either no land or nothing but land.
- mproud 1 year agoThere’s supposed to be some non-random hand smoothing going on MTGA.
- baoluofu 1 year agoMy understanding is that at the start of a game, the system shuffles and draws three hands for you, and then selects one of them to be your actual starting hand. I don't know what heuristics it uses for which of the three to select, but typically in real life you would be hoping for three lands as a baseline, ideally that can tap for the colours of the spells in your hand as well.
I believe this only applies in best of 1 matches, but not best of three matches.
Unfortunately I don't have a credible source for this.
- Karliss 1 year agoDoes MTGA not have any kind of Mulligan mechanics that would solve the initial bad hand?
- MountainMan1312 1 year agoYou can, but it doesn't help when your next hand is exactly the same, or the opposite problem. There's been times I mulligan down to 1 card and see nothing but land the entire way through. Probably in the same match, the opponent mulligans down to 3 cards just to get 1 land.
It's bad enough that my friend group casually accepts having to "concede" 2 or 3 times just to get a decent match going.
- Ensorceled 1 year agoIt does, you can shuffle and draw a new hand but then you need to put a card from your hand on the bottom of the deck (you can repeat, putting two cards on the bottom, then three, etc.)
Card advantage is massive in MTGA so people don't mulligan when they should ...
- MountainMan1312 1 year ago
- baoluofu 1 year ago
- minimaxir 1 year agoThis goes all the way back to the original Magic the Gathering: Online in 2001. tl;dr it's actually random unlike real shuffling: https://forum.nogoblinsallowed.com/viewtopic.php?f=15&t=1184...
- ugexe 1 year agoMTGO does not use the same shuffler as MTGA
- ugexe 1 year ago
- mproud 1 year ago
- erfgh 1 year agoMTG is not very interesting when actually playing it. Most of the game is building your deck. Thereafter the deck mostly plays by itself.
- mgdev 1 year agoBuilding deck = programming
Playing = executing
- alfons_foobar 1 year agoThere are drafts/sealed, you know...
- mgdev 1 year ago
- chrisweekly 1 year agoKudos for a very well-written and educational post!
- araes 1 year agoThe TLDR is a little too short.
- Decompile C# for Sparky bot [a], rewrite Sparky to be a substitute online opponent, connect Sparky vs you online as if you're connecting a human in a match, have Sparky auto-concede and jack your win rate.
[a] Note I thought was interesting was: "C# is also really nice because it utilizes metadata tokens to associate elements of the compiled code with their human-readable names, which are still stored in the compiled .NET assembly. That means I can see all the function, variable, and class names that the developers wrote when they wrote their code." Which means its super easy to reverse engineer.
- wbecher 1 year agowell... WOTC is a small indie game company
- dbttdft 1 year ago[dead]