08 - Advanced Database Artifacts Flashcards

1
Q

In what cases do we need to analyze databases?

A
  • Fraud
  • Hacking
  • Corporate/Governmental Espionage
  • etc.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the difficulties of DBMS Analysis?

A
  • Large organisations
  • server-level machines
  • accessing the files
  • privacy / confidentiality
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the five layers of a MySQL database?

A
  1. Connectors
    • Database application. Does not include important forensics artefacts.
  2. Connection Manager
    • Handles user connection to the MySQL system
  3. Query Processing
    • Most interesting: Query cache & buffers. Stores frequently used information. There are three common ways to create caching: manual caching, internal caching, mem cache distributed system.
  4. Storage Engines
    • Sub-system that manages tables. MySQL works normally with two: MyISAM, InnoDB.
  5. File System / Main storage
    • Data, Index, Logs, Backups as files in the file system
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the MySQL default data directories for Linux and Windows?

A
  • Linux
    • /usr/local/mysql/data
    • /var/lib/mysql….
  • Windows
    • C:\Program Data\MySQL\
    • C:\Documents & Settings\All User\Application Data\MySQL
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How can you locate the MySQL config?

A
  • Look into my.cnf or my.ini
  • Run # mysqld –verbose –help
  • SQL Query: mysql> SHOW VARIABLES LIKE ‘datadir’
  • Run $ mysqladmin variables
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How does the MySQL Data Directory Structure looks like?

A
  • Each database has a database directory.
  • Tables, views, triggers correspond to files in the database directory. E.g: *.frm file (used to define the format of a table).
  • Other files: process ID, status and log files, DES key file, server’s SSL certificate.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the two most common MySQL Storage Engine and what are they for?

A

MySQL can use different storage engines. Two most popular engines are InnoDB & MyISAM.

Features are:

  • transaction support (Memory or storage space)
  • table-level features
  • locking
  • index implementation, foreign keys support, buffering, file storage, backup
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are FRM files?

A

Each table has a .frm file. Used to define the format of a table. File name is also the table name. Normally it is 2GB or 4GB in size.

  • Header Sig (0x00 for 2 Bytes): 0xFE 01
  • FRM ver (0x02 for 1 Byte)
  • DB type (0x03 for 1 Byte) // InnoDB: 12, MyISAM: 9

Other important information in .frm file:

  • 0x2F (4Bytes) - Key length
  • 0x33 (4 Bytes) - MySQL Version ID
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How large is the FRM header?

A

64 Byte

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

At what offset does the FRM file key information start?

A

0x1000

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are the important information of the .frm File Key Information Section?

A
  • 0x1000 (1) : 0: no key
  • 0x1001 (1) : Number of keys
  • 0x1003 - 0x100A (0) : Key header
  • 0x100E - 0x1016 (9) : Key part
  • 0x1017 - : Separator + Name of key + separator…
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are the important information of the .frm File Column Information Section?

A
  • 0x2100 (2) : Fixed value (01 00)
  • 0x2102 (2) : Number of columns
  • Before EOF : Column names

Column entry is 17 Bytes in size. Column names are at the EOF (before FF 00 w/ separator FF).

Data Type Definition: FE= char, 02=smallint, 03=int)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What type of logs are present in MySQL?

A
  • MySQL logs (Server level)
    • Error, binary, general query, slow query, relay
  • Storage engine logs (Storage level)
    • InnoDB: undo log, redo log
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are the default names of the following logs:

  1. Error log
  2. Binary log
  3. General query log
  4. Slow query log
A
  1. HOSTNAME.err
  2. HOSTNAME-bin.XXXXX
  3. HOSTNAME.log
  4. HOSTNAME-slow.log
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How can you display the binary log?

A

# mysqlbinlog mysql-bin.00001 > mysql-bin00001.txt

The binary log is a set of log files that contain information about data modifications made to a MySQL server instance. The log is enabled by starting the server with the –log-bin option. It contains all statements that update data (maybe passwords).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How many log files does the storage engine InnoDB create?

A

By default, InnoDB creates two redo log files (or just log files) ib_logfile0 and ib_logfile1 within the data directory of MySQL. In MySQL versions 5.6.8 and above, the default size of each redo log file is 48MB each:

Undo log

  • Rollback transactions

Redo log

  • Crash recovery
  • ib_logfile0, ib_logfile1
17
Q

What are MySQL caches and what are the three types of MySQL cache?

A

Caching: return data from a query quickly.

  • Manual cache tables
  • Internal cache (query cache)
  • Distributed cache
18
Q

For what is cache analysis useful?

A
  • Recent accessed database
  • Misuse DBMS server (unauth. Access or SQL injection attacks).
  • Can be used to reconstruct history of SQL execution
19
Q

What are drawbacks of analyzing MySQL query cache?

A
  • Only SELECT statement
  • Not efficient for frequently updating table
  • Hash values
  • Case sensitive: ‘select’ vs ‘SELECT’
  • SQL_NO_CACHE
20
Q

What are other MySQL caches?

A
  • Record cache - Contains all of the records in a table
  • Table cache - Contains the most recently used table
  • Hostname cache - Used for quick lookup and name resolving
  • Heap table cache - Group by OR Distinct table