0% found this document useful (0 votes)
3 views46 pages

UNIT IV - Database Security

Database security is essential for protecting against unauthorized access, data corruption, and cyber threats, ensuring the confidentiality, integrity, and availability of sensitive information. It involves components like access management, threat protection, and information protection, while addressing challenges such as insider threats and human error. SQL injection is a significant vulnerability that can lead to data theft and corruption, highlighting the need for robust security measures and regular audits.

Uploaded by

merlin.mexa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views46 pages

UNIT IV - Database Security

Database security is essential for protecting against unauthorized access, data corruption, and cyber threats, ensuring the confidentiality, integrity, and availability of sensitive information. It involves components like access management, threat protection, and information protection, while addressing challenges such as insider threats and human error. SQL injection is a significant vulnerability that can lead to data theft and corruption, highlighting the need for robust security measures and regular audits.

Uploaded by

merlin.mexa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 46

UNIT IV

DATABASE SECURITY
Database Security
Database Security refers to protecting the database against:

● Unauthorized access

● Unauthorized disclosure of information

● Data corruption

● Loss of availability

● Attacks such as SQL Injection, privilege abuse, malware, etc.

It ensures confidentiality, integrity, and availability of data.


Why is Database Security Important?
● Protects sensitive user information (like passwords, financial data)

● Prevents data breaches and legal issues

● Ensures that authorized users can trust the system

● Supports compliance with regulations (e.g., GDPR, HIPAA)


