Unit-4-Database Security
Unit-4-Database Security
Unit-4-Database Security
Database systems provide efficient access to large volumes of data and are vital to
the operation of many organizations. Because of their complexity and criticality,
database systems generate security requirements that are beyond the capability of
typical OS-based security mechanisms or stand-alone security packages.
Relational Databases- In relational database parlance, the basic
building block is a relation, which is a flat table. Rows are referred to as
tuples, and columns are referred to as attributes. . A primary key is defined to
be a portion of a row used to uniquely identify a row in a table; the primary
key consists of one or more column names. In the example of Figure 5.2, a
single attribute, PhoneNumber, is sufficient to uniquely identify a row in a
particular table. An abstract model of a relational database table is shown as
Figure 5.3. There are N individuals, or entities, in the table and M attributes.
Each attribute Aj has |Aj| possible values, with xij denoting the value of
attribute j for entity
i. To create a relationship between two tables, the attributes that define the
primary key in one table must appear as attributes in another table, where
they are
A primary key is defined to be a portion of a row used
to uniquely identify a row in a table; the primary key consists of one or more
column names. In the example of Figure 5.2, a single attribute, PhoneNumber, is
sufficient to uniquely identify a row in a particular table. An abstract model of a
relational database table is shown as Figure 5.3. There are N individuals, or
entities, in the table and M attributes. Each attribute Aj has |Aj| possible values,
with xij denoting the value of attribute j for entity i.To create a relationship
between two tables, the attributes that define the primary key in one table must
appear as attributes in another table, where they are referred to as a foreign key.
Whereas the value of a primary key must be unique for
each tuple (row) of its table, a foreign key value can appear multiple times in a
table, so that there is a one-to-many relationship between a row in the table with
the primary key and rows in the table with the foreign key. In following figure, In
the Department table, the department ID (Did) is the primary key; each value is
unique. This table gives the ID, name, and account number for each department.
The Employee table contains the name, salary code, employee ID, and phone
number of each employee. The Employee table also indicates the department to
which each employee is assigned by including Did. Did is identified as a foreign
keyand provides the relationship between the Employee table and the Department
table.
The preceding are just a few examples of SQL functionality. SQL statements can
be used to create tables, insert and delete data in tables, create views, and retrieve
data with query statements.
SELECT Ename, Eid, Ephone
FROM Employee WHERE Did = 15
This query returns the Ename, Eid, and Ephone fields from the Employee table for
all employees assigned to department 15.
Following are some access rights SQL based access rights SQL provides two
commands for managing access rights, GRANT and REVOKE.
For different versions of SQL, the syntax is slightly different. In general terms, the
GRANT command has the following syntax:
GRANT {privileges (access permissions granted) | role (role based access rights
supported)}
[ON table (table name)]
TO {user | role | PUBLIC}
[IDENTIFIED BY password (Authentication)]
[WITH GRANT OPTION]
A PUBLIC value indicates that any user has the specified access rights. The
optional IDENTIFIED BY clause specifies a password that must be used to revoke
the access
rights of this GRANT command. The GRANT OPTION indicates that the grantee
can grant this access right to other users, with or without the grant option.
• Select: Grantee may read entire database; individual tables; or specific columns
in a table.
• Insert: Grantee may insert rows in a table; or insert rows with values for specific
columns in a table.
• Update: Semantics is similar to INSERT.
• Delete: Grantee may delete rows from a table.
• References: Grantee is allowed to define foreign keys in another table that refer
to the specified columns.
The REVOKE command has the following syntax:
REVOKE { privileges | role }
[ON table]
FROM { user | role | PUBLIC }
Thus, the following statement revokes the access rights of the preceding example:
REVOKE SELECT ON ANY TABLE FROM ricflair
Fixed server roles are defined at the server level and exist
independently of any user database. They are designed to ease the administrative
task. These roles have different permissions and are intended to provide the ability
to spread the administrative responsibilities without having to give out
completeControl. Database administrators can use these fixed server roles to assign
different administrative tasks to personnel and give them only the rights they
absolutely need. Fixed database roles operate at the level of an individual database.
As with fixed server roles, some of the fixed database roles, such as
db_accessadmin and db_securityadmin, are designed to assist a DBA with
delegating administrativeResponsibilities. Others, such as db_datareader.
Following table shows some role based access permissions.
INFERENCE
Users of these views are not authorized to access the relationship between Item and
Cost. A user who has access to either or both views cannot infer the relationship by
functional dependencies. That is, there is not a functional relationship between
Item and Cost such that knowing Item and perhaps other information is
sufficient to
deduce Cost. A user who knows the structure of the Inventory table and who
knows that the view tables maintain the same row order as the Inventory table is
then able to merge the two views to construct the table shown in Figure 5.8c. This
violates the access control policy that the relationship of attributes Item and Cost
must not be disclosed
The database is typically the most valuable information resource for any
organization and is therefore protected by multiple layers of security, including
firewalls, authentication mechanisms, general access control systems, and database
access control systems. In addition, for particularly sensitive data, database
encryption is warranted and often implemented. Encryption becomes the last line
of defense in database security.
There are two disadvantages to database encryption:
• Key management: Authorized users must have access to the decryption key for
the data for which they have access. Because a database is typically accessible to a
wide range of users and a number of applications, providing secure keys to
selected parts of the database to authorized users and applications is a complex
task.
• Inflexibility: When part or all of the database is encrypted, it becomes more
difficult to perform record searching.
Encryption can be applied to the entire database, at the record level (encrypt
selected records), at the attribute level (encrypt selected columns), or at the
level of the
individual field. A number of approaches have been taken to database encryption.
In this section, we look at a representative approach for a multiuser database.
Let us first examine the simplest possible arrangement based on this scenario.
Suppose that each individual item in the database is encrypted separately, all using
the same encryption key. The encrypted database is stored at the server, but the
server does not have the key, so that the data are secure at the server. Even if
someone were able to hack into the server’s system, all he or she would have
access
to is encrypted data. The client system does have a copy of the encryption key. A
user
at the client can retrieve a record from the database with the following sequence:
1. The user issues an SQL query for fields from one or more records with a
specific value of the primary key.
2. The query processor at the client encrypts the primary key, modifies the SQL
query accordingly, and transmits the query to the server.
3. The server processes the query using the encrypted value of the primary
key and returns the appropriate record or records.
4. The query processor decrypts the data and returns the results.
For example, consider this query, which was introduced in Section 5.1, on
thedatabase of Figure 5.4a:
Assume that the encryption key k is used and that the encrypted value of the
department id 15 is E(k, 15) = 1000110111001110. Then the query processor at the
client could transform the preceding query into
SELECT Ename, Eid, Ephone
FROM Employee
WHERE Did = 1000110111001110
This method is certainly straightforward but, as was mentioned, lacks flexibility.
For example, suppose the Employee table contains a salary attribute and the user
wishes to retrieve all records for salaries less than $70K. There is no obvious way
to do this, because the attribute value for salary in each record is encrypted. The set
of encrypted values do not preserve the ordering of values in the original attribute.