2012-03-07, 04:31 PM
![[Image: Maplestory%20Network%20Configuration.png]](http://southperry.net/images/personal/Maplestory%20Network%20Configuration.png)
This is the approximate of how it all works.
The database cluster is a series of servers that all act together as a single logical entity. They all have what boils down to the same info on them, and whichever one you talk to shares it's changes with the rest. All channels are sharing this single entity, they don't have to sync an independent DB per channel.
Each server is running 1 or more daemons. Each Daemon is responsible for listening on a single port and being a specific channel.
The daemon is where gameplay actually occurs. It's the logical (software) server, as opposed to the physical (hardware) server that's hosting the daemon.
If the physical server goes down, all hosted daemons (channels) go down too. That's why we kept seeing those 4 specific channels drop on Bera the other day, those were all serviced by the same physical box which kept becoming unreachable. You can also kill an individual daemon if you can figure out a way to make it perform an illegal operation and crash, which we've seen before.
In general principle the user/client never directly interacts with the database. You interact with the daemon and the daemon remains a middleman between you and the database to protect the database. This scheme limits an attacker to what they can coerce the daemon into doing.
As has been noted previously, each daemon only syncs with the DB at set intervals and during set events. Changing channels, logging on, logging off, entering MTS/CS, those are all triggers, and then it also has it's periodic saves.
Since the daemon is the one doing all the writing to the DB, it's the point of vulnerability. If you can kill the daemon before it finishes sending all it's commands to the DB, and it's commands aren't nested in a transaction to make them all-or-nothing, voila, duping potential.
It's not having what you want - It's wanting what you've got.

