Chapter 2 Database Security and Authorization
Chapter 2 Database Security and Authorization
DATA SECURITY
It’s your data – are you sure it’s safe?
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
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.
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
37
Advanced Database By Dagne W 08/10/2024
ACCESS PROTECTION, USER ACCOUNTS, AND DATABASE AUDITS
S 38
Advanced Database By Dagne W 08/10/2024
ACCESS PROTECTION, USER ACCOUNTS, AND DATABASE AUDITS
39
Advanced Database By Dagne W 08/10/2024
DISCRETIONARY ACCESS CONTROL BASED ON GRANTING AND REVOKING PRIVILEGES
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
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.
USER_USERS
ALL_USERS
DBA_USERS
USER_TS_QUOTAS
DBA_TS_QUOTAS
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
Schema. role
PUBLIC
A B C A B C A B C
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
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
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
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
96
COMPARING DISCRETIONARY ACCESS
CONTROL AND MANDATORY ACCESS CONTROL
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)