Unit-4
Unit-4
Unit-4
Types of DBMS:
1. Relational DBMS (RDBMS): Data is stored in tables (e.g., MySQL, PostgreSQL, Oracle).
SQL (Structured Query Language) is used for querying.
2. NoSQL DBMS: These databases handle unstructured or semi-structured data. They are
highly scalable and flexible (e.g., MongoDB, Cassandra, Redis). NoSQL databases use
varied query languages and are suitable for big data applications.
Cybersecurity Implications:
Data Integrity: SQL databases provide robust integrity constraints, while NoSQL often
lacks this feature.
Data Security: Both SQL and NoSQL databases need encryption, authentication, and
secure access protocols to protect sensitive data.
SQL Injection Attacks: A common vulnerability in SQL-based systems. Understanding
SQL querying is essential for preventing these attacks.
RAID Levels:
RAID 0: Striping (no redundancy, faster performance).
RAID 10: Combines RAID 1 and RAID 0 (high performance with redundancy).
Cybersecurity Implications of RAID:
SQL Querying: SQL is used to interact with relational databases and can be used to create,
retrieve, update, and delete data (CRUD operations).
SQL Injection: A major attack vector. Understanding SQL queries is vital for implementing
proper input validation to prevent such attacks.
Access Control: Using SQL to limit access to sensitive data and logs.
SQL injections
SQL injection is a technique where an attacker can manipulate an SQL query by inserting
malicious SQL code into an input field, typically to interact with a database in unauthorized
ways (e.g., viewing, modifying, or deleting data). Here's a basic example to illustrate how SQL
injection might work.
Scenario
Let's assume there is a simple login form with two fields:
1. username
2. password
In a safe system, [username] and [password] would be replaced with the actual user inputs,
resulting in something like:
However, if the application does not properly validate or escape user input, an attacker could
input malicious SQL code into the form fields.
Username: admin' --
Password: anything
Resulting Query:
SELECT * FROM users WHERE username = 'admin' --' AND password = 'anything';
In this case:
This effectively bypasses the password check and grants access to the attacker as the admin
user (if such a user exists in the database).
SELECT * FROM users WHERE username = '' OR 1=1; --' AND password = 'anything';
Here:
The OR 1=1 condition always evaluates to true, so the query returns all records from the
users table, potentially exposing sensitive data such as usernames, passwords, and
other private information.
1. Use Prepared Statements/Parameterized Queries: This method ensures user inputs are
treated as data, not executable code.
For example, using Python's sqlite3 :
cursor.execute("SELECT * FROM users WHERE username = ? AND password = ?",
(username, password))
2. Sanitize and Escape User Input: Ensure that user input is cleaned and escaped before
being used in SQL queries.
3. Use ORM (Object-Relational Mapping) Libraries: Frameworks like Django, Ruby on
Rails, or Hibernate handle query generation in a secure way.
4. Least Privilege: Ensure database accounts used by applications have the minimum
necessary permissions.