Database security
Б.Наранчимэг
Мэдээлэл, компьютерийн ухааны тэнхим
ХШУИС, МУИС
naranchimeg@[Link]
Security Aspects
• Some aspects of data security to address are
• Integrity: the data should be protected from corruption
(accidental or intentional).
• Availability: the data should be readily accessible by designated
users.
• Confidentiality: the company’s data should not be accessible by
undesignated users.
• Privacy: in some situations it is the user’s data that requires
protecting.
• Theft and Fraud: taking the information itself may be seen as theft
or altering the data may be a mechanism for theft
Threat Assessment
• One should examine the database and the way it is used, looking for
threats to the databases.
• Threats are problems that might occur.
• Threats may be intentional, for example, hackers.
• Threats may be accidental, for example, server going down.
Countermeasures
• Countermeasures are actions taken to prevent, oppose or retaliate
for some specific action.
• Securing a database and the network it is on involves implementing
countermeasures for the threats posed.
Counter measures
• Authorization
• Access controls
• Views
• Backup and recovery
• Integrity
• Encryption
Database security
• A DBMS typically includes a database security and authorization
subsystem that is responsible for ensuring the security portions of a
database against unauthorized access.
• Two types of database security mechanisms:
• Discretionary security mechanisms
• Mandatory security mechanisms
Authorization
• Authorization
• The granting of a right or privilege that enables a subject to have legitimate
access to a system or a system’s object.
• Authentication
• A mechanism that determines whether a user is who he or she claims to be.
Authorization
• Authorization: what a user (or application) is allowed to do, i.e. what
privileges he has.
• Database actions:
• SELECT: can query data
• UPDATE: can change data
• INSERT: can add new data
• DELETE: can eliminate data
Access control
• The security mechanism of a DBMS must include provisions for
restricting access to the database as a whole
• This function is called access control and is handled by creating user accounts
and passwords to control login process by the DBMS.
Database Security and the DBA
• The database administrator (DBA) is the central authority for
managing a database system.
• The DBA’s responsibilities include
• granting privileges to users who need to use the system
• classifying users and data in accordance with the policy of the organization
• The DBA is responsible for the overall security of the database
system.
Database Security and the DBA
• The DBA has a DBA account in the DBMS
• Sometimes these are called a system or superuser account
• These accounts provide powerful capabilities such as:
• 1. Account creation
• 2. Privilege granting
• 3. Privilege revocation
• 4. Security level assignment
• Action 1 is access control, whereas 2 and 3 are discretionary and 4 is used to control
mandatory authorization
Types of Discretionary Privileges
• The account level:
• At this level, the DBA specifies the particular privileges that each account
holds independently of the relations in the database.
• The relation level (or table level):
• At this level, the DBA can control the privilege to access each individual
relation or view in the database.
Types of Discretionary Privileges
GRANT privilege [, privilege...]
TO user [, user...];
• The privileges at the account level apply to the capabilities
provided to the account itself and can include
• the CREATE SCHEMA or CREATE TABLE privilege, to create a
schema or base relation;
• the CREATE VIEW privilege;
• the ALTER privilege, to apply schema changes such adding or
removing attributes from relations;
• the DROP privilege, to delete relations or views;
• the MODIFY privilege, to insert, delete, or update tuples;
• and the SELECT privilege, to retrieve information from the
database by using a SELECT query.
Types of Discretionary Privileges
• The second level of privileges applies to the relation level
• This includes base relations and virtual (view) relations.
GRANT object_priv [(columns)]
ON object
TO {user|role|PUBLIC}
[WITH GRANT OPTION];
• <object_priv> is a list of
• SELECT <columns>,
• INSERT <columns>
• DELETE
• UPDATE <columns>
• ALL
• <object> is the name of a table or view (later)
• WITH GRANT OPTION means that the users can pass their privileges on to others
Creating Users
• The DBA creates users by using the CREATE
USER statement.
CREATE USER user
IDENTIFIED BY password;
SQL> CREATE USER scott
2 IDENTIFIED BY tiger;
User created.
Mandatory access control
• In many applications, and additional security policy is needed that classifies data
and users based on security classes.
• This approach as mandatory access control, would typically be combined with the
discretionary access control mechanisms.
• Typical security classes are top secret (TS), secret (S), confidential (C), and
unclassified (U), where TS is the highest level and U the lowest: TS ≥ S ≥ C ≥ U
Views
• A view is the dynamic result of one or more relational operations
operating on the base relations to produce another relation.
• A view is a virtual relation that does not actually exist in the
database, but is produced upon request by a particular user, at the
time of request.
• a powerful and flexible security mechanism by hiding parts of the
database from certain users.
Backup and Recovery
• Backup
• The process of periodically taking a copy of the database and log file (and
possibly programs) on to offline storage media.
• Journaling
• The process of keeping and maintaining a log file (or journal) of all changes
made to the database to enable recovery to be undertaken effectively in the
event of a failure.
Integrity
• Integrity constraints also contribute to maintaining a secure database
system by preventing data from becoming invalid, and hence giving
misleading or incorrect results.
• Primary key
• Not null
• Foreign key
• Business rules
• Check constraint
Encryption
• A final security issue is data encryption, which is used to protect
sensitive data (such as credit card numbers) that is being transmitted
via some type communication network.
• The data is encoded using some encoding algorithm.
• An unauthorized user who access encoded data will have difficulty
deciphering it, but authorized users are given decoding or decrypting
algorithms (or keys) to decipher data.