Database Security
Threats and their effects, authorization vs authentication, discretionary access control, GRANT and REVOKE.
Contents
- The scope of database security
- Why database security is a serious concern for an organization
- Types of threat that can affect a database system
- Discretionary access control (SQL security): GRANT and REVOKE
What is database security?
Database security: the mechanisms that protect the database against intentional or accidental threats.
- Data is a valuable resource that must be strictly controlled and managed, like any corporate resource.
- Part or all of the corporate data may have strategic importance and must be kept secure and confidential.
- Security is not only about the data in the database: breaches can affect other parts of the system (hardware, software, people), which may in turn affect the database.
What security aims to avoid
| Situation | Meaning |
|---|---|
| Theft and fraud | Affect the whole organization, not just the database. Committed by people, so focus on reducing opportunities. Do not necessarily alter data. |
| Loss of confidentiality (secrecy) | Secret data critical to the organization is exposed → loss of competitiveness. |
| Loss of privacy | Data about individuals is exposed → can lead to legal action against the organization. |
| Loss of integrity | Data becomes invalid or corrupted → seriously affects operations. |
| Loss of availability | Data or system cannot be accessed (vs 24/7 expectations) → affects financial performance. |
Database security aims to minimize losses from anticipated events in a cost-effective manner without unduly constraining users.
Confidentiality = secrecy of organizational data (e.g. product plans). Privacy = protection of data about individuals (e.g. customer addresses). Examiners like this distinction.
Threats
A threat is any situation or event, whether intentional or unintentional, that will negatively affect a system and consequently an organization.
Threats and their effects
| Threat | Theft & fraud | Confid. | Privacy | Integrity | Avail. |
|---|---|---|---|---|---|
| Using another person’s means of access | ✓ | ✓ | ✓ | ||
| Unauthorized amendment or copying of data | ✓ | ✓ | |||
| Program alteration | ✓ | ✓ | ✓ | ||
| Inadequate policies/procedures allowing a mix of confidential and normal output | ✓ | ✓ | ✓ | ||
| Wire tapping | ✓ | ✓ | ✓ | ||
| Illegal entry by hacker | ✓ | ✓ | ✓ | ||
| Blackmail | ✓ | ✓ | ✓ | ||
| Creating ‘trapdoor’ into system | ✓ | ✓ | ✓ | ||
| Theft of data, programs and equipment | ✓ | ✓ | ✓ | ✓ | |
| Failure of security mechanisms, giving greater access than normal | ✓ | ✓ | ✓ | ||
| Staff shortages or strikes | ✓ | ✓ | |||
| Inadequate staff training | ✓ | ✓ | ✓ | ✓ |
Scroll sideways on small screens. Connolly & Begg Table 19.1.
Threats summary — by source
Hardware
- Fire / flood / bombs
- Data corruption due to power loss or surge
- Failure of security mechanisms giving greater access
- Theft of equipment
- Physical damage to equipment
- Electronic interference and radiation
DBMS & application software
- Failure of security mechanism giving greater access
- Program alteration
- Theft of programs
Communication networks
- Wire tapping
- Breaking or disconnection of cables
- Electronic interference and radiation
Database
- Unauthorized amendment or copying of data
- Theft of data
- Data corruption due to power loss or surge
Users
- Using another person’s means of access
- Viewing and disclosing unauthorized data
Programmers / operators
- Creating trapdoors
- Program alteration (e.g. creating insecure software)
- Inadequate staff training
Data / Database Administrator
- Inadequate security policies and procedures
A typical multi-user environment
Remote clients reach the database over an insecure network through encryption and a firewall. Inside, the DBMS server’s authorization and access control — SQL security / discretionary access control — decides what each user may do.
Authorization and authentication
The granting of a right or privilege that enables a user to have legitimate access to a system or a system’s object. “What are you allowed to do?”
A mechanism that determines whether a user is who he or she claims to be (e.g. password). “Who are you?”
The DBA defines authorization rules; every user request passes through the database security system, which checks it against those rules before touching the database.
Main issues in database security
- Legal and ethical considerations — who has the right to read what information?
- Policy issues — who should enforce security (government, corporations, departments)?
- System-level issues — where should security be enforced in the system, and how?
Access control
Decides who should be allowed access to which databases. Typically enforced using system-level accounts with passwords.
Discretionary access control (DAC)
Authorization rules take three concepts into account:
| Concept | Meaning | Examples |
|---|---|---|
| Users (subjects) | Individuals (user IDs) or programs performing activity on the database | Smith, Jones, Clerks group |
| Objects | Database units requiring authorization to manipulate | Tables, views, columns, rows |
| Privileges | Actions a user may perform on an object | Read (SELECT), Insert, Update/Modify, Delete, Grant |
Authorization table
| User | Object | Privilege |
|---|---|---|
| Ed | Employee | Read |
| Ed | Employee | Insert |
| Ed | Employee | Modify |
| Ed | Employee | Grant |
| Bill | Employee | Read |
| Sally | Purchase Order | Insert |
| Sally | Purchase Order | Modify |
| Clerks | Employee | Read |
User-based security
Users are individually defined in the DBMS and each object and privilege is specified per user. E.g. user SMITH:
| Privilege | Employees | Orders | Products |
|---|---|---|---|
| Read | Y | Y | Y |
| Insert | N | Y | N |
| Modify | N | Y | Y |
| Delete | N | N | N |
| Grant | N | N | N |
Object-based security
Objects are individually defined and each subject and action is specified per object. E.g. the EMPLOYEES table:
| Privilege | SMITH | JONES | GREEN | DBA |
|---|---|---|---|---|
| Read | Y | Y | N | Y |
| Insert | N | N | N | Y |
| Modify | N | N | N | Y |
| Delete | N | N | N | Y |
| Grant | N | N | N | Y |
Same information, two views: user-based = one matrix per user; object-based = one matrix per object.
GRANT
SQL provides two main statements for authorization. GRANT gives actions on objects to users:
GRANT action1, action2, ...
ON object1, object2, ...
TO subject1, subject2, ...
[WITH GRANT OPTION];
WITH GRANT OPTION allows the grantee to propagate the authorization to other subjects.
Example database — tables: employees, departments, orders, products; users: Smith, Jones, Green, Dba.
GRANT INSERT, DELETE, UPDATE, SELECT ON employees, departments TO Smith;
GRANT INSERT, SELECT ON orders TO Smith;
GRANT SELECT ON products TO Smith;
GRANT SELECT ON employees, departments TO Jones;
GRANT INSERT, DELETE, UPDATE, SELECT
ON employees, departments, orders, products
TO Dba
WITH GRANT OPTION;
-- Column-level grants:
GRANT SELECT ON products TO Jones;
GRANT UPDATE ON products (price) TO Jones; -- Jones may change only the price column
If no GRANT is issued for a user, it is assumed that no authorization is given (e.g. user Green has no access at all).
Standard SQL and most DBMSs allow one object per GRANT (GRANT … ON employees TO …); the multi-object form in the slides is conceptual. In an exam, either is usually accepted, but writing one statement per table is always valid.
REVOKE
REVOKE action1, action2, ...
ON object1, object2, ...
FROM subject1, subject2, ...;
If Smith leaves the company:
REVOKE INSERT, DELETE, UPDATE, SELECT ON employees, departments FROM Smith;
REVOKE INSERT, SELECT ON orders FROM Smith;
REVOKE SELECT ON products FROM Smith;
-- Many RDBMSs support ALL PRIVILEGES:
REVOKE ALL PRIVILEGES ON employees, departments, orders, products FROM Smith;
If Dba granted privileges to others using WITH GRANT OPTION, revoking from Dba can also revoke those derived privileges (REVOKE … CASCADE); RESTRICT makes the revoke fail if dependent grants exist.
Quick review
List the five situations database security tries to avoid.
Authorization vs authentication?
What are the three concepts in DAC?
Write SQL so Jones can read products and change only the price.
GRANT SELECT ON products TO Jones; GRANT UPDATE ON products (price) TO Jones;