Security Analysis of online game database servers

Source: Internet
Author: User

Although online games are not a database-centric system, like other applications, the database stores important data closely related to players and operators, such as accounts and equipment, and game operation data. The theft or tampering of this data will seriously affect the operation of a game.
From the perspective of game server development, we can analyze the security considerations of the Game Database.
The game database is generally divided into the game world, the player role database, and the login database.
Generally, the game world has a set of player-related databases in each game server group, which are generally placed at the backend of the game server. The login database may be associated with the registration server according to different operating methods, it is a database independently and provides services for the application server and web registration server.
In this way, the database is exposed in different places, and attackers can perform attacks in different ways. Specifically, there are several types of attacks:
1. Attackers use plug-ins to launch attacks on the client, and execute Database Operations indirectly by executing the logic on the server.
2. web registration server attacks.
3. directly connect to the database for attack.
4. Simulate network packet sending requests.
These attacks can be carried out from top to top.
As server developers, we also need to provide comprehensive database protection.
Here are some of the database protection measures that I can think.

1. game server logic layer Verification
The Operations sent from the client on the game server are verified on the server based on the data and rules of the server, and the activities that do not conform to the logic are reasonably processed. In this way, the client is logically prevented from being cheated on the server by using plug-ins, and database data is operated through the server logic indirectly.
2. Network Packet Security
Encrypt network packets
Verify the sent data packets to ensure the integrity of the data packets. For example, each packet has a verification segment;
Verify the sending source of network packet information. For example, each network packet must be unique to the sender, which can be provided during user authentication.
3. The front-end server filters SQL operations
The classic SQL injection is to add some SQL statements to the string to change the original SQL operation and perform illegal operations on the database.
There are also some SQL statements, such as some database built-in functions, which allow the operator to gain administrator privileges.
These operations should be avoided at the front end of the server. The common practice is to escape characters in SQL strings to prevent SQL injection.
Filter some special SQL statements on the front end so that these operations cannot affect the database server at all.
4. Software Architecture isolation
The database is isolated from the server software architecture design. a dbi layer is designed on the upper layer of the database to access all database operations through DBI, reducing possible risk sources.
5. isolation at the network layer
Place the database layer on the backend of the network. For example, if the registration server is exposed to the Internet, but the DB server connected to the registration server is placed in the firewall, it is only connected to the registration server, it is not directly exposed to the Internet environment.
6. Database Access source restrictions
Generally, you can set access sources for databases, such as limiting IP addresses or CIDR blocks.
7. Database Authentication Method
Generally, databases support multiple authentication methods, such as password authentication, operating system authentication, and key authentication, and some even support biometric authentication.
Select an authentication method that you think is the latest person.
For example, some people prefer to write the user name and password of the database in a configuration file, and then access the database through the user name and password in the configuration file. This is obviously not safe enough. Once someone sees the user name and password in various ways, the database will be in a very dangerous state. This password is not safe.
If you use a password, remember to use a complex password.
8. Database authorization
Do not set the user of the production database as the administrator, but only set the access permissions required by the user.
First, you can take away the advanced and dangerous permissions such as creating and Deleting Users and deleting databases.
Then, the CREATE, drop, alter, select, and other permissions are strictly assigned to each table. Only the required permissions are assigned to the table.
Then, some databases support column permissions, so that they can restrict access to those tables and columns.
9. Isolate database operations using views, stored procedures, and functions
You can use a view to logically isolate database operations from the database and logically block unnecessary data.
In addition, the view provides different views for different users without modifying the table structure.
Stored Procedures and functions can also isolate data. By providing a limited structure, most operations on the database itself are blocked.

10. database log auditing
Logs and audits database operations, and generates alarms for illegal data.
The administrator can check database operations afterwards to detect and make up for problems in a timely manner.

11. Database Configuration items
Databases generally have a variety of complex configuration items, which can prevent some protection against the database.
For example, you can set the number of reconnect failures for a single user and the handling method after the failure. Avoid brute force password cracking.
For example, set a proper number of database connection failures to avoid database denial of service due to intentional malicious connection.

12. Database Backup
Back up the database regularly in a timely manner to prevent restoration after the database is damaged.
For example, the database is regularly backed up in the early morning.
For Oracle and other databases, Advanced Replication and replica uard are available.
It is necessary to retain certain data redundancy during database usage.

13. clusters, images, etc.
Database mirroring, such as an image disk or backup storage, ensures data security.
Cluster the database to ensure the efficiency and response speed of the database operation, and will not be dragged down by a large amount of data access.

14. Data Encryption
Encrypt and save some data, such as passwords, into ciphertext.
In this way, even data loss is not necessarily cracked.

These are my personal summary. I hope you can add them.

Author: lixinso
Email: lixinso [at] Gmail [Dot] com
You are welcome to discuss various issues related to server development.

For details about how to build dataguard and RAC, refer to the two user manuals I wrote a few years ago. You can download them on csdn:
Redhatas4 + Oracle10g RAC environment construction practices
Http://download.csdn.net/source/2580884
Summary of Oracle 10g Data guard in Windows
Http://download.csdn.net/source/2580886

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.