By the end of this chapter, you will be able to:
These skills will help you protect valuable data and keep your organisation’s information safe and secure in the real world.
Compiled by: Beatrice Adhiambo
A database security risk is any event or weakness that could expose, change or destroy stored data, or make it unavailable to the people who need it. Security is judged against three goals: confidentiality (only the right people see the data), integrity (the data is accurate and changed only by authorised people) and availability (the data can be used when needed). Identifying risks means finding where these goals can fail before an attacker or an accident does it. Example: a booking database for a safari lodge holds guest names, phone numbers and passport details, so a leak harms confidentiality, a changed booking harms integrity and a deleted table harms availability.
The risks below appear again and again in databases of every size. Some come from outside attackers, some from careless or dishonest insiders and some from neglect, such as old software. Learning to recognise each one is the first step in choosing the controls that stop it, which are taught later in this chapter. A single incident often combines several, for example stolen credentials (weak authentication) used by a stranger (unauthorised access) to copy customer records (data leakage).
Unauthorised access means reaching a database, or data inside it, without permission. The person may be an outside attacker, a former employee or a staff member looking at records that are not part of their job. In Kenya the Computer Misuse and Cybercrimes Act, 2018 makes it an offence to access a computer system intentionally, knowing that the access is unauthorised. Example: a courier firm's tracking database is reachable from the internet, and a stranger finds it by scanning for open database ports.
SQL injection is an attack in which a user types SQL code into a normal input field, such as a login box or a search box, and the application runs that code as part of its own query. It happens when the program builds SQL text by joining the user's input to a query string. OWASP's list of top web application risks includes injection. Example: a lodge's staff login page builds this query from what the user types:
SELECT * FROM staff WHERE username = '<typed username>' AND pin = '<typed pin>';
If the attacker types admin' -- in the username box and anything in the PIN box, the database receives:
SELECT * FROM staff WHERE username = 'admin' -- ' AND pin = 'anything';
The two hyphens followed by a space start a comment in SQL, so the check on the PIN is ignored and the attacker is logged in as admin. Typing ' OR '1'='1 in a search box that builds WHERE name = '...' makes the condition true for every row, so the whole table is returned. Where the database driver allows several statements in one call, typing '; DROP TABLE staff; -- deletes the table.
Data leakage is the exposure of data to people who should not see it, whether or not anyone attacked the system. It is often accidental: a file placed in the wrong folder, a setting left open or a report sent to the wrong person. In Kenya the Data Protection Act, 2019 gives personal data legal protection. Where personal data has been accessed or acquired by an unauthorised person and there is a real risk of harm to the people concerned, the data controller must notify the Data Commissioner within 72 hours of becoming aware of the breach. Example: a developer exports the customer table of an online shoe shop to a spreadsheet for testing and uploads it to a shared online folder that anyone with the link can open.
An insider threat comes from a person who already has legitimate access: an employee, a contractor or a partner. Insiders are hard to detect because their activity looks normal. Threats fall into three groups: malicious insiders who steal or damage data on purpose, careless insiders who make mistakes, and insiders whose accounts have been taken over by an outsider. Example: a developer at a software studio keeps working database credentials after leaving the company and later copies the client list.
Authentication proves who a user is, and access control decides what that user may do. If either is weak, the other protections do little. Weak authentication includes poor passwords and no second factor. Weak access control includes accounts with too many rights. Example: a hardware shop's stock application connects to its database using an administrator account, so one flaw in the application gives an attacker full control of the database.
A patch is a fix released by the software maker to remove a weakness or a bug. Inadequate patching means installing fixes late or not at all. When a vulnerability becomes public, attackers write tools to exploit it and scan the internet for servers that still have it, so an unpatched database is an easy target. Example: a car-hire company runs its booking database on a version of the DBMS that the maker no longer supports, so newly found flaws are never fixed.
Malware is malicious software designed to damage, steal or lock data. It reaches a database server through email attachments, infected downloads, fake software updates, infected flash disks or weak points in the network. Example: a garage's job-card database server is used by staff to browse the web, and one of them downloads a fake tool that installs ransomware.
Create a free account to open more of this chapter.
Free: practical guides, quick cards, workplace scenarios and more.
Create a free accountType: Individual
| Tools & Equipment | Materials |
|---|---|
| Relational Database Management System (MySQL 8.0 or MS SQL Server 2019) | integer |
| Data Modelling Tool (Draw.io or Lucidchart) | varchar |
| Rewritable Compact Disc (CD-RW) | date/time |
| S/N | Item | Quantity |
|---|---|---|
| 1 | Relational Database Management System (MySQL 8.0 or MS SQL Server 2019) | 1 Instance per Candidate |
| 2 | Data Modelling Tool (Draw.io or Lucidchart) | 1 License per Candidate |
| 3 | Rewritable Compact Disc (CD-RW) | 1 Disc per Candidate |
| Items to be Evaluated | Marks Available | Marks Obtained | Comments |
|---|---|---|---|
| TASK 1: Explain Key Database Security Concepts | |||
| Explained authentication mechanisms (user accounts, passwords) (Award 3 marks for clear explanation of authentication) | 3 | ||
| Explained authorization and role-based access control (Award 3 marks for clear explanation of authorization) | 3 | ||
| Explained encryption of data at rest and in transit (Award 3 marks for clear explanation of encryption) | 3 | ||
| Explained importance of auditing and logging database activities (Award 3 marks for clear explanation of auditing) | 3 | ||
| Sub-Total | 12 | ||
| TASK 2: Demonstrate Database Security Features | |||
| Created at least three distinct user accounts with different privileges (Award 4 marks for correct user account creation and privilege assignment) | 4 | ||
| Configured role-based access control restricting access to sensitive data (Award 4 marks for correct role and permission configuration) | 4 | ||
| Enabled encryption for data storage or connection encryption (e.g. SSL/TLS) (Award 3 marks for proper encryption setup) | 3 | ||
| Set up audit logging to track user activities on the database (Award 3 marks for audit logging configuration) | 3 | ||
| Sub-Total | 14 | ||
| TASK 3: Backup and Report Generation | |||
| Created a backup of the database and saved it to a CD-RW (Award 3 marks for successful backup and correct media usage) | 3 | ||
| Generated a brief report summarizing implemented security measures (Award 3 marks for clear and concise report) | 3 | ||
| Sub-Total | 6 | ||
| PRODUCT CHECKLIST | |||
| Database security configuration correctly implemented and functional (Award 10 marks for fully functional security features as per task) | 10 | ||
| Sub-Total | 10 | ||
| GRAND TOTAL | 42 | ||
Type: Individual
| Tools & Equipment | Materials |
|---|---|
| Relational Database Management System (MySQL Server 8.0 or PostgreSQL 13) | Sample Customer Database Schema with Test Data |
| Database Security Simulation Tool (SQLMap or Metasploit Framework) | |
| Network Packet Sniffer (Wireshark or equivalent) |
| S/N | Item | Quantity |
|---|---|---|
| 1 | Relational Database Management System (MySQL Server 8.0 or PostgreSQL 13) | 1 Instance per Candidate |
| 2 | Database Security Simulation Tool (e.g., SQLMap, Metasploit Framework) | 1 Tool per Candidate |
| 3 | Sample Customer Database Schema with Test Data | 1 per Candidate |
| 4 | Network Packet Sniffer (Wireshark or equivalent) | 1 Tool per Candidate |
| Items to be Evaluated | Marks Available | Marks Obtained | Comments |
|---|---|---|---|
| TASK 1: Identify Database Security Threats | |||
| Candidate lists at least three common database security threats (e.g., SQL Injection, Privilege Escalation, Brute Force Attacks) (Award 1 mark for each correctly identified threat, zero otherwise) | 3 | ||
| Candidate explains the potential impact of each identified threat (Award up to 3 marks based on clarity and correctness of explanations) | 3 | ||
| Sub-Total | 6 | ||
| TASK 2: Simulate Unauthorized Access Attempts | |||
| Candidate configures the database environment to prepare for simulation (Award 2 marks if environment is correctly set up, zero otherwise) | 2 | ||
| Candidate successfully simulates an SQL Injection attack using the security simulation tool (Award 4 marks for a complete and successful simulation) | 4 | ||
| Candidate simulates a brute force login attempt on the database user accounts (Award 4 marks for correctly executed brute force simulation) | 4 | ||
| Candidate uses the network packet sniffer to capture and analyze unauthorized access traffic (Award 4 marks for capturing relevant traffic and basic analysis) | 4 | ||
| Sub-Total | 14 | ||
| TASK 3: Document Security Threats and Recommendations | |||
| Candidate documents the unauthorized access scenarios simulated with screenshots or logs (Award 4 marks for clear and complete documentation) | 4 | ||
| Candidate provides at least two recommendations for mitigating each simulated threat (Award 1 mark per valid recommendation, up to 6 marks) | 6 | ||
| Sub-Total | 10 | ||
| PRODUCT CHECKLIST | |||
| Complete report including identified threats, simulation evidence, and mitigation recommendations (Award up to 10 marks based on completeness, clarity, and professionalism of the report) | 10 | ||
| Sub-Total | 10 | ||
| GRAND TOTAL | 40 | ||
At the start of this chapter we promised you would be able to:
Tick each one you can genuinely do.
So, are you there yet?
You're competent when you can confidently do 50% or more of what this chapter promised.
Sign in to record how you're doing.