Detecting Data Attacks & File Integrity | AP Cybersecurity
Detecting Attacks on Data: File Integrity & Hash Verification
Topic 5.6 covers detecting attacks on data and applications. A key technique is verifying a file's hash to tell whether the file has been altered, since any change to the file changes its hash.
Contents
File integrity with hashes
A hash is a fixed-length fingerprint of a file. If even one byte of the file changes, the hash changes completely. To check integrity, you compare a file's current hash against a known-good hash: a match means unaltered, a mismatch means the file was changed.
This is the same hashing idea from Unit 4 (storing passwords), applied here to detect tampering. It protects integrity, one of the CIA goals.
A downloaded file's hash does not match the hash published by the source. What does this tell you?
Reveal answer
The file has been altered. Because any change to a file changes its hash, a mismatch means the file is not identical to the original, possibly tampered with or corrupted.
Hash match = unaltered; hash mismatch = changed. Verifying a file's hash is the framework's named method for detecting alteration (EK 5.6.D).
Detection controls and trade-offs
Beyond file integrity, organizations use logs, monitoring, and alerts to detect attacks on data and applications. As with other detection, methods are evaluated on speed, cost, and accuracy (false positives and false negatives).
The goal is to notice unauthorized access, alteration, or exfiltration of data quickly enough to respond before serious damage.
Why publish a known-good hash alongside a software download?
Reveal answer
So users can verify integrity. They hash the downloaded file and compare; a match confirms it was not altered in transit or replaced with a malicious version.
Verifying downloads with hashes
Reputable software publishers post a known-good hash next to a download. Users hash the file they received and compare; a match confirms the file was not altered or swapped for a malicious version.
Any change to a file changes its hash.
Key Terms
| Hash | A fixed-length fingerprint of a file. |
| File integrity | Confirming a file has not been altered. |
| Known-good hash | A trusted reference hash to compare against. |
| Integrity | The CIA goal that file checking protects. |
Match It Up
Common Mistakes
Thinking a hash hides the file
A hash verifies integrity; it does not encrypt or conceal the file's contents.
Assuming a small change keeps a similar hash
Any change, even one byte, produces a completely different hash.
Treating detection as prevention
Detecting alteration reveals tampering; it does not stop it from happening.
Ignoring trade-offs
Detection methods vary in speed, cost, and accuracy.
Check for Understanding
Frequently Asked Questions
Get in Touch
Whether you're a student, parent, or teacher — I'd love to hear from you.
Just want free AP CS resources?
Enter your email below and check the subscribe box — no message needed. Students get daily practice questions and study tips. Teachers get curriculum resources and teaching strategies.
Message Sent!
Thanks for reaching out. I'll get back to you within 24 hours.
Prefer email? Reach me directly at [email protected]