Geavanceerd
Zoeken inSamenvattingen
Zo zoek je
  • Woorden vinden lestitels, tekst en code. Filter op soort (gidsen, cursussen, programma's, boeken) of blijf in dit boek.
  • book:rhcsa en ch:8 maken de zoektocht kleiner; #code vindt een woord alleen in commando's van de lessen.
  • "twee woorden" vindt precies die zin.
  • Gewone woorden vinden namen, teksten en voorbeelden.
  • ↑ ↓ bewegen · Enter openen · Esc sluiten · / zoeken
Probeer:

Cursus 6Naam in de cursus: Database Essentials and Vulnerabilities

Database Essentials and Vulnerabilities

Course 6 of 14 in the IBM Cybersecurity Analyst certificate. What data and databases are, and why we store data.

Course page: Coursera

  • 10 Lessen
  • 2 Commando's
  • 1 Labs

Dit deel is nog niet vertaald. Je ziet de Engelse tekst.

$ als gewone gebruiker# als root (of met sudo)

6.1

What the course covers

What data and databases are, and why we store data.

  • Relational databases with tables, rows, columns, and keys.
  • Basic SQL: read, count, insert, update, and delete data.
  • Users, roles, permissions, and database backups.
  • How to protect data: encryption, hashing, masking, tokenization, and more.
  • Injection flaws: SQL injection, command injection, and how to reduce the risk.
ModuleMain focus
Module 1 · Database FundamentalsData types and sources, relational and non-relational databases, keys and relationships
Module 2 · SQL Basics and Database Management FundamentalsSELECT, COUNT, DISTINCT, LIMIT, INSERT, UPDATE, DELETE, roles, permissions, backup
Module 3 · Database Security and Data Protection StrategiesData classification, encryption, hashing, masking, tokenization, users, auditing
Module 4 · Injection VulnerabilitiesInjection flaws, SQL and OS command injection, other injection types, mitigations
Module 5 · Final Project, Final Assessment, and Course Wrap-UpSecure a database, test it, report the findings

6.2

Module 1: Database Fundamentals

Data types and sources, relational and non-relational databases, keys and relationships.

  • Data is raw fact. Information is data with meaning. A database is an organised store of data.
  • A DBMS (database management system) is the software that creates, reads, and protects the data.
  • A relational database stores data in tables with rows and columns. Tables link through keys.
  • A primary key uniquely identifies one row. A foreign key points to a row in another table.
  • A non-relational (NoSQL) database uses documents, key-value pairs, graphs, or wide columns.
  • SQL is the language used to ask questions of and change data in a relational database.
  • Data is a raw fact. Information is data with meaning.
  • A database is an organised store of data.
  • A DBMS is the software that creates, reads, and protects the data.
  • A relational database uses tables with rows and columns. Tables link by keys.
  • A primary key is unique for one row. A foreign key points to another table.
  • A NoSQL database uses documents, key-value pairs, graphs, or wide columns.

6.3

Module 2: SQL Basics and Database Management Fundamentals

SELECT, COUNT, DISTINCT, LIMIT, INSERT, UPDATE, DELETE, roles, permissions, backup.

  • SELECT reads data: SELECT col FROM table WHERE condition;
  • COUNT counts rows, DISTINCT removes duplicates, LIMIT caps the number of rows.
  • INSERT INTO table (cols) VALUES (...) adds a row.
  • UPDATE table SET col = value WHERE ... changes rows. DELETE FROM table WHERE ... removes rows.
  • Always use WHERE with UPDATE and DELETE. Without it, every row changes.
  • GRANT gives a permission, REVOKE takes it back. Roles group permissions so users are easier to manage.
  • Backup is a copy of the data. A backup that has never been restored is not proven.
  • SELECT reads data. WHERE filters it.
  • COUNT counts rows. DISTINCT removes duplicates. LIMIT caps the rows.
  • INSERT adds a row. UPDATE changes rows. DELETE removes rows.
  • GRANT gives a permission. REVOKE takes it back.
  • Roles group permissions. A backup is only proven after a test restore.

6.4

Module 3: Database Security and Data Protection Strategies

Data classification, encryption, hashing, masking, tokenization, users, auditing.

  • Data classification groups data by sensitivity: public, internal, confidential, restricted.
  • Encryption locks data with a key. It can be reversed by someone who holds the key. Use it at rest and in transit.
  • Hashing makes a one-way fingerprint. It cannot be turned back into the original text. Good for passwords and integrity checks.
  • Masking hides part of a value, for example the middle digits of a card number.
  • Tokenization replaces a sensitive value with a token. The real value stays in a separate, guarded store.
  • Obfuscation makes data hard to read by shuffling or faking values.
  • Segmentation splits data into parts, and access is limited per part.
  • Permission restrictions mean only named users and roles can reach the data.
  • Auditing records who did what, when, and from where.
  • Data classification: public, internal, confidential, restricted.
  • Encryption locks data with a key. The holder of the key can reverse it.
  • Hashing makes a one-way fingerprint. You cannot turn it back into the text.
  • Masking hides part of a value, like the middle digits of a card number.
  • Tokenization swaps the value for a token. The real value stays in a guarded store.

6.5

Module 4: Injection Vulnerabilities

Injection flaws, SQL and OS command injection, other injection types, mitigations.

  • An injection flaw happens when untrusted input is treated as code or as a command.
  • SQL injection changes the query. Classic input: ' OR 1=1 --.
  • OS command injection makes the server run operating-system commands through a weak input field.
  • Other types: NoSQL injection, LDAP injection, and XML injection.
  • Defence: check input, use parameterized queries (prepared statements), escape output, and give the app account only the rights it needs.
  • Also useful: hide detailed error messages, keep the DBMS patched, and use a web application firewall as an extra layer.
  • A blind SQL injection gets no data back directly; the attacker reads true/false answers or waits and times responses.
  • An injection flaw happens when untrusted input is treated as code or a command.
  • SQL injection changes the query. A classic test input is ' OR 1=1 --.
  • OS command injection makes the server run system commands through a weak field.
  • Other types: NoSQL, LDAP, and XML injection.
  • Defence: check input, use parameterized queries, limit rights, hide errors.
  • Blind SQL injection gets no data back. The attacker reads true/false answers or times responses.

6.6

Module 5: Final Project, Final Assessment, and Course Wrap-Up

Secure a database, test it, report the findings.

  • The project asks you to protect a database and show a safe way to query it.
  • Protect a database, then show a safe way to query it.
  • Report what you found and how you fixed it.

6.7

Key terms

The words of this course in one table. Learn them before the quiz or exam.

TermMeaning
COUNTCount the rows in a result.
DataA raw fact with no meaning yet.
DatabaseAn organised store of data.
DBMSThe software that manages the database.
DELETERemove rows. It needs WHERE.
DISTINCTKeep one copy of each different value.
EncryptionA locked form of data. It needs a key.
Foreign keyA value that points to a row in another table.
GRANTGive a right. REVOKE = take it back.
HashingA one-way fingerprint. It cannot be reversed.
InformationData with meaning for a person.
InjectionInput becomes code or a command.
Least privilegeGive only the access the job needs.
LIMITReturn only a set number of rows.
MaskingHide part of a value, keep the rest.
NoSQLA database that is not built on tables and keys.
Parameterized queryInput stays data, never SQL code.
Primary keyThe unique number or name for one row.
RoleA group of permissions given to many users.
SELECTRead data from a table.
SQLThe language for relational data.
TableRows and columns in a relational database.
TokenizationPut a token in place of the real value.
UPDATEChange rows that already exist.

6.8

Check yourself

Answer each question first, then open it to check the answer.

1Which key uniquely identifies one row in a table? a) Foreign key · b) Primary key · c) Schema · d) Index

