Cyberlium

Cybersecurity › Module 2 › Lesson 2

BeginnerModule 2Lesson 2/6

Integrity

Trust that the data was not silently changed

15 min+18 XP3 quiz
Module progress2 of 6

Opening

What if your bank balance quietly changed?

Imagine $1,000 becoming $1 on the server — nobody "stole" cash from an ATM; someone altered the number. Doctors might see the wrong blood type. A news site might show falsified poll results while still loading fine. The system is up. The secret might still be encrypted at rest. The truth is wrong. Last lesson, Confidentiality stopped unauthorized reading. Integrity stops unauthorized writing or corruption. If you cannot trust the data, decisions based on it become dangerous — sometimes life-critical. This lesson is defensive: hashing and signatures as verification habits on files you download from vendors you chose, not as tools to forge documents or alter other people's records.

1. Integrity means authorized truth, not "the site still loads"

Integrity means information stays accurate and complete — as authorized creators intended — whether stored at rest or moving across a network in transit. Attackers, bugs, bit rot, and careless edits can all break it. The failure mode is silent change: readers and processes trust the bytes because they look like the usual database row or installer. Availability can still be green. Confidentiality can still hold if only authorized accounts can read. Integrity still failed if those authorized eyes are seeing a lie.

Separate view from modify in your mental model. Many confidentiality controls answer "who may read?" Integrity controls answer "who may change, and how do we detect unauthorized change?" A junior analyst might need read access to tickets without permission to edit payroll. A CMS editor might publish posts without permission to replace the homepage theme files. When mapping incidents, ask: was the primary harm disclosure, alteration, or downtime?

Transit integrity matters too. A file that left the vendor correct can still be swapped on a hostile mirror or altered by malware on the download path. That is why you compare against a published digest obtained from a channel you already trust — not from the same sketchy mirror that offered the file. Inside organizations, audit logs and change tickets create a human trail: who was authorized to edit, when, and why. Missing logs after an incident are themselves an integrity problem for investigators. Your personal drill stays small: hash a file you own; never alter shared school or work records "to demonstrate the pillar."

2. Hashing: a fingerprint that flips when one bit flips

A cryptographic hash is a one-way fingerprint of a file or message. Change one bit of input and the digest should change completely (avalanche). Matching a vendor-published SHA-256 after download supports integrity relative to those published bytes: the file likely was not swapped in transit or on a shady mirror. A mismatch means do not run it. Hashing does not encrypt; anyone can hash. Hashing does not by itself prove who published the digest — you must obtain the expected hash from a channel you trust (official site you typed, signed release notes).

On your own machine you can feel the mechanism safely: create a tiny text file, hash it, change one letter, hash again, watch the digest flip. That is the same idea vendors use when they publish checksums. It is not a license to alter production databases "to see the hash change." Practice files live under $HOME/cyberlium-lab or a temp folder you delete afterward.

3. Signatures, write controls, and file integrity monitoring

Digital signatures add authorship and integrity together: cryptographic proof of who signed a document or update and that it was not altered after signing. OS update systems and some package managers rely on this so a random mirror cannot silently replace a patch. You will not forge signatures in this course. You will prefer signed, official update channels on devices you own and treat unsigned surprise installers as hostile until proven otherwise.

Access controls on write — separate from read — reduce who can introduce unauthorized change. Dual control on money moves and change tickets on production configs are integrity habits in organizations. File Integrity Monitoring (FIM) alerts when critical system files change unexpectedly, turning silent alteration into a detected event. Backups matter here too: a known-good restore is how you recover integrity after tampering, not only how you recover availability after ransomware.

A clean mental test: if unauthorized people only read the data, say Confidentiality. If authorized people cannot use the system, say Availability. If the content itself was altered from what authorized creators intended — balance, blood type, homepage, installer bytes — say Integrity. Ransomware can eventually touch all three; a mismatched download hash is Integrity even when nothing was "stolen." Keep that test for the mapping lesson that closes this module.

4. Wrong vs right: verifying a software download

Worked example — installer.exe. Right is never empty and never "run it to see if it feels legit."

  • Wrong

    Download installer.exe from a random mirror, skip the published checksum, run it immediately. You might execute malware that replaced the real file. Or edit a classmate's shared homework file "to demonstrate integrity" without permission — that is unauthorized change, not a lab.

  • Right

    Download from the vendor's official site over HTTPS. Compare the file's hash to the vendor's published hash from that same trusted channel. Match → integrity check passed for that published version. Mismatch → do not run it. Practice hashing only on files you create.

5. Practical: feel the avalanche on a file you own

You do not need to attack anything. Practice hashing on a harmless text file you create. Delete it when done. Never hash other people's private documents to "audit" them without authorization, and never use hashes as a cover for tampering with shared school or work files.

Command guide

Safe hash demo (your own file only)

Create a tiny file, then fingerprint it (examples)

Windows PowerShell

Command — copy this

New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\cyberlium-lab" | Out-Null
"hello cyberlium" | Out-File -Encoding ascii "$env:USERPROFILE\cyberlium-lab\demo.txt"
Get-FileHash "$env:USERPROFILE\cyberlium-lab\demo.txt" -Algorithm SHA256

Change one character in demo.txt, save, run Get-FileHash again Notice: the hash completely changes

macOS / Linux

Command — copy this

mkdir -p "$HOME/cyberlium-lab"
echo "hello cyberlium" > "$HOME/cyberlium-lab/demo.txt"
shasum -a 256 "$HOME/cyberlium-lab/demo.txt"

edit demo.txt → run shasum again → different digest

Concept: vendors publish SHA256 so you can compare AFTER download NEVER: alter other people's files, forge signatures, or run mismatched installers

Command guide

Terminal practice (Linux / Kali / macOS — YOUR machine only)

Same integrity idea with openssl (OWN lab file)

Command — copy this

mkdir -p "$HOME/cyberlium-lab"
cd "$HOME/cyberlium-lab"
echo "hello cyberlium" > demo.txt
openssl dgst -sha256 demo.txt

Edit one character in demo.txt, then:

Command — copy this

openssl dgst -sha256 demo.txt

Digests differ wildly — avalanche effect

Windows (OpenSSL in PATH) — same commands after:

Optional command

New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\cyberlium-lab" | Out-Null
Set-Location "$env:USERPROFILE\cyberlium-lab"

NEVER: hash or alter files you do not own

Mission: hash flip

Create a small text file on your device (preferably under $HOME/cyberlium-lab). Generate its hash with a built-in tool (PowerShell Get-FileHash, shasum, or an OS checksum utility). Change one letter, hash again, and note that the digest changed. Delete the practice file when done. Do not tamper with anyone else's files.

Stuck? Ask Cyberlium AI Mentor

Mixing up confidentiality and integrity? Ask for a hint — no spoilers. Try: "Hint only: reading vs changing — which CIA pillar is which, and what does a matching vendor SHA-256 support after a download?"

Integrity tells you whether data was tampered with — hashes, signatures, write controls, and monitoring make silent change detectable or harder. Next — Availability — we make sure authorized people can still reach systems when those systems are under stress, flooded, or locked by ransomware.

Knowledge Check

1

APPLY: You download an update. The vendor's published SHA256 matches the hash you compute locally. What does that support?

Multiple choice

Knowledge Check

2

APPLY: An attacker changes a patient's blood type in a database from A+ to B- without anyone noticing. Primary pillar broken?

Multiple choice

Knowledge Check

3

APPLY: True or False: Integrity means "only administrators may view the data."

True or False

← Previous

Answer all 3 knowledge checks to continue. (0/3 answered)