Data Security Flashcards
Types of SQL Injection
- Query Modification.
- Union Attack.
- Stacked Queries.
Query Modification
The attacker modifies the original query and then Ignores the rest of the original by adding – at the end of their addition to comment it out.
Union Attack
The attacker creates a UNION with an existing query that returns results from their query mixed with results of a legitimate query.
Stacked Queries
The attacker ends the original query with a ; and then appends their own query onto the original.
Preventing SQL Injection
- Parameterized Queries.
- Input Validation.
- Limit Database User Privileges.
Preventing SQL Injection
- Parameterized Queries.
- Input Validation.
- Limit Database User Privileges.
Parameterized Queries
The single most effective thing you can do to prevent SQL injection is to use parameterized queries. If this is done consistently, SQL injection will not be possible.
Input Validation
Limiting the data that can be input by a user can certainly be helpful in preventing SQL Injection, but is by no means effective prevention by itself.
Limit Database User Privileges
A web application should always use a database user to connect to the database that has as few permissions as necessary.
Hash Function
Is one that can map input data of arbitrary size to a fixed size output.
Hashing characteristics
Hashing is 1-way, meaning that once data is hashed, the hash cannot be reversed back into the original data
Salt
Is a fixed-length cryptographically-strong random value that is added to a password as input to a hash function..
Encryption
is the most effective way to achieve data security. When data is sent between two parties or stored, it is stored in an encrypted non-human readable format that requires the key to properly decrypt and understand.
Encrypting Data at Rest
- Data at rest can use a form of encryption called symmetric key encryption.
- Requires both parties to use the key to encrypt and decrypt data.
- Any party possessing the key can read the data.
- Has difficulties securing the symmetric key amongst multiple parties.
Securing Data in Transit
- Data in transit can use a form of encryption called asymmetric key encryption.
- Uses a Private and Public Key.
- Any party can be sent the public key. It can encrypt the data, but not decrypt it.
- Only the key owner has the private key. It can decrypt data encrypted by the public key.
- Has difficulties securing the symmetric key amongst multiple parties.