CH- 7
CH- 7
Database security refers to the collective measures used to protect and secure a
database or database management software from illegitimate use and malicious
cyber threats and attacks.
•Flow Control − Distributed systems encompass a lot of data flow from one
site to another and also within a site. Flow control prevents data from being
transferred in such a way that it can be accessed by unauthorized agents. A
flow policy lists out the channels through which information can flow. It also
defines security classes for data as well as transactions.
Through RBAC, you can control what end-users can do at both broad
and granular levels.
•SQL lets you select and output data from the database. An SQL Injection
vulnerability could allow the attacker to gain complete access to all data in a
database server.
•SQL also lets you alter data in a database and add new data. For example,
in a financial application, an attacker could use SQL Injection to alter
balances, void transactions, or transfer money to their account.
•You can use SQL to delete records from a database, even drop tables. Even
if the administrator makes database backups, deletion of data could affect
application availability until the database is restored. Also, backups may not
cover the most recent data.
•In some database servers, you can access the operating system using the
database server. This may be intentional or accidental. In such case, an attacker
could use an SQL Injection as the initial vector and then attack the internal
network behind a firewall.
SQL Injections can do more harm than just by passing the login algorithms. Some
of the attacks include
•Deleting data
•Updating data
•Inserting data
•Executing commands on the server that can download and install malicious
programs such as Trojans
•Exporting valuable data such as credit card details, email, and passwords to the
attacker’s remote server
•Getting user login details etc
How to Prevent against SQL Injection Attacks
An organization can adopt the following policy to protect itself against SQL
Injection attacks.
•User input should never be trusted - It must always be sanitized before it is used
in dynamic SQL statements.
•Stored procedures – these can encapsulate the SQL statements and treat all input
as parameters.
•Prepared statements –prepared statements to work by creating the SQL statement
first then treating all submitted user data as parameters. This has no effect on the
syntax of the SQL statement.
•Regular expressions –these can be used to detect potential harmful code and
remove it before executing the SQL statements.
•Database connection user access rights –only necessary access rights should be
given to accounts used to connect to the database. This can help reduce what the
SQL statements can perform on the server.
•Error messages –these should not reveal sensitive information and where exactly an
error occurred. Simple custom error messages such as “Sorry, we are experiencing
technical errors. The technical team has been contacted. Please try again later” can
be used instead of display the SQL statements that caused the error.