Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detecting database tampering, is it possible?

Long time listener, first time caller.

'Say you have a database table that is responsible for logging user activity. The integrity of this log is important, so you want to be able to detect if someone has modified any data from the table. To make things more interesting, also consider the fact that your system may be operated by an evil SQL admin who has complete control over this wretched system. yikes...

How would you safeguard your data?

How would you detect if someone has tampered with your data?

You have unlimited tools at your disposal. (i.e. hashing, encrypting, etc.)

like image 860
Glenn T. Avatar asked Nov 05 '09 20:11

Glenn T.


People also ask

What is tamper detected?

Tamper detection is the ability of a device to sense that an active attempt to compromise the device integrity or the data associated with the device is in progress; the detection of the threat may enable the device to initiate appropriate defensive actions.

How do you ensure that data is not tampered with or altered from its intended meaning?

One of the most effective ways to protect data-at-rest and -in-transit is encryption. Simply put, data encryption is the process of translating data from one form into another that unauthorized users cannot decrypt.

What are the risks caused by data tampering?

Data tampering causes risks such as important information exposed, deletion of files, eavesdropping on unauthorized conversations, and important messages being changed or altered. The major risks involved in data tampering are; Hacker can eavesdrop on important conversions.

Which of these are common anti tampering techniques?

Anti-tamper protection can be applied as either internally or externally to the application being protected. External anti-tampering is normally accomplished by monitoring the software to detect tampering. This type of defense is commonly expressed as malware scanners and anti-virus applications.


2 Answers

If you really must detect that tampering has occurred, then add a checksum field to the table. The checksum for each new row must include the checksum of the prior row. Then to verify the content, walk through the dataset computing the checksum as you move forward. If the calculated checksum doesnt match the value in the table then some value has been tampered.

-Mike

like image 157
MikeMontana Avatar answered Sep 21 '22 11:09

MikeMontana


If the "evil admin" has no access to the application that populates the database, a extra column on each table consisting of a cryptographic signature for the rest of the columns will do the job. The "no access" condition is needed such that they can't just extract your private key and sign their fake data.

Edit: Ah, as the commenters point out, I didn't consider the admin just deleting a row. For this, you'll need one extra row with a cryptographically signed row count that you update each time (or a signed hash of the rest of the table content, or last access time, or whatever indicator you choose).

like image 39
Adam Wright Avatar answered Sep 21 '22 11:09

Adam Wright