DATABASES AND
DATA SECURITY
It’s your data – are you sure it’s safe?
Advanced Database By Dagne W 08/10/2024 1
Chapter 2: Database Security
and Authorization
Advanced Database By Dagne W 08/10/2024 2 2
DATABASE OVERVIEW
Every company needs places to store
institutional knowledge and data.
Frequently that data contains proprietary
information
Personally Identifiable Data
Employee HR Data
Financial Data
The security and confidentiality of this data
is of critical importance.
Advanced Database By Dagne W 08/10/2024 3
Security
Security - protection from malicious attempts to steal or
modify data.
Database system level
Authentication and authorization mechanisms to allow
specific users access only to required data
We concentrate on authorization in the rest of this chapter
Operating system level
Operating system super-users can do anything they want to
the database! Good operating system level security is
required.
Network level: must use encryption to prevent
Eavesdropping (unauthorized reading of messages)
Masquerading (pretending to be an authorized user or
sending messages supposedly from authorized users)
Advanced Database By Dagne W 08/10/2024 4 4
Security
Physical level
Physical access to computers allows destruction
of data by intruders; traditional lock-and-key
security is needed
Computers must also be protected from floods,
fire, etc.
Human level
Users must be screened to ensure that an
authorized users do not give access to intruders
Users should be trained on password selection
and secrecy
Advanced Database By Dagne W 08/10/2024 5 5
Physical Level Security
Protection of equipment from floods, power failure, etc.
Protection of disks from theft, erasure, physical damage,
etc.
Protection of network and terminal cables from wiretaps
non-invasive electronic eavesdropping, physical damage,
etc.
Solutions:
Replicated hardware:
mirrored disks, dual busses, etc.
multiple access paths between every pair of devises
Physical security: locks,police, etc.
Software techniques to detect physical security breaches.
Advanced Database By Dagne W 08/10/2024 6 6
Human Level Security
Protection from stolen passwords, sabotage, etc.
Primarily a management problem:
Frequent change of passwords
Use of “non-guessable” passwords
Log all invalid access attempts
Data audits
Careful hiring practices
Advanced Database By Dagne W 08/10/2024 7 7
Operating System Level Security
Protection from invalid logins
File-level access protection (often not very helpful for
database security)
Protection from improper use of “superuser” authority.
Protection from improper use of privileged machine
instructions.
Advanced Database By Dagne W 08/10/2024 8 8
Network-Level Security
Each site must ensure that it communicate with
trusted sites (not intruders).
Links must be protected from theft or
modification of messages
Mechanisms:
Identification protocol (password-based),
Cryptography.
Advanced Database By Dagne W 08/10/2024 9 9
Database-Level Security
Assume security at network, operating system, human, and
physical levels.
Database specific issues:
each user may have authority to read only part of the
data and to write only part of the data.
User authority may correspond to entire files or
relations, but it may also correspond only to parts of
files or relations.
Local autonomy suggests site-level authorization control in
a distributed database.
Global control suggests centralized control.
Advanced Database By Dagne W 08/10/2024 10 10
DATABASES SECURITY
There are four key issues in the security of
databases just as with all security systems
Availability
Authenticity
Integrity
Confidentiality
Advanced Database By Dagne W 08/10/2024 11
AVAILABILITY
Data needs to be available at all necessary
times
Data needs to be available to only the
appropriate users
Need to be able to track who has access to
and who has accessed what data
Advanced Database By Dagne W 08/10/2024 12
AUTHENTICITY
Need to ensure that the data has been edited
by an authorized source
Need to confirm that users accessing the
system are who they say they are
Need to verify that all report requests are
from authorized users
Need to verify that any outbound data is
going to the expected receiver
Advanced Database By Dagne W 08/10/2024 13
Authorization
Forms of authorization on parts of the database:
Read authorization - allows reading, but not
modification of data.
Insert authorization - allows insertion of new
data, but not modification of existing data.
Update authorization - allows modification, but
not deletion of data.
Delete authorization - allows deletion of data
Advanced Database By Dagne W 08/10/2024 14 14
Authorization
Forms of authorization to modify the database schema:
Index authorization - allows creation and deletion of
indices.
Resources authorization - allows creation of new
relations.
Alteration authorization - allows addition or deletion
of attributes in a relation.
Drop authorization - allows deletion of relations.
Advanced Database By Dagne W 08/10/2024 15 15
Authorization and Views
Users can be given authorization on views, without
being given any authorization on the relations used in
the view definition
Ability of views to hide data serves both to simplify
usage of the system and to enhance security by
allowing users access only to data they need for their
job
A combination or relational-level security and view-
level security can be used to limit a user’s access to
precisely the data that user needs.
Advanced Database By Dagne W 08/10/2024 16 16
View Example
Suppose a bank clerk needs to know the names of the
customers of each branch, but is not authorized to see specific
loan information.
Approach: Deny direct access to the loan relation, but grant
access to the view cust-loan, which consists only of the
names of customers and the branches at which they have a
loan.
The cust-loan view is defined in SQL as follows:
create view cust-loan as
select branchname, customer-name
from borrower, loan
where borrower.loan-number = loan.loan-number
Advanced Database By Dagne W 08/10/2024 17 17
View Example
The clerk is authorized to see the result of the
query:
select *
from cust-loan
When the query processor translates the result
into a query on the actual relations in the
database, we obtain a query on borrower and loan.
Authorization must be checked on the clerk’s query
before query processing begins.
Advanced Database By Dagne W 08/10/2024 18 18
Authorization on Views
Creation of view does not require resources
authorization since no real relation is being created
The creator of a view gets only those privileges that
provide no additional authorization beyond that he
already had.
E.g. if creator of view cust-loan had only read
authorization on borrower and loan, he gets only read
authorization on cust-loan
Advanced Database By Dagne W 08/10/2024 19 19
INTEGRITY
Need to verify that any external data has the
correct formatting and other metadata
Need to verify that all input data is accurate
and verifiable
Need to ensure that data is following the
correct work flow rules for your
institution/corporation
Need to be able to report on all data changes
and who authored them to ensure
compliance with corporate rules and privacy
laws.
Advanced Database By Dagne W 08/10/2024 20
CONFIDENTIALITY
Need to ensure that confidential data is only
available to correct people
Need to ensure that entire database is
security from external and internal system
breaches
Need to provide for reporting on who has
accessed what data and what they have done
with it
Mission critical and Legal sensitive data must
be highly security at the potential risk of lost
business and litigation
Advanced Database By Dagne W 08/10/2024 21
MIDDLEWARE SECURITY
CONCERNS
Another set of security issues come from
middleware that sits between the user and
the data
Single sign on authentication
Allows users to just have one password to access
all systems but also means that the theft of one
password endangers all systems
Advanced Database By Dagne W 08/10/2024 22
DATABASE SECURITY ISSUES
Types of Security
Legal and ethical issues
Policy issues
System-related issues
The need to identify multiple security levels
23
Advanced Database By Dagne W 08/10/2024
DATABASE SECURITY ISSUES
Threats to databases
Loss of integrity
Loss of availability
Loss of confidentiality
To protect databases against these types of
threats four kinds of countermeasures can be
implemented:
Access control
Inference control
Flow control
Encryption
24
Advanced Database By Dagne W 08/10/2024
DATABASE SECURITY ISSUES
Security threat: a security violation or attack that
can happen any time because of a security
vulnerability
Security risk: a known security gap intentionally left
open
Security vulnerability: a weakness in any information
system component
25
Advanced Database By Dagne W 08/10/2024
DATABASES SECURITY VULNERABILITY
Database Security and Auditing 26
DATABASES SECURITY THREATS
Database Security and Auditing 27
DATABASES SECURITY RISKS
Database Security and Auditing 28
DATABASES SECURITY
Database Security and Auditing 29
DATABASE SECURITY ISSUES
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
30
Advanced Database By Dagne W 08/10/2024
DATABASE SECURITY ISSUES
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.
Advanced Database By Dagne W 08/10/2024 31
DATABASE SECURITY ISSUES
The security problem associated with
databases is that of controlling the access
to a statistical database, which is used to
provide statistical information or summaries
of values based on various criteria.
Thecountermeasures to statistical database
security problem is called inference control
measures.
Advanced Database By Dagne W 08/10/2024 32
DATABASE SECURITY ISSUES
Another security is that of flow control,
which prevents information from flowing in
such a way that it reaches unauthorized
users.
Channels that are pathways for information
to flow implicitly in ways that violate the
security policy of an organization are called
covert channels.
Advanced Database By Dagne W 08/10/2024
33
DATABASE SECURITY ISSUES
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.
Anunauthorized user who access encoded data
will have difficulty deciphering it, but authorized
users are given decoding or decrypting algorithms
(or keys) to decipher data.
34
Advanced Database By Dagne W 08/10/2024
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.
35
Advanced Database By Dagne W 08/10/2024
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
Action1 is access control, whereas 2 and 3 are
discretionary and 4 is used to control mandatory
authorization
36
Advanced Database By Dagne W 08/10/2024
ACCESS PROTECTION, USER ACCOUNTS, AND DATABASE AUDITS
Whenever a person or group of person s need
to access a database system, the individual
or group must first apply for a user account.
The DBA will then create a new account id and
password for the user if he/she deems there is a
legitimate need to access the database
The user must log in to the DBMS by entering
account id and password whenever database
access is needed.
37
Advanced Database By Dagne W 08/10/2024
ACCESS PROTECTION, USER ACCOUNTS, AND DATABASE AUDITS
The database system must also keep track
of all operations on the database that are
applied by a certain user throughout each
login session.
Tokeep a record of all updates applied to the
database and of the particular user who applied
each update, we can modify system log, which
includes an entry for each operation applied to
the database that may be required for recovery
from a transaction failure or system crash.
S 38
Advanced Database By Dagne W 08/10/2024
ACCESS PROTECTION, USER ACCOUNTS, AND DATABASE AUDITS
If any tampering with the database is
suspected, a database audit is performed
A database audit consists of reviewing the log to
examine all accesses and operations applied to
the database during a certain time period.
A database log that is used mainly for
security purposes is sometimes called an
audit trail.
39
Advanced Database By Dagne W 08/10/2024
DISCRETIONARY ACCESS CONTROL BASED ON GRANTING AND REVOKING PRIVILEGES
The typical method of enforcing
discretionary access control in a database
system is based on the granting and revoking
privileges.
Advanced Database By Dagne W 08/10/2024
Slide 23- 40
TYPES OF DISCRETIONARY PRIVILEGES
The account level:
Atthis level, the DBA specifies the particular
privileges that each account holds
independently of the relations in the
database.
The relation level (or table level):
Atthis level, the DBA can control the privilege
to access each individual relation or view in
the database.
Advanced Database By Dagne W 08/10/2024
Slide 23- 41
TYPES OF DISCRETIONARY PRIVILEGES
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 theAdvanced
database by using
Database By Dagne W
a SELECT query.
08/10/2024
Slide 23- 42
TYPES OF DISCRETIONARY PRIVILEGES
The second level of privileges applies to the
relation level
Thisincludes base relations and virtual (view)
relations.
The granting and revoking of privileges
generally follow an authorization model for
discretionary privileges known as the access
matrix model where
The rows of a matrix M represents subjects
(users, accounts, programs)
The columns represent objects (relations,
records, columns, views, operations).
Each position M(i,j) in the matrix represents
the types of privileges (read, write, update)
that subject i holds on object j.
Advanced Database By Dagne W 08/10/2024
Slide 23- 43
Grant and Revoke
GRANT <privilege> ON <relation>
To <user>
[WITH GRANT OPTION]
----------------------------------------------------------------------------------------------------------------------------------
--
GRANT SELECT * ON Student TO Matthews
GRANT SELECT *, UPDATE(GRADE) ON Student TO
FARKAS
GRANT SELECT(NAME) ON Student TO Brown
GRANT command applies to base relations as well as
views
44
Grant and Revoke
REVOKE <privileges> [ON <relation>]
FROM <user>
------------------------------------------------------------------------------------------------------------------
-------
REVOKE SELECT* ON Student FROM Blue
REVOKE UPDATE ON Student FROM Black
REVOKE SELECT(NAME) ON Student FROM Brown
Database Security - Farkas 45
Cascading Revoke
B E
A D
C F
A revokes D’s privileges
B
A
46
Non-cascading Revoke
B E
A D
C F
A revokes D’s privileges
E
B
A
C F
47
TYPES OF DISCRETIONARY PRIVILEGES
To control the granting and revoking of relation
privileges, each relation R in a database is
assigned and owner account, which is typically
the account that was used when the relation
was created in the first place.
The owner of a relation is given all privileges on
that relation.
In SQL2, the DBA can assign and owner to a whole
schema by creating the schema and associating
the appropriate authorization identifier with that
schema, using the CREATE SCHEMA command.
The owner account holder can pass privileges on
any of the owned relation to other users by
granting privileges to their accounts.
Advanced Database By Dagne W 08/10/2024
Slide 23- 48
TYPES OF DISCRETIONARY PRIVILEGES
In SQL the following types of privileges can be
granted on each individual relation R:
SELECT (retrieval or read) privilege on R:
Gives the account retrieval privilege.
In SQL this gives the account the privilege to use the
SELECT statement to retrieve tuples from R.
MODIFY privileges on R:
This gives the account the capability to modify
tuples of R.
In SQL this privilege is further divided into UPDATE,
DELETE, and INSERT privileges to apply the
corresponding SQL command to R.
In addition, both the INSERT and UPDATE privileges
can specify that only certain attributes can be
updated by the account.
Advanced Database By Dagne W 08/10/2024
Slide 23- 49
TYPES OF DISCRETIONARY PRIVILEGES
In SQL the following types of privileges can
be granted on each individual relation R
(contd.):
REFERENCES privilege on R:
This gives the account the capability to reference
relation R when specifying integrity constraints.
The privilege can also be restricted to specific
attributes of R.
Notice that to create a view, the account
must have SELECT privilege on all relations
involved in the view definition.
Advanced Database By Dagne W 08/10/2024
Slide 23- 50
SPECIFYING PRIVILEGES USING VIEWS
The mechanism of views is an important
discretionary authorization mechanism in its
own right. For example,
Ifthe owner A of a relation R wants another
account B to be able to retrieve only some fields
of R, then A can create a view V of R that
includes only those attributes and then grant
SELECT on V to B.
The same applies to limiting B to retrieving only
certain tuples of R; a view V’ can be created by
defining the view by means of a query that selects
only those tuples from R that A wants to allow B
to access.
Advanced Database By Dagne W 08/10/2024
Slide 23- 51
PROPAGATION OF PRIVILEGES USING THE GRANT OPTION
Whenever the owner A of a relation R grants
a privilege on R to another account B,
privilege can be given to B with or without
the GRANT OPTION.
If the GRANT OPTION is given, this means
that B can also grant that privilege on R to
other accounts.
Suppose that B is given the GRANT OPTION by A
and that B then grants the privilege on R to a
third account C, also with GRANT OPTION. In
this way, privileges on R can propagate to other
accounts without the knowledge of the owner
of R.
If the owner account A now revokes the
privilege granted to B, all the privileges that B
propagated based on that privilege should
automatically be revoked by the system.
Advanced Database By Dagne W 08/10/2024
Slide 23- 52
Creating Users
You create a database user with the CREATE USER statement.
To create a user, you must have the CREATE USER system
privilege.
Because it is a powerful privilege, a DBA or security
administrator is normally the only user who has the CREATE
USER system privilege.
A newly created user cannot connect to the database until
granted the CREATE SESSION system privilege.
Advanced Database By Dagne W 08/10/2024 53
CREATE USER - Syntax
Advanced Database By Dagne W 08/10/2024 54
CREATE USER– An example
CREATE USER Abebe
IDENTIFIED BY abebe99
DEFAULT TABLESPACE DBS_space
QUOTA 10M ON DBS_space
TEMPORARY TABLESPACE temp_space
PROFILE STAFF
PASSWORD EXPIRE
;
Database Systems Slide 55
Advanced Database By Dagne W 08/10/2024 55
How to Create a User and Grant Permissions in
Oracle
CREATE USER Abebe IDENTIFIED BY password;
GRANT CONNECT TO Abebe;
GRANT CONNECT, RESOURCE, DBA TO Abebe;
GRANT CREATE SESSION GRANT ANY PRIVILEGE TO
Abebe;//Grant create session to abebe;
GRANT UNLIMITED TABLESPACE TO Abebe;
GRANT SELECT, INSERT, UPDATE, DELETE ON
schema.books TO Abebe;
Conn abebe/password;//Connect Abebe/password
@ <database name>
Advanced Database By Dagne W 08/10/2024 56
Helpful Data Dictionary Views
USER_USERS
ALL_USERS
DBA_USERS
USER_TS_QUOTAS
DBA_TS_QUOTAS
Information about the database user who is currently logged
on, can be seen by examining the USER_USERS data
dictionary view.
Querying System Privileges
ALL_SYS_PRIVS
SESSION_PRIVS
USER_SYS_PRIVS
DBA_SYS_PRIVS
SYSTEM_PRIVILEGE_MAP
Advanced Database By Dagne W 08/10/2024 57
Modifying Users
Modifications involve:
– Changing passwords
– Locking an account
– Increasing a storage quota
ALTER USER DDL statement
Removing an Oracle User
DROP command
Lock the account or revoke the CREATE SESSION privilege
58
Advanced Database By Dagne W 08/10/2024 58
Granting of Privileges
The passage of authorization from one user to another
may be represented by an authorization graph.
The nodes of this graph are the users.
The root of the graph is the database administrator.
Consider graph for update authorization on loan.
An edge Ui Uj indicates that user Ui has granted update
authorization on loan to Uj.
U1 U4
DBA U2 U5
U3
Advanced Database By Dagne W 08/10/2024 59 59
Authorization Grant Graph
Requirement: All edges in an authorization graph must be
part of some path originating with the database administrator
If DBA revokes grant from U1:
Grant must be revoked from U4 since U1 no longer has
authorization
Grant must not be revoked from U5 since U5 has another
authorization path from DBA through U2
Must prevent cycles of grants with no path from the root:
DBA grants authorization to U7
U7 grants authorization to U8
U8 grants authorization to U7
DBA revokes authorization from U7
Must revoke grant U7 to U8 and from U8 to U7 since there is no
path from DBA to U7 or to U8 anymore.
Advanced Database By Dagne W 08/10/2024 60 60
Security Specification in SQL
The grant statement is used to provide authorization
grant <privilege list>
on <relation name or view name> to <user list>
<user list> is:
a user-id
public, which allows all valid users the privilege granted
A role (more on this later)
Granting a privilege on a view does not imply granting
any privileges on the underlying relations.
The grantor of the privilege must already hold the
privilege on the specified item (or be the database
administrator).
Advanced Database By Dagne W 08/10/2024 61 61
Privileges in SQL
select: allows read access to relation,or the ability to query
using the view
Example: grant users U1, U2, and U3 select authorization on
the branch relation:
grant select on branch to U1, U2, U3
insert: the ability to insert tuples
update: the ability to update using the SQL update statement
delete: the ability to delete tuples.
references: ability to declare foreign keys when creating
relations.
usage: In SQL-92; authorizes a user to use a specified domain
all privileges: used as a short form for all the allowable
privileges
Advanced Database By Dagne W 08/10/2024 62 62
AN EXAMPLE
Suppose that the DBA creates four accounts
A1, A2, A3, A4
and wants only A1 to be able to create base
relations. Then the DBA must issue the following
GRANT command in SQL
GRANT CREATETAB TO A1;
In SQL2 the same effect can be accomplished by
having the DBA issue a CREATE SCHEMA command
as follows:
CREATE SCHAMA EXAMPLE
AUTHORIZATION A1;
Advanced Database By Dagne W 08/10/2024
Slide 23- 63
AN EXAMPLE
User account A1 can create tables under the
schema called EXAMPLE.
Suppose that A1 creates the two base relations
EMPLOYEE and DEPARTMENT
A1 is then owner of these two relations and
hence all the relation privileges on each of them.
Suppose that A1 wants to grant A2 the privilege
to insert and delete tuples in both of these
relations, but A1 does not want A2 to be able
to propagate these privileges to additional
accounts:
GRANT INSERT, DELETE ON
EMPLOYEE, DEPARTMENT TO A2;
Advanced Database By Dagne W 08/10/2024 64
AN EXAMPLE
Advanced Database By Dagne W 08/10/2024
Slide 23- 65
AN EXAMPLE
Suppose that A1 wants to allow A3 to retrieve
information from either of the two tables and also
to be able to propagate the SELECT privilege to
other accounts.
A1 can issue the command:
GRANT SELECT ON EMPLOYEE, DEPARTMENT
TO A3 WITH GRANT OPTION;
A3 can grant the SELECT privilege on the
EMPLOYEE relation to A4 by issuing:
GRANT SELECT ON EMPLOYEE TO A4;
Notice that A4 can’t propagate the SELECT privilege
because GRANT OPTION was not given to A4
Advanced Database By Dagne W 08/10/2024
Slide 23- 66
AN EXAMPLE
Suppose that A1 wants to give back to A3 a limited
capability to SELECT from the EMPLOYEE relation and
wants to allow A3 to be able to propagate the privilege.
The limitation is to retrieve only the NAME, BDATE, and
ADDRESS attributes and only for the tuples with
DNO=5.
A1 then create the view:
CREATE VIEW A3EMPLOYEE AS
SELECT NAME, BDATE, ADDRESS
FROM EMPLOYEE
WHERE DNO = 5;
After the view is created, A1 can grant SELECT on the
view A3EMPLOYEE to A3 as follows:
GRANT SELECT ON A3EMPLOYEE TO A3
WITH GRANT OPTION;
Advanced Database By Dagne W 08/10/2024
Slide 23- 67
AN EXAMPLE
Finally, suppose that A1 wants to allow A4 to
update only the SALARY attribute of
EMPLOYEE;
A1 can issue:
GRANT UPDATE ON EMPLOYEE
(SALARY) TO A4;
The UPDATE or INSERT privilege can specify
particular attributes that may be updated or
inserted in a relation.
Other privileges (SELECT, DELETE) are not
attribute specific. Slide 23- 68
Advanced Database By Dagne W 08/10/2024
Granting Object Privileges
, ,
GRANT Object_priv ON Object TO user
Schema. role
PUBLIC
WITH GRANT OPTION
Where:
– Object_priv: Is an object privilege to be granted
– ON: Identifies the object on which the privileges are
granted. if the “schema.” prefix is not used then
ORACLE assumes the current user’s schema.
– TO: Identifies the users or roles to which the object
privilege is granted
– PUBLIC:Grants object privileges to all users
– WITH GRANT OPTION : Allows the grantee to grant the
object privileges to other users and roles. The grantee
must be a user or PUBLIC.
– GRANT OPTION cannot be granted to a role.
Advanced Database By Dagne W 08/10/2024 69
Privilege To Grant Privileges
with grant option: allows a user who is granted a
privilege to pass the privilege on to other users.
Example:
grant select on branch to U1 with grant option
gives U1 the select privileges on branch and allows
U1 to grant this
privilege to others
Advanced Database By Dagne W 08/10/2024 70 70
Object Privileges Cascade
Grantors can revoke privileges from only those users to whom
they had granted the privileges in the first place.
Revoking an object privilege may have a cascading effect that
should be investigated before a REVOKE statement is issued.
GRANT REVOKE RESULT
A B C A B C A B C
Advanced Database By Dagne W 08/10/2024 71
REVOKING PRIVILEGES
In some cases it is desirable to grant a
privilege to a user temporarily. For
example,
The owner of a relation may want to grant the
SELECT privilege to a user for a specific task
and then revoke that privilege once the task is
completed.
Hence, a mechanism for revoking privileges is
needed. In SQL, a REVOKE command is included
for the purpose of canceling privileges.
Advanced Database By Dagne W 08/10/2024
Slide 23- 72
AN EXAMPLE
Suppose that A1 decides to revoke the
SELECT privilege on the EMPLOYEE relation
from A3; A1 can issue:
REVOKE SELECT ON EMPLOYEE FROM
A3;
The DBMS must now automatically revoke
the SELECT privilege on EMPLOYEE from A4,
too, because A3 granted that privilege to A4
and A3 does not have the privilege any
more.
Advanced Database By Dagne W 08/10/2024
Slide 23- 73
Revoking Authorization in SQL
The revoke statement is used to revoke authorization.
revoke<privilege list>
on <relation name or view name> from <user list>
[restrict|cascade]
Example:
revoke select on branch from U1, U2, U3 cascade
Revocation of a privilege from a user may cause other
users also to lose that privilege; referred to as
cascading of the revoke.
We can prevent cascading by specifying restrict:
revoke select on branch from U1, U2, U3 restrict
With restrict, the revoke command fails if cascading
revokes are required.
Advanced Database By Dagne W 08/10/2024 74 74
Revoking Authorization in SQL
<privilege-list> may be all to revoke all privileges
the revokee may hold.
If <revokee-list> includes public all users lose the
privilege except those granted it explicitly.
If the same privilege was granted twice to the
same user by different grantees, the user may
retain the privilege after the revocation.
All privileges that depend on the privilege being
revoked are also revoked.
Advanced Database By Dagne W 08/10/2024 75 75
ROLE-BASED ACCESS CONTROL
Role-based access control (RBAC) emerged
rapidly in the 1990s as a proven technology for
managing and enforcing security in large-scale
enterprise wide systems.
Its basic notion is that permissions are associated
with roles, and users are assigned to appropriate
roles.
Roles can be created using the CREATE ROLE and
DESTROY ROLE commands.
TheGRANT and REVOKE commands discussed under
DAC can then be used to assign and revoke privileges
from roles.
Advanced Database By Dagne W 08/10/2024
Slide 23- 76
ROLE-BASED ACCESS CONTROL
RBAC appears to be a viable alternative to
traditional discretionary and mandatory
access controls; it ensures that only
authorized users are given access to certain
data or resources.
Many DBMSs have allowed the concept of
roles, where privileges can be assigned to
roles.
Role hierarchy in RBAC is a natural way of
organizing roles to reflect the organization’s
lines of authority and responsibility.
Advanced Database By Dagne W 08/10/2024
Slide 23- 77
ROLE-BASED ACCESS CONTROL
Another important consideration in RBAC systems
is the possible temporal constraints that may exist
on roles, such as time and duration of role
activations, and timed triggering of a role by an
activation of another role.
Using an RBAC model is highly desirable goal for
addressing the key security requirements of Web-
based applications.
In contrast, discretionary access control (DAC)
and mandatory access control (MAC) models lack
capabilities needed to support the security
requirements emerging enterprises and Web-
based applications.
Advanced Database By Dagne W 08/10/2024
Slide 23- 78
Roles
Managing and controlling privileges is made easier by using
roles, which are named groups of related privileges that you
grant, as a group, to users or other roles.
Within a database, each role name must be unique, different
from all user names and all other role names.
Unlike schema objects, roles are not contained in any schema.
Therefore, a user who creates a role can be dropped with no
effect on the role.
Roles ease the administration of end-user system and schema
object privileges.
However, roles are not meant to be used by application
developers, because the privileges to access schema objects
within stored programmatic constructs must be granted
directly.
Advanced Database By Dagne W 08/10/2024 79
Creating Roles
In order to create database roles it is necessary to use the CREATE
ROLE command.
Syntax of the CREATE ROLE Command
CREATE ROLE role
NOT IDENTIFIED
IDENTIFIED BY password
Where: EXTERNALLY
– Role Name of the role to be created
– NOT IDENTIFIED Users granted the role do not need to be verified by
ORACLE to enable it
– IDENTIFIED Indicates that the users granted the role must be
verified by ORACLE to enable the role
– BY password Specifies the password that authorizes enabling the
role
– EXTERNALLY Specifies that ORACLE will verify user access to the
role
using an operating system utility
Note : If the IDENTIFIED option is chosen, users can enable/disable the role
by using the SET ROLE command.
Advanced Database By Dagne W 08/10/2024 80
Benefits of Using Roles
Reduced privilege administration
– Rather than granting the same set of privileges explicitly to several
users, you can grant the privileges for a group of related users to a role,
and then only the role needs to be granted to each member of the group.
Dynamic privilege management
– If the privileges of a group must change, then only the privileges of the
role need to be modified. The security domains of all users granted the
group’s role automatically reflect the changes made to the role.
Selective availability of privileges
– You can selectively enable or disable the roles granted to a user. This
allows specific control of a user’s privileges in any given situation.
Application awareness
– The data dictionary records which roles exist, so you can design
applications to query the dictionary and automatically enable (or disable)
selective roles when a user attempts to run the application by way of a
given user name.
Advanced Database By Dagne W 08/10/2024 81
Displaying Information About Roles
The following data dictionary views contain information
about privileges granted to roles, roles granted to users etc.
ROLE_SYS_PRIVS System privileges granted to roles
ROLE_TAB_PRIVS Table privileges granted to roles
ROLE_ROLE_PRIVS Roles granted to other roles
SESSION_ROLES Roles that the user currently has
enabled
USER_ROLE_PRIVS Roles granted to the user
DBA_ROLES All roles existing in the database
DBA_SYS_PRIVS System privileges granted to users
and to roles
Advanced Database By Dagne W 08/10/2024 82
Roles Creation Examples
create role teller
create role manager
grant select on branch to teller
grant update (balance) on account to teller
grant all privileges on account to manager
grant teller to manager
grant teller to alice, bob
grant manager to avi
Advanced Database By Dagne W 08/10/2024 83 83
Advanced Database By Dagne W 08/10/2024 84
Advanced Database By Dagne W 08/10/2024 85
Authentication
Password based authentication is widely used, but is
susceptible to sniffing on a network
Challenge-response systems avoid transmission of passwords
DB sends a (randomly generated) challenge string to user
User encrypts string and returns result.
DB verifies identity by decrypting result
Can use public-key encryption system by DB sending a
message encrypted using user’s public key, and user
decrypting and sending the message back
Digital signatures are used to verify authenticity of data
E.g. use private key (in reverse) to encrypt data, and anyone
can verify authenticity by using public key (in reverse) to
decrypt data. Only holder of private key could have created
the encrypted data.
Digital signatures also help ensure nonrepudiation: sender
cannot later claim to have not created the data
Advanced Database By Dagne W 08/10/2024 86 86
Limitations of SQL Authorization
SQL does not support authorization at a tuple level
E.g. we cannot restrict students to see only (the
tuples storing) their own grades
All end-users of an application (such as a web
application) may be mapped to a single database
user
The task of authorization in above cases falls on the
application program, with no support from SQL
Authorization must be done in application code, and
may be dispersed all over an application
Checking for absence of authorization loopholes
becomes very difficult since it requires reading large
amounts of application code
Advanced Database By Dagne W 08/10/2024 87 87
MANDATORY ACCESS CONTROL
The discretionary access control techniques of
granting and revoking privileges on relations
has traditionally been the main security
mechanism for relational database systems.
This is an all-or-nothing method:
A user either has or does not have a certain
privilege.
In many applications, and additional security
policy is needed that classifies data and users
based on security classes.
Thisapproach as mandatory access control,
would typically be combined with the
discretionary access control mechanisms.
Advanced Database By Dagne W 08/10/2024
Slide 23- 88
Mandatory Access Control (MAC)
Security label
- Top-Secret, Secret, Public
Objects: security classification
- File 1 is Secret, File 2 is Public
Subjects: security clearances
- Brown is cleared to Secret, Black is cleared to Public
Dominance ()
- Top-Secret Secret Public
89
MAC
Access rights: defined by comparing the security
classification of the requested objects with the
security clearance of the subject
If access control rules are satisfied, access is
permitted
Otherwise access is rejected
Granularity of access rights!
90
MAC – BELL-LAPADULA (BLP)
MODEL
Single security property: a subject S is allowed a
read access to an object O only if label(S)
dominates label(O)
Star-property: a subject S is allowed a write access
to an object O only if label(O) dominates label(S)
No direct flow of information from
high security objects to low security objects!
91
MULTILEVEL SECURITY
Multilevel security users at different
security level, see different versions of the
database
Problem: different versions need to be kept
consistent and coherent without downward
signaling channel (covert channel)
92
MULTILEVEL RELATION
Schema R(A1,C1,…,An,Cn,Tc)
R: relation name
A : attribute name
i
C : security classes
i
T : Tuple security classes
c
Instantiation of relation: sets of tuples of
the form <a1,c1,…,an,cn,tc>
a : attribute value
i
c : attribute classification label
i
t : tuple classification label
c
93
Multilevel Relation Example
SSN (SSN) Course (Course) Grade (Grade)
111-22-3333 S CSCE 786 S A TS
444-55-6666 S CSCE 567 S C TS
Top-secret user sees all data
Secret user sees Secret-View:
SSN (SSN) Course (Course) Grade (Grade)
111-22-3333 S CSCE 786 S null S
444-55-6666 S CSCE 567 S null S
94 94
Polyinstantiation
Secret user sees Secret-View:
SSN (SSN) Course (Course) Grade (Grade)
111-22-3333 S CSCE 786 S null S
444-55-6666 S CSCE 567 S null S
• SSN is primary key
• Secret user wants to update Grade for 111-22-3333 from
null (i.e., missing value) to F
• Allow update: inconsistent database, at TS level two
different
tuples exist with the same primary key (see next
slide)
• Not allow update: downward signaling channel, update
is 95
Polyinstantiation
Top-Secret View:
SSN (SSN) Course (Course) Grade (Grade)
111-22-3333 S CSCE 786 S A TS
111-22-3333 S CSCE 786 S F S
444-55-6666 S CSCE 567 S C TS
96
COMPARING DISCRETIONARY ACCESS
CONTROL AND MANDATORY ACCESS CONTROL
Discretionary Access Control (DAC) policies
are characterized by a high degree of
flexibility, which makes them suitable for a
large variety of application domains.
Themain drawback of DAC models is their
vulnerability to malicious attacks, such as Trojan
horses embedded in application programs.
Advanced Database By Dagne W 08/10/2024
Slide 23- 97
COMPARING DISCRETIONARY ACCESS
CONTROL AND MANDATORY ACCESS CONTROL
By contrast, mandatory policies ensure a high
degree of protection in a way, they prevent
any illegal flow of information.
Mandatory policies have the drawback of
being too rigid and they are only applicable in
limited environments.
In many practical situations, discretionary
policies are preferred because they offer a
better trade-off between security and
applicability.
Advanced Database By Dagne W 08/10/2024
Slide 23- 98
ACCESS CONTROL POLICIES FOR
E-COMMERCE AND THE WEB
E-Commerce environments require
elaborate policies that go beyond traditional
DBMSs.
In an e-commerce environment the resources to
be protected are not only traditional data but
also knowledge and experience.
The access control mechanism should be flexible
enough to support a wide spectrum of
heterogeneous protection objects.
A related requirement is the support for
content-based access-control.
Advanced Database By Dagne W 08/10/2024
Slide 23- 99
ACCESS CONTROL POLICIES FOR
E-COMMERCE AND THE WEB
Another requirement is related to the
heterogeneity of subjects, which requires access
control policies based on user characteristics and
qualifications.
A possible solution, to better take into account
user profiles in the formulation of access control
policies, is to support the notion of credentials.
A credential is a set of properties concerning a
user that are relevant for security purposes
For example, age, position within an organization
Itis believed that the XML language can play a key
role in access control for e-commerce applications.
Advanced Database By Dagne W 08/10/2024
Slide 23- 100
SQL INJECTION
SQL injection
Most common threat to database system
Other common threats
Unauthorized privilege escalation
Privilege abuse
Denial of service
Weak authentication
Slide
30-
101
SQL INJECTION
Unauthorized privilege escalation – individual
attempting to elevate his or her privilege by
attacking vulnerable points in the database
systems.
Privilege abuse – by a privileged user. E.g. an
administrator who is allowed to change student
information can use this privilege to update student
grades without the instructor’s permission.
Denial of service (DOS) attack - making resources
unavailable to its intended users. access to network
apps or data is denied by overflowing the buffer or
consuming resources.
Weak Authentication - If user authentication
scheme is weak, an attacker can impersonate
Chapte the
identity of a legitimate user by obtaining rtheir
23- login
102
SQL INJECTION METHODS
SQL Manipulation - adding conditions to the
WHERE-clause of a query, or expanding query -
using set operations such as UNION, INTERSECT, or
MINUS.
SELECT * FROM users WHERE username = ‘jake’ and
(PASSWORD = ‘jakespasswd’ or ‘x’ = ‘x’)
Chapte
r 23-
104
SIMPLE SQL INJECTION
SELECT email
FROM Email-Addresses
WHERE email = ‘saiedian@ku.edu’
SELECT email-address
FROM Email-Addresses
WHERE email = 'anything' OR 'x'='x';
Slide 23-
105
RISKS ASSOCIATED WITH SQL
INJECTION
Database fingerprinting (the type of
database)
Denial of service (flood the server)
Bypassing authentication
Identifying injectable parameters
Executing remote commands
Performing privilege escalation
Slide 30-
106
PROTECTION TECHNIQUES
Bind variables (using parameterized
statements)
Protectsagainst injection attacks
Improves performance
Filtering input (input validation)
Remove escape characters from input strings
Escape characters can be used to inject
manipulation attacks
Function security
Standard and custom functions should be
restricted Slide 30-
107
STATISTICAL DATABASE SECURITY
Statistical databases are used mainly to
produce statistics on various populations.
The database may contain confidential
data on individuals, which should be
protected from user access.
Users are permitted to retrieve statistical
information on the populations, such as
averages, sums, counts, maximums,
minimums, and standard deviations.
Advanced Database By Dagne W 08/10/2024
Slide 23- 108
STATISTICAL DATABASE SECURITY
A population is a set of tuples of a relation
(table) that satisfy some selection condition.
Statistical queries involve applying statistical
functions to a population of tuples.
Advanced Database By Dagne W 08/10/2024
Slide 23- 109
STATISTICAL DATABASE SECURITY
It is DBMS’s responsibility to ensure
confidentiality of information about individuals,
while still providing useful statistical summaries
of data about those individuals to users.
Provision of privacy protection of users in a
statistical database is paramount.
In some cases it is possible to infer the values of
individual tuples from a sequence statistical
queries. This is particularly true when the
conditions result in a population consisting of a
small number of tuples.
Chapte
r 23-
110
STATISTICAL DATABASE SECURITY
• No statistical queries, if # of tuples falls below some
threshold
• Prohibit sequence of queries that refer to same
population of tuples
• Introduce slight noise into the result Chapte
r 23-
• partitioning 111
INTRODUCTION TO FLOW
CONTROL
Flow control regulates the distribution or flow of
information among accessible objects.
A flow between object X and object Y occurs when a
program reads values from X and writes values into Y.
Flow controls check that information contained in some
objects does not flow explicitly or implicitly into less
protected objects.
A flow policy specifies the channels along which
information is allowed to move.
The simplest flow policy specifies just two classes of
information:
confidential (C) and nonconfidential (N)
and allows all flows except those from class C to class N.
Advanced Database By Dagne W 08/10/2024
Slide 23- 112
COVERT CHANNELS
A covert channel allows a transfer of
information that violates the security or the
policy.
A covert channel allows information to
pass from a higher classification level to a
lower classification level through improper
means.
Advanced Database By Dagne W 08/10/2024
Slide 23- 113
OVERT CHANNELS
Covert channels can be classified into two broad
categories:
Storage channels do not require any temporal
synchronization, in that information is conveyed by
accessing system information or what is otherwise
inaccessible to the user.
Timing channel allow the information to be conveyed
by the timing of events or processes.
Some security experts believe that one way to
avoid covert channels is for programmers to not
actually gain access to sensitive data that a
program is supposed to process after the program
has been put into operation. Slide 23- 114
Advanced Database By Dagne W 08/10/2024
Encryption
Data may be encrypted when database
authorization provisions do not offer sufficient
protection.
Properties of good encryption technique:
Relatively simple for authorized users to encrypt and
decrypt data.
Encryption scheme depends not on the secrecy of
the algorithm but on the secrecy of a parameter of
the algorithm called the encryption key.
Extremely difficult for an intruder to determine the
encryption key.
Advanced Database By Dagne W 08/10/2024 115 115
ENCRYPTION AND PUBLIC KEY INFRASTRUCTURES
Encryption is a means of maintaining secure
data in an insecure environment.
Encryption consists of applying an
encryption algorithm to data using some
prespecified encryption key.
The resulting data has to be decrypted using
a decryption key to recover the original
data.
Advanced Database By Dagne W 08/10/2024
Slide 23- 116
THE DATA AND ADVANCED ENCRYPTION STANDARDS
The Data Encryption Standard (DES) is a
system developed by the U.S. government
for use by the general public.
Ithas been widely accepted as a cryptographic
standard both in the United States and abroad.
DES can provide end-to-end encryption on
the channel between the sender A and
receiver B.
Advanced Database By Dagne W 08/10/2024
Slide 23- 117
THE DATA AND ADVANCED ENCRYPTION STANDARDS
DES algorithm is a careful and complex
combination of two of the fundamental
building blocks of encryption:
substitution and permutation (transposition).
The DES algorithm derives its strength from
repeated application of these two
techniques for a total of 16 cycles.
Plaintext
(the original form of the message) is
encrypted as blocks of 64 bits.
Advanced Database By Dagne W 08/10/2024
Slide 23- 118
THE DATA AND ADVANCED ENCRYPTION STANDARDS
After questioning the adequacy of DES, the
National Institute of Standards (NIST)
introduced the Advanced Encryption
Standards (AES).
Thisalgorithm has a block size of 128 bits and
thus takes longer time to crack.
Advanced Database By Dagne W 08/10/2024
Slide 23- 119
PUBLIC KEY ENCRYPTION
In 1976 Diffie and Hellman proposed a new kind
of cryptosystem, which they called public key
encryption.
Public key algorithms are based on
mathematical functions rather than operations
on bit patterns.
They also involve the use of two separate keys
in contrast to conventional encryption, which uses
only one key.
The use of two keys can have profound
consequences in the areas of confidentiality, key
distribution, and authentication.
Advanced Database By Dagne W 08/10/2024
Slide 23- 120
PUBLIC KEY ENCRYPTION
The two keys used for public key encryption
are referred to as the public key and the
private key.
theprivate key is kept secret, but it is referred
to as private key rather than a secret key (the
word used in conventional encryption to avoid
confusion with conventional encryption).
Advanced Database By Dagne W 08/10/2024
Slide 23- 121
PUBLIC KEY ENCRYPTION
A public key encryption scheme, or
infrastructure, has six ingredients:
Plaintext: This is the data or readable message that
is fed into the algorithm as input.
Encryption algorithm: The encryption algorithm
performs various transformations on the plaintext.
Public and private keys: These are pair of keys that
have been selected so that if one is used for
encryption, the other is used for decryption.
The exec transformations performed by the
encryption algorithm depend on the public or private
key that is provided as input.
Advanced Database By Dagne W 08/10/2024
Slide 23- 122
PUBLIC KEY ENCRYPTION
A public key encryption scheme, or
infrastructure, has six ingredients :
Ciphertext:
This is the scrambled message produced as output.
It depends on the plaintext and the key.
For a given message, two different keys will produce
two different ciphertexts.
Decryption algorithm:
This algorithm accepts the ciphertext and the
matching key and produces the original plaintext.
Advanced Database By Dagne W 08/10/2024
Slide 23- 123
PUBLIC KEY ENCRYPTION
Public key is made for public and private
key is known only by owner.
A general-purpose public key
cryptographic algorithm relies on
one key for encryption and
a different but related key for decryption.
Advanced Database By Dagne W 08/10/2024
Slide 23- 124
PUBLIC KEY ENCRYPTION
The essential steps are as follows:
Each user generates a pair of keys to be used for
the encryption and decryption of messages.
Each user places one of the two keys in a public
register or other accessible file. This is the public
key. The companion key is kept private (private
key).
If a sender wishes to send a private message to a
receiver, the sender encrypts the message using
the receiver’s public key.
When the receiver receives the message, he or she
decrypts it using the receiver’s private key.
No other recipient can decrypt the message because
only the receiver knows his or her private key.
Advanced Database By Dagne W 08/10/2024
Slide 23- 125
PUBLIC KEY ENCRYPTION
The RSA Public Key Encryption algorithm,
one of the first public key schemes was
introduced in 1978 by Ron Rivest (R), Adi
Shamir (S), and Len Adleman (A) at MIT and
is named after them.
The RSA encryption algorithm incorporates
results from number theory, such as the
difficulty of determining the large prime factors
of a large number.
The RSA algorithm also operates with
modular arithmetic – mod n, where n is the
product of two large prime numbers.
Advanced Database By Dagne W 08/10/2024
Slide 23- 126
PUBLIC KEY ENCRYPTION
Two keys, d and e, are used for decryption and encryption.
An important property is that d and e can be
interchanged.
n is chosen as a large integer that is a product of two
large distinct prime numbers, a and b.
The encryption key e is a randomly chosen number
between 1 and n that is relatively prime to (a-1) x (b-1).
The plaintext block P is encrypted as Pe mod n.
Because the exponentiation is performed mod n, factoring
Pe to uncover the encrypted plaintext is difficult.
However, the decryption key d is carefully chosen so that
(Pe)d mod n = P.
The decryption key d can be computed from the condition
that d x e= 1 mod ((a-1)x(b-1)).
Thus, the legitimate receiver who knows d simply
computes (Pe)d mod n = P and recovers P
without having to factor Pe .
Advanced Database By Dagne W 08/10/2024
Slide 23- 127
DIGITAL SIGNATURES
A digital signature is an example of using encryption
techniques to provide authentication services in e-
commerce applications.
A digital signature is a means of associating a mark
unique to an individual with a body of text.
The mark should be unforgettable, meaning that others
should be able to check that the signature does come
from the originator.
A digital signature consists of a string of symbols.
Signature must be different for each use.
This can be achieved by making each digital signature a
function of the message that it is signing, together with a
time stamp.
Public key techniques are the means creating digital
signatures.
Advanced Database By Dagne W 08/10/2024
Slide 23- 128
SUMMARY
Database Security and Authorization
Discretionary Access Control
Mandatory Access Control Role-Based Access
Control for Multilevel Security
Statistical Database Security
Flow Control
Encryption and Public Key Infrastructures
Advanced Database By Dagne W 08/10/2024
Slide 23- 129