☰ Chapters
Week 8 · Database Security
CT004-3.5-3 Advanced Database Systems · Week 8

Database Security

Threats and their effects, authorization vs authentication, discretionary access control, GRANT and REVOKE.

Contents
    Objectives

    What is database security?

    Definition

    Database security: the mechanisms that protect the database against intentional or accidental threats.

    What security aims to avoid

    SituationMeaning
    Theft and fraudAffect 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 privacyData about individuals is exposed → can lead to legal action against the organization.
    Loss of integrityData becomes invalid or corrupted → seriously affects operations.
    Loss of availabilityData 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 vs privacy

    Confidentiality = secrecy of organizational data (e.g. product plans). Privacy = protection of data about individuals (e.g. customer addresses). Examiners like this distinction.

    Threats

    Definition

    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

    ThreatTheft & fraudConfid.PrivacyIntegrityAvail.
    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 client Encryption Insecure external network Encryption Firewall DBMS serverAuthorization & access control DB Secure intranet Localclient SQL security =DAC here

    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

    Authorization

    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?”

    Authentication

    A mechanism that determines whether a user is who he or she claims to be (e.g. password). “Who are you?”

    DBA Users DatabaseSecurity System Database Authorization rulesRequests

    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

    1. Legal and ethical considerations — who has the right to read what information?
    2. Policy issues — who should enforce security (government, corporations, departments)?
    3. 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:

    ConceptMeaningExamples
    Users (subjects)Individuals (user IDs) or programs performing activity on the databaseSmith, Jones, Clerks group
    ObjectsDatabase units requiring authorization to manipulateTables, views, columns, rows
    PrivilegesActions a user may perform on an objectRead (SELECT), Insert, Update/Modify, Delete, Grant

    Authorization table

    UserObjectPrivilege
    EdEmployeeRead
    EdEmployeeInsert
    EdEmployeeModify
    EdEmployeeGrant
    BillEmployeeRead
    SallyPurchase OrderInsert
    SallyPurchase OrderModify
    ClerksEmployeeRead

    User-based security

    Users are individually defined in the DBMS and each object and privilege is specified per user. E.g. user SMITH:

    PrivilegeEmployeesOrdersProducts
    ReadYYY
    InsertNYN
    ModifyNYY
    DeleteNNN
    GrantNNN

    Object-based security

    Objects are individually defined and each subject and action is specified per object. E.g. the EMPLOYEES table:

    PrivilegeSMITHJONESGREENDBA
    ReadYYNY
    InsertNNNY
    ModifyNNNY
    DeleteNNNY
    GrantNNNY

    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).

    Extra · syntax note

    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;
    Extra · cascading revokes

    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.
    Theft and fraud; loss of confidentiality; loss of privacy; loss of integrity; loss of availability.
    Authorization vs authentication?
    Authentication verifies identity (who you are). Authorization grants rights/privileges (what you may do).
    What are the three concepts in DAC?
    Users (subjects), objects, privileges.
    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;
    What does WITH GRANT OPTION do?
    Lets the grantee pass the privileges on to other users.