Security fundamentals
What Is a Vulnerability? Weakness, Threat, Risk and Exploit
Separate vulnerability, threat, risk and exploit, see how CWE and CVE name flaws, and learn why unreachable flaws can still matter.
The CIA triad explained: confidentiality, integrity and availability, with everyday examples, hash and signature checks, and ten incidents to classify.
The CIA triad is the model security people use to say what a control protects. It names three properties of information and systems: confidentiality, integrity and availability. Most security controls exist to keep one or more of them true. If you can say which property an event broke, you already know the kind of damage it did and which kind of control should have stopped it.
This article picks up where What Is Cybersecurity? ends. That article said security is about protecting information and systems from harm. This one narrows the idea into three goals and gives you a way to sort real events.
Each property answers a different question:
NIST uses these three terms across its security publications. FIPS 199 builds its federal information categories on them: each category asks how much harm a loss of each property would cause. The formal definitions are longer and more careful than the summary above. The sources at the end of this article link to them, and you should read them once you have the basic idea.
The letters are a memory aid, not a ranking. C does not come first because it matters most. A hospital scheduling system may treat availability as its top concern, while a payment ledger may care more about integrity. The right priority depends on the system and on what happens when it fails.
"Keep it safe" hides the trade-offs. A system can keep its secrets and still be useless because nobody can reach it. It can be online all the time and serve wrong data. It can be accurate and always available and still leak records to the wrong people. Naming three properties lets you ask a precise question about each one and pick controls that answer it.
Other frameworks add more terms, such as authenticity, accountability and non-repudiation. Some definitions fold authenticity and non-repudiation into integrity. FIPS 199 does this. Whichever definition you use, the three-property model is the common starting point, so learn it first.
Imagine a company exports its customer list to a spreadsheet and saves it on a shared drive. Everyone in the company can open that drive. A contractor who was only supposed to see one project downloads the whole file. Nothing was changed. The service stayed online. The information still left the place where it was supposed to stay, so confidentiality was lost.
Confidentiality is about who can read data, and it covers data at rest (on a disk, in a database), data in transit (moving across a network) and data in use (open in memory or on a screen).
The commands below run on a scratch file. They show what encryption does in practice. This is an illustration, not a graded lab, and the passphrase is for this demo only. Never put real secrets on a command line or in shell history.
printf 'Patient: J. Example, diagnosis: placeholder\n' > record.txt
export DEMO_PASS='lab-only-passphrase'
openssl enc -aes-256-cbc -pbkdf2 -salt -pass env:DEMO_PASS -in record.txt -out record.enc
od -A x -t x1z record.enc | head -3
openssl enc -d -aes-256-cbc -pbkdf2 -pass env:DEMO_PASS -in record.enc
openssl enc -d -aes-256-cbc -pbkdf2 -pass pass:wrong -in record.enc -out /dev/nullOn the machine where this was run (Windows 11, Git Bash, OpenSSL 3.2.4), the output was:
000000 53 61 6c 74 65 64 5f 5f e4 81 09 19 9d 68 fe de >Salted__.....h..<
000010 54 5b 6c 39 12 1a 38 01 b3 03 ac b8 66 be 3b 4b >T[l9..8.....f.;K<
000020 68 ae 58 39 8f 74 f1 59 23 27 09 fe b7 cf cc 58 >h.X9.t.Y#'.....X<
Patient: J. Example, diagnosis: placeholder
bad decrypt
D4C00000:error:1C800064:Provider routines:ossl_cipher_unpadblock:bad decrypt:../openssl-3.2.4/providers/implementations/ciphers/ciphercommon_block.c:107:The first three lines are the start of the ciphertext. The bytes after the Salted__ header look random, and they change on every run because OpenSSL picks a fresh salt each time, so your hex will differ. The right passphrase returns the original line. The wrong one fails with bad decrypt, and that error is all the wrong key produces. The error text does not reveal the content. The leading eight-character code in the error also varies between runs.
Someone downloads an installer from a mirror site. If the file was changed, it may still run perfectly well. The question is not whether it runs. The question is whether its bytes match what the vendor published.
Integrity also covers data in a database that someone edited without authorization, a log that was erased after an intrusion, and a configuration file changed by a script nobody approved. In each case, the damage is that you can no longer trust what the data says.
A hash function reads a file and produces a fixed-length fingerprint. Change one byte and the fingerprint changes completely. Comparing fingerprints lets you check that two copies are identical without reading both files side by side.
The commands below create a file, record its SHA-256 hash, and change its content:
printf 'Transfer: 10.00 USD to account A\n' > transfer.txt
sha256sum transfer.txt
printf 'Transfer: 1000.00 USD to account A\n' > transfer.txt
sha256sum transfer.txtObserved output:
f5ff0bd125880721c12f4eeecd95eb1a03fbc98f61dbd4ea2235cd7c902aa936 *transfer.txt
486ca9f3224c8003ff043ae09f3d1bc6cbe5008859a81c08e95da91945812b04 *transfer.txtThe second hash has nothing in common with the first, even though the change was one extra zero. The check becomes useful when you keep the expected hash and compare against it. Save the original hash to release.sha256, then verify:
sha256sum -c release.sha256For the original file it printed release.txt: OK. After the file was tampered with, it printed this:
release.txt: FAILED
sha256sum: WARNING: 1 computed checksum did NOT matchThe command exits with status 1, so a script can stop on it.
A hash has a limit. If an attacker replaces the file and also replaces the published hash on the same web page, the comparison passes and proves nothing. The hash only tells you that the file matches whatever hash you were given, so you need a trusted copy of that hash.
A digital signature handles that problem. The publisher signs the file with a private key. Anyone holding the matching public key can verify the signature. An attacker without the private key cannot produce a valid signature for a changed file.
The next commands use a throwaway RSA key created in a scratch folder. Do not reuse it for anything real.
openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -out priv.pem
openssl pkey -in priv.pem -pubout -out pub.pem
openssl dgst -sha256 -sign priv.pem -out release.sig release.txt
openssl dgst -sha256 -verify pub.pem -signature release.sig release.txtOn the original file, the verification printed Verified OK. After the file was changed, the same verification printed Verification failure, followed by OpenSSL error lines that include source paths. Those lines are omitted here.
A valid signature shows that the file was signed by the holder of the private key. It does not show that the key belongs to the vendor you expected. That link comes from a separate step: a certificate, a trusted key distribution or a fingerprint you check through another channel.
A clinic runs its appointment system on one server. A disk fails on a Monday morning. Patients cannot book for a day. Nothing was stolen and nothing was changed. The service was simply not there when people needed it.
Attacks cause the same outcome. A distributed denial-of-service (DDoS) attack floods a service with traffic until legitimate users cannot get through. Ransomware can lock files so that staff cannot work, even when no data leaves the organization. Availability also covers the people path: an account locked after too many failed logins is a small availability loss.
Backups have a catch. A backup can protect integrity when it lets you restore a clean copy after an intrusion, but only if the backup was made before the intrusion and kept out of the attacker's reach. A backup is also confidential data, so it needs encryption and access control too.
Most controls touch more than one property. The useful question is which property you are relying on for a given risk.
| Control | Main property | Also helps with |
|---|---|---|
| Encryption | Confidentiality | Integrity of data in transit, when the protocol authenticates it |
| Least privilege | Confidentiality | Integrity, by limiting who can change data |
| Multi-factor authentication | Confidentiality | Integrity of accounts |
| Hashes | Integrity | Trust in downloads, by catching corrupted or altered copies |
| Digital signatures | Integrity | Authenticity of the publisher |
| Audit logs | Integrity | Accountability, which supports incident response |
| Backups | Availability | Integrity, when you can restore a clean copy |
| Redundancy and failover | Availability | Little beyond availability |
| Rate limiting and DDoS protection | Availability | Confidentiality, by slowing brute-force attempts |
Read each description and write one letter: C (confidentiality), I (integrity) or A (availability). If two properties fit, pick the one the description emphasizes most and note the other in brackets. You do not need a computer for this. Try all ten before you read the answer key.
Scoring: eight or more correct means you can already sort incidents. If you missed several in the integrity group, reread the hash section. Some incidents fit two properties, so accept a reasoned answer that picks a different primary property if you explain why.
Read the introduction sections of NIST SP 800-12 Rev. 1 and the impact definitions in FIPS 199 in full. They use the words you have just learned, and they will make the formal documents easier to read.
Next, read What Is a Vulnerability? to see how a weakness turns into a loss of one of these three properties. For the mechanics behind encryption and hashes, read What Is Cryptography?.
To practice without touching anyone else's systems, take a few of your own files, record their hashes, change one character, and run the check again. Then encrypt a copy with a throwaway passphrase, decrypt it, and try the wrong passphrase. Delete the scratch files when you finish. The goal is to watch the properties work, not to build a secure system from shell commands.
Finally, read a public incident report and classify its main event with the same method. Ask which property it hit first, then which control would have changed the result.
Security fundamentals
Separate vulnerability, threat, risk and exploit, see how CWE and CVE name flaws, and learn why unreachable flaws can still matter.
Security fundamentals
Learn data flow diagrams, trust boundaries and the six STRIDE categories, then model a local OWASP Juice Shop in Threat Dragon.
Security fundamentals
What cybersecurity covers, the CIA triad, common ways systems fail, and a safe first exercise with hashes on your own machine.