● GDPA(General Data Protection Regulation, HIPAA (Health Insurance Portability and
Accountability Act)
Main Components(Types) of Database Security
Network Security

- Firewalls :

If you use a firewall,you will increase security at the Operating system


level by providing a choke point where your security measures can be
focused.

Access Management
- Authentication

● Verifying the identity of a user (e.g., passwords, biometrics).


- Authorization

● Granting or denying users permission to access database


objects (like tables, views).

- Access Control

● Techniques like Role-Based Access Control (RBAC) or


Attribute-Based Access Control (ABAC).
Threat Protection

- Auditing : Auditing tracks database activities and helps maintain compliance


with security standards by recording database events to an audit log.

- Threat Detection

Focuses on identifying and responding to security threats within a database


management system (DBMS) to prevent unauthorized access, data breaches,
or malicious modifications.
Information Protection

- Encryption

● Protecting data by transforming it into unreadable formats:

○ Data at rest (in storage)

○ Data in transit (over networks)

- Auditing and Monitoring

● Tracking database activities to detect suspicious behavior.


- Backup and Recovery

○ Creating backups to recover from data loss due to attack or failure.

- Physical Security

○ Protecting the hardware where the database servers run.

- Application Security

○ Making sure that the applications accessing the database are secure.
Need for Database Security
In a Database Management System (DBMS), the need for database security arises
due to several reasons:
Protection of Sensitive Data

● Databases often store personal, financial, and corporate confidential information


(e.g., customer details, credit card info, healthcare records).

● Unauthorized access could lead to serious privacy violations and legal issues.
Prevent Unauthorized Access

● Only authorized users should be able to read, modify, or delete data.

● User authentication (e.g., passwords, biometrics) and access control


(permissions and roles) are necessary.
Maintaining Data Integrity

● Prevents unauthorized users from altering data maliciously or accidentally.

● Ensures that the data remains accurate and trustworthy over time.
Ensuring Data Availability

● Protects the database from attacks (like Denial of Service, hardware failures,
or natural disasters) to ensure data is always accessible to authorized users.
Protection Against Cyber Threats

● Databases are common targets for cyber-attacks (e.g., SQL injection, malware,
phishing).

● Database security mechanisms defend against such attacks.

Compliance with Legal and Regulatory Requirements

● Laws like GDPR, HIPAA, and CCPA require organizations to protect user data and
report breaches.

● Non-compliance can lead to heavy penalties.


Prevent Financial Loss

● Data breaches can cause direct financial loss, damage reputation, and lead to
customer trust loss.

Backup and Recovery

● Ensures data can be restored in case of accidental loss, corruption, or disasters.

● Security also means having regular, protected backups.


Common Threats and Challenges
1. Insider Dangers (Internal Threats)

● Not all threats come from hackers or external sources.

● Employees, contractors, or administrators with legitimate access may:

○ Intentionally misuse data.

○ Leak confidential information.

○ Modify or delete data maliciously.

● Insider threats are harder to detect because the user already has access rights.
2. Human Error
● Accidental actions can be just as damaging as intentional ones.

● Examples:

○ Deleting important data by mistake.

○ Misconfiguring database settings.

○ Uploading sensitive data to the wrong location.

● Even well-trained users can make mistakes under pressure or due to


misunderstanding.
Common Threats to Database Security

Threat Description

SQL Injection Attackers inject malicious SQL queries to manipulate the database.

Privilege Abuse Users misuse authorized access for malicious purposes.

Malware Viruses or worms targeting database systems.

Denial of Service (DoS) Overloading the database to make it unavailable.

Data Leakage Sensitive information exposure through poor configuration.


Techniques to Improve Database Security

● Use strong authentication methods (multi-factor authentication).

● Regularly update and patch the DBMS.

● Use least privilege principle (give minimum permissions).

● Encrypt sensitive data and database communications.

● Use firewalls and intrusion detection systems.

● Conduct regular security audits and penetration testing.


SQL Injection Attacks
What is SQL Injection?

● SQL Injection (SQLi) is a type of security vulnerability where an


attacker injects malicious SQL code into a query.
● SQL injection is a technique used by attackers to manipulate a web
application’s database queries
What is SQL Injection
SQL Injection Attacks
The attack happens when user input is not properly validated or sanitized
before being used in SQL statements.
As a result, attackers can manipulate database queries to:

● Retrieve unauthorized data

● Modify or delete data

● Execute administrative operations

● Sometimes even take full control over the database server


How SQL Injection Works
Normal Query (Safe):
Injected Query (Attack): User inputs:

● username: john' --

● password: anything

The query becomes:User is logged in without a correct password!


Types of SQL Injection (SQLi)
Types of SQL Injection (SQLi)

SQL Injection can be classified into three major categories –


In-band SQLi, Inferential SQLi and Out-of-band SQLi
1. Classic (In-band) SQL Injection
This is the most straightforward type, where the attacker uses the same
communication channel to both launch the attack and gather results.
Error-based SQL Injection:
Exploits detailed error messages returned by the database
to gather information.

Union-based SQL Injection:


Uses the UNION SQL operator to combine results from
multiple queries into a single result set.
2. Blind SQL Injection
Used when the application doesn’t return error messages but does
behave differently based on the query's success or failure.
● Boolean-based Blind Injection:
Sends SQL queries that return different results depending on whether
the condition is true or false.

● Time-based Blind Injection:


Relies on database delays to determine if a condition is true.
3. Out-of-band SQL Injection
Occurs when data is retrieved using a different channel (e.g., DNS or HTTP
requests). It's used when in-band and blind injection are not feasible.

4. Second-order SQL Injection


The malicious input is stored by the application and then used later in an
unsafe way.

Later, the app builds a query using this stored input, causing an
injection.
5. Stored (Persistent) SQL Injection
Malicious SQL code is permanently stored on the target server (e.g., in a database
or log) and then executed later.

● Example: Attacker submits a comment with injected SQL that gets triggered
whenever the admin views it.
Types of SQL Injection
Impact of SQL Injection
● Data Theft (user details, credit card numbers)

● Data Corruption or Deletion

● Authentication Bypass

● Compromise of entire server

● Denial of Service (DoS)


The Injection Techniques
SQL injection attack occurs when:
1. An unintended data enters a program from an untrusted source.
2. The data is used to dynamically construct a SQL query
The main consequences are:
Confidentiality:
Since SQL databases generally hold sensitive data, loss of
confidentiality is a frequent problem with SQL Injection vulnerabilities.
Authentication:
If poor SQL commands are used to check user names and
passwords, it may be possible to connect to a system as another user
with no previous knowledge of the password.
Authorization: If authorization information is held in a SQL
database, it may be possible to change this information through the
successful exploitation of a SQL Injection vulnerability.
Integrity:
Just as it may be possible to read sensitive information, it is
also possible to make changes or even delete this information with a
SQL Injection attack.
Risk Factors

The platform affected can be:

• Language: SQL

• Platform: Any (requires interaction with a SQL database)

SQL Injection has become a common issue with database-driven web sites.
The flaw is easily detected, and easily exploited,

You might also like