b) Primary key. The primary key is unique for each row. A foreign key only links to another table.

2Which keyword removes duplicate rows from a result? a) COUNT · b) DISTINCT · c) LIMIT · d) WHERE

b) DISTINCT. DISTINCT keeps one copy of each different row.

3Which statement changes data that is already in a table? a) SELECT · b) INSERT · c) UPDATE · d) CREATE

c) UPDATE. UPDATE changes existing rows; INSERT adds new ones.

4What happens with DELETE FROM users; when there is no WHERE clause? a) It deletes one row · b) It deletes every row · c) It gives a syntax error · d) It renames the table

b) It deletes every row. With no WHERE, the statement acts on every row.

5How is hashing best described? a) Reversible encryption with a key · b) A one-way fingerprint of the data · c) A copy of the database · d) A way to hide half of a value

b) A one-way fingerprint of the data. Hashing is one-way, so you compare fingerprints, not the original value.

6What does tokenization do? a) Replaces a sensitive value with a token and keeps the real value in a safe store · b) Deletes the sensitive value for good · c) Encrypts every table in the database · d) Copies the table to a backup disk

a) Replaces a sensitive value with a token and keeps the real value in a safe store. The token stands in for the value; the value stays in a protected store.

7What does least privilege mean? a) Every user gets admin rights · b) A user gets only the access needed for the job · c) No user gets an account · d) All staff share one account

b) A user gets only the access needed for the job. Least privilege gives the minimum access required.

8In a relational database, data is stored in: a) Tables of rows and columns · b) Images · c) Plain text files only · d) Network packets

a) Tables of rows and columns. Tables with rows and columns are the relational model.

9Which practice best reduces SQL injection risk? a) Joining user input into the query string · b) Using parameterized queries · c) Showing raw SQL errors to users · d) Giving the app the database admin account

b) Using parameterized queries. Parameterized queries keep input as data, not as SQL code.

10What does GRANT do? a) Removes a permission · b) Gives a permission · c) Deletes a user · d) Creates a backup

b) Gives a permission. GRANT gives a privilege; REVOKE removes it.

11What does data masking do? a) Hides part of a value · b) Deletes the row · c) Encrypts the value with a key · d) Copies the value to tape

a) Hides part of a value. Masking keeps the value but hides part of it.

12What does a foreign key do? a) Counts the rows in a table · b) Deletes a row · c) Points to a row in another table · d) Encrypts a column

c) Points to a row in another table. A foreign key links to a row in another table.

13Which one is NOT a NoSQL data model? a) Documents · b) Key-value pairs · c) Graphs · d) Tables with rows and columns

d) Tables with rows and columns. Tables with rows and columns are the relational model.

14Which keyword removes duplicate rows from a result? a) COUNT · b) WHERE · c) LIMIT · d) DISTINCT

d) DISTINCT. DISTINCT keeps one copy of each different row.

15What happens with DELETE FROM users; when there is no WHERE clause? a) It deletes every row · b) It deletes one row · c) It gives a syntax error · d) It renames the table

a) It deletes every row. With no WHERE, the statement acts on every row.

16How is hashing best described? a) A one-way fingerprint of the data · b) Reversible encryption with a key · c) A copy of the database · d) A way to hide half of a value

a) A one-way fingerprint of the data. Hashing is one-way, so you compare fingerprints.

17Which one can be reversed by a person who holds the key? a) Encryption · b) Hashing · c) Masking · d) Auditing

a) Encryption. Encryption is reversible with the right key.

18What does tokenization do? a) Encrypts every table in the database · b) Deletes the sensitive value for good · c) Replaces a sensitive value with a token and keeps the real value in a safe store · d) Copies the table to a backup disk

c) Replaces a sensitive value with a token and keeps the real value in a safe store. The token stands in for the value. The value stays protected.

19What does GRANT do? a) Removes a permission · b) Deletes a user · c) Gives a permission · d) Creates a backup

c) Gives a permission. GRANT gives a right. REVOKE removes it.

20Which practice best reduces SQL injection risk? a) Joining user input into the query string · b) Giving the app the database admin account · c) Showing raw SQL errors to users · d) Using parameterized queries

d) Using parameterized queries. Parameterized queries keep input as data, not code.

21Which input is a classic SQL injection test? a) ' OR 1=1 -- · b) hello world · c) 2024-01-01 · d) first name

a) ' OR 1=1 --. This input tries to make the WHERE clause always true.

22Why should a site hide detailed database error messages? a) They look ugly · b) They break the backup · c) They make the page load slower · d) They help an attacker learn the table names and structure

d) They help an attacker learn the table names and structure. Errors can show table names and query structure.

23What is a blind SQL injection? a) An attack that turns off the screen · b) An attack where no data comes back directly, so the attacker reads true/false answers · c) An attack on the office lights · d) A safe way to test a query

b) An attack where no data comes back directly, so the attacker reads true/false answers. The attacker gets no direct output, only yes/no or time.

24What does COUNT do in a query? a) Sorts the rows · b) Deletes the rows · c) Counts the rows in the result · d) Encrypts the rows

c) Counts the rows in the result. COUNT returns the number of rows.

25What does LIMIT do in a query? a) Limits the table size · b) Limits the number of users · c) Caps the number of rows returned · d) Stops the database

c) Caps the number of rows returned. LIMIT caps how many rows come back.

26An app builds its query by joining user text into the SQL string. What is the risk? a) Slow typing · b) SQL injection · c) A full disk · d) A weak password

b) SQL injection. User text becomes part of the SQL, so it can change the query.

27You must give a new analyst database access. What is the best step? a) Give the admin account · b) Give a role with only the rights the job needs · c) Share one team login · d) Give no account at all

b) Give a role with only the rights the job needs. A role with only the needed rights follows least privilege.

6.9

Study and exam tips

Learn the job of each SQL keyword. Many questions ask for one keyword.

  • Keep encryption (key, reversible) and hashing (one-way) apart. This pair appears often.
  • For injection, remember the fix chain: check input, use parameterized queries, limit rights.
  • Be ready to define all the protection methods in one line: encryption, hashing, masking, tokenization, obfuscation, segmentation, restrictions.
  • UPDATE and DELETE need a WHERE clause. That is the classic "what is wrong here" question.
  • Keep encryption (reversible, key) and hashing (one-way) apart. This pair appears often.
  • Be ready to define each protection method in one line: encryption, hashing, masking, tokenization, obfuscation, segmentation, restrictions.
  • UPDATE and DELETE need a WHERE clause. This is the classic "what is wrong here" question.

Oefenen

Alle commando's in dit hoofdstuk