Strong Database Programming Practices
As a developer of embedded systems, you need to predict possible attacks for your system and take the necessary steps to prevent them. To prevent these attacks, vulnerable areas of the database are a common target. But what and where are these vulnerable areas? Does the database provide the required prevention methods so developers can focus on susceptible areas of their applications?
Making sure that unknown data sent to a device is recognized and not allowed to enter the device is important, as numerous manipulation methods are used by attackers.
Important practices start by introducing secure coding principles and guidelines to developers of the embedded system. Data input validation is valuable not just to prevent SQL injection vulnerabilities, but also to protect data from encoding and type errors when accessed later. A clear database schema with strongly typed columns is of great benefit. Session management is responsible for routing database requests to an appropriate database connection. An embedded database with robust transaction-based locking greatly simplifies session management in multithreaded applications. By defining safe code practices, it becomes possible to monitor database access and identify non-compliant application behaviors.
Secure Database Programming Practices
One obvious place of attention is when a device opens itself up to connections from other systems, the Internet, and various cloud services. Meanwhile, various database layers are a subject of attack and need consideration. The possible preconditions that would allow an attacker to access the database, including both logical and physical access, must be identified.
The first step in any exploit is finding possible ways to extract information from the device, starting with the structure of the data and organization of the system. SQL injection vulnerabilities enable an attacker to insert malicious SQL statements, run desired queries, and delete, change, or even add new records and tables to the database remotely through application-level communication channels. SQL injection attacks occur when developers produce dynamic SQL code either directly or through general frameworks. Robust database interfaces with support for query parameters and efficient conditional logic within the SQL language itself are the best defense.
Combine Database Software and Device Hardware Security
The most difficult attacks to prevent occur at the hardware level, often when a device is stolen. For example, by attaching wires to certain pins, it is possible to silently monitor the activity of various components. If your data must move from one chip to another, this attack vector is active. But you can make sure everything passed through the wire is in an encrypted format.
Network attacks only require an attacker to have access to the same physical network as a device. When a client application accesses a database, it may only be offered access to a limited portion of the database. Without a secure protocol, it would be possible to craft a message to imitate another connection with greater access privileges. Protocols based on Transport Layer Security (TLS), the successor to SSL, use encryption and certificates to protect each client connection. Careful configuration, such as Diffie–Hellman key exchange, is necessary to correctly secure the communications channel. A robust database communications protocol provides access to all necessary configuration options and leverages encryption hardware to improve performance and protect secret cryptographic keys.
To learn more about embedded database management and security, read our Embedding Security for IoT Device Data White Paper.
For more information, contact ITTIA.