⚡ TechVani: AI, Technology, Apps, Coding & Digital World
TechVaniAI • Technology • Apps • Coding • Digital World
HomeAI & TechAppsCodingFree AI ToolsStudent TechSecurityAboutContactPrivacy
TECHVANI // LEARN. BUILD. TEST.

Learn the tech. Build the idea.

Clear study notes, tested lab files and practical guides for coding, AI and digital safety.

Explore Latest →
šŸ¤– AI & TechAI news, tools & guides šŸ“± Apps & ToolsUseful apps & websites šŸ’» CodingProgramming & web development šŸŽ“ Student TechStudy & career technology šŸ” Cyber SecuritySafety & awareness

Latest Posts

Circuit Notebook theme

Exam Notes

šŸ“š BTech CSE Exam Notes

Find Semester 1-8 subjects in one place. Choose a semester and open the notes you need. This is a general study guide, not an official syllabus.

Open Exam Notes →🧪 Open Lab Files →

Exam Numericals & Study Series

Practice CPU scheduling and explore OS and DBMS topics in separate, easy-to-follow parts. New topics will appear in the hub as they are published.

Open Numericals Hub →

Start here and stay in touch

New to TechVani? Start with our free AI tools guide for students. It covers which tools to try and what to check before relying on an answer.

For step-by-step videos, visit SiteSudhar on YouTube.

Join TechVani on WhatsApp

Get new AI tools and coding guides in your WhatsApp Updates tab.

Browse Topics

Popular Posts

TechVani

Information Security and Privacy | Semester 6 Complete Core Notes

Semester 6 - Page 4: Information Security and Privacy. 25 numbered topics, highlighted rules, worked defensive cases, answered exam questions, diagrams, comparison tables and three complete Python demos. General common-core guide, not an official syllabus or legal advice. Practice only within explicit permission.

Run each Python block separately: Python 3, standard library only; local synthetic data, no network scans or real accounts. SHA-256 here is not password storage. The HMAC key is an explicitly disposable teaching constant, never a real secret. The SQLite ownership argument is simulated and must come from a trusted identity boundary in a real system.

Topic map

  1. CIA and security objectives
  2. Assets, threats, vulnerabilities and risk
  3. Threat modeling and trust boundaries
  4. Authentication, MFA and account recovery
  5. Authorization and least privilege
  6. Access-control models and accountability
  7. Sessions, cookies and browser boundaries
  8. Symmetric/asymmetric cryptography and keys
  9. Hashes, integrity and trusted expected values
  10. MACs, HMAC and digital signatures
  11. Password storage and secret handling
  12. TLS, certificates and secure channels
  13. Input validation and SQL injection prevention
  14. Output encoding, XSS and context
  15. CSRF, CORS and request origin
  16. Networks, firewalls and segmentation
  17. Malware, phishing and human workflows
  18. Backups, availability and recovery tests
  19. Incident response and evidence
  20. Security testing and responsible disclosure
  21. Privacy purpose and data minimization
  22. Pseudonymization, anonymization and reidentification
  23. Retention, sharing and legal scope
  24. Defense in depth and secure lifecycle
  25. Exam and defensive checklist

1. CIA and security objectives

Confidentiality restricts reading, integrity protects against unauthorized change and availability enables authorized use. Security manages risk rather than promising perfect safety.

Worked example: A grade portal can remain online while altered marks violate integrity; backups address recovery but not every confidentiality issue.
Exam question: Does availability alone establish a secure portal?
Answer: No. Confidentiality and integrity can still fail.

2. Assets, threats, vulnerabilities and risk

Assets are what needs protection; threats can cause harm; vulnerabilities enable scenarios; controls reduce likelihood/impact. Risk estimates and residual risk need stated assumptions.

Worked example: Shared admin credentials enable takeover risk; distinct accounts, MFA and audit improve control, but risk remains.
Exam question: Is likelihood times impact an exact physical law?
Answer: No. It is a modeling aid with uncertain inputs.

3. Threat modeling and trust boundaries

Identify data flows, entry points, assets, actors and boundaries before choosing controls. External/client input remains untrusted even when it looks familiar.

Worked example: A browser field saying owner=admin is not trusted identity; the server derives caller identity from a verified session.
Exam question: Can a plausible-looking input grant its own permission?
Answer: No. Authority must come from the trusted control boundary.
Untrusted client request
 -> authenticated identity boundary
 -> object/action authorization
 -> validated query/data boundary
 -> permitted result only
Client-supplied identity or ownership text cannot authorize itself.

4. Authentication, MFA and account recovery

Authentication verifies a claimed identity. MFA uses distinct factors; recovery and session setup need comparable care because weak recovery can defeat strong sign-in.

Worked example: A passkey/password flow establishes an account under its security model; recovery contacts/codes need protection.
Exam question: Does a successful login authorize every record operation?
Answer: No. Authentication and authorization are different checks.

5. Authorization and least privilege

Authorization decides permitted actions/resources. Deny by default, check every protected operation and keep privileges limited to actual needs.

Worked example: A logged-in student changing a task ID still must not see another student's record.
Exam question: Can hiding a button replace server permission checks?
Answer: No. Attackers can send requests without that interface.

6. Access-control models and accountability

Discretionary, mandatory, role-based and attribute-based models organize permissions differently. Audit records support accountability with privacy/retention controls.

Worked example: A role may allow staff workflow actions while ownership/department attributes constrain particular records.
Exam question: Does granting a staff role mean every staff member needs all records?
Answer: No. Least privilege and object/context restrictions still apply.

7. Sessions, cookies and browser boundaries

Sessions bind ongoing requests to authenticated state; tokens/cookies need suitable scope, lifecycle and protection. Cookie and browser policies do not replace application authorization.

Worked example: Secure/HttpOnly/SameSite settings address different exposure paths; logout/expiry/rotation rules need actual implementation.
Exam question: Does HttpOnly stop every action a malicious page can cause?
Answer: No. It limits script access to a cookie, not every authenticated request effect.

8. Symmetric/asymmetric cryptography and keys

Symmetric schemes share a secret; asymmetric schemes use public/private key roles. Use reviewed authenticated constructions and libraries rather than custom encryption.

Worked example: Encrypting a database protects some storage threats, but stolen decryption keys or compromised running endpoints can defeat that protection.
Exam question: Can a key be published alongside ciphertext safely for secrecy?
Answer: No. Secret key control is part of the threat model.

9. Hashes, integrity and trusted expected values

A cryptographic digest is not reversible encryption. A matching digest authenticates content only as well as the trusted expected value/source; hashes are not password storage by default.

Worked example: The SHA-256 demo distinguishes two synthetic messages. It does not establish who supplied either message or digest.
Exam question: Does an untrusted page's matching file hash prove the page is trustworthy?
Answer: No. It can supply its own matching value.

Synthetic SHA-256 digest comparison, not password storage

import hashlib
for message in [b"notes", b"Notes"]:
    print(message.decode(), hashlib.sha256(message).hexdigest())
print("A matching digest needs a trusted expected value; it does not identify a sender.")

Checked output:

notes ab5aa97074c454a0632057e704220d9a6678fbf773a0a5806fc09b8173b07309
Notes 8a7525b1492fb84833f5c4a69b30f4bfbb134f9b666b61a2c1872d63d234c085
A matching digest needs a trusted expected value; it does not identify a sender.

10. MACs, HMAC and digital signatures

A MAC uses a shared secret for message authentication; a signature uses a private signing key and public verification. Neither automatically prevents replay or establishes an unrelated person's identity.

Worked example: The HMAC demo verifies exact bytes under a disposable teaching key and rejects altered bytes; replay and key distribution are outside it.
Exam question: Can a shared-key MAC identify which of two key holders sent a message?
Answer: Not uniquely by itself. Both holders can compute valid MACs.

HMAC verification of exact synthetic bytes

import hashlib, hmac
key = b"DISPOSABLE-TEACHING-KEY-DO-NOT-REUSE"
message = b"task=42;action=complete"
tag = hmac.new(key, message, hashlib.sha256).digest()
def verify(received):
    actual = hmac.new(key, received, hashlib.sha256).digest()
    return hmac.compare_digest(tag, actual)
print("unchanged:", verify(message))
print("altered:", verify(b"task=43;action=complete"))
print("The hardcoded disposable key is only for this local demo, never real use.")
print("No replay prevention, key distribution or real identity system is provided.")

Checked output:

unchanged: True
altered: False
The hardcoded disposable key is only for this local demo, never real use.
No replay prevention, key distribution or real identity system is provided.

11. Password storage and secret handling

Passwords need dedicated salted password-hashing schemes with current reviewed settings, not plain fast hashes or reversible storage. Never embed real secrets in source, URLs or logs.

Worked example: Use a supported password-hashing library and safe reset flow; do not adopt the digest demo as a password verifier.
Exam question: Does adding a salt make a fast general hash an ideal password scheme?
Answer: No. Password guessing resistance requires an appropriate dedicated scheme and cost.

12. TLS, certificates and secure channels

TLS protects a properly authenticated transit channel. Certificate/name validation matters; channel security does not secure compromised endpoints or replace object permissions.

Worked example: A certificate error needs hostname/time/chain/server diagnosis, not disabling verification as a fix.
Exam question: Does HTTPS prove all site content is true or authorized?
Answer: No. It protects a connection under its trust model, not every claim.

13. Input validation and SQL injection prevention

Validation constrains shape/meaning; parameterized queries separate values from query structure. They do not automatically enforce caller access or business rules.

Worked example: An owner predicate plus bound task ID is safer than raw concatenation. The demo uses a synthetic in-memory SQLite store only.
Exam question: Can parameterized SQL alone grant an ownership policy?
Answer: No. Include a trusted authorization predicate/check separately.

Bound query data plus ownership predicate on synthetic SQLite

import sqlite3
connection = sqlite3.connect(":memory:")
try:
    connection.execute("CREATE TABLE tasks(id INTEGER PRIMARY KEY, owner TEXT, title TEXT)")
    connection.execute("INSERT INTO tasks VALUES (?, ?, ?)", (42, "Asha", "Revise TLS"))
    def read(user, key):
        # Real apps derive user from their trusted authenticated identity boundary.
        return connection.execute("SELECT title FROM tasks WHERE id = ? AND owner = ?", (key, user)).fetchone()
    print("owner:", read("Asha", 42))
    print("other user:", read("Ravi", 42))
    print("unexpected key text:", read("Asha", "not-an-integer-key"))
    print("rows:", connection.execute("SELECT COUNT(*) FROM tasks").fetchone()[0])
finally:
    connection.close()
print("Local synthetic query demo; no real authentication or persistent database.")

Checked output:

owner: ('Revise TLS',)
other user: None
unexpected key text: None
rows: 1
Local synthetic query demo; no real authentication or persistent database.

14. Output encoding, XSS and context

Encode output for its actual context; HTML text, attributes, JS and URLs need different handling. Validation alone does not make arbitrary output safe.

Worked example: Displaying a task title as text is different from inserting it as raw HTML. Avoid unsafe rendering shortcuts.
Exam question: Does one HTML escape function safely handle every JavaScript/URL context?
Answer: No. Context determines the proper defense.

15. CSRF, CORS and request origin

CSRF concerns unwanted authenticated effects; CORS controls browser cross-origin response access. Apply suitable token/origin/cookie controls to actual threat paths.

Worked example: A server accepting a state-changing request needs permission and CSRF defenses where relevant; an allow-origin response is not authentication.
Exam question: Does enabling CORS automatically stop CSRF?
Answer: No. They address different mechanisms.

16. Networks, firewalls and segmentation

Network controls restrict paths and exposure but do not fix all application flaws. Segmentation and least-exposed services reduce impact under a threat model.

Worked example: A firewall can restrict database connections; a vulnerable authorized application can still misuse its access.
Exam question: Is NAT equivalent to encryption or a complete firewall policy?
Answer: No. Address translation serves a different purpose.

17. Malware, phishing and human workflows

Deceptive messages, malicious software and unsafe approvals can defeat purely technical assumptions. Verify requests through trusted channels and keep systems/dependencies maintained.

Worked example: An urgent message requesting a password or payment change should not authenticate itself through tone or claimed role.
Exam question: Does familiarity of wording prove sender identity?
Answer: No. Source binding and trusted confirmation matter.

18. Backups, availability and recovery tests

Backups need protection, restore testing and stated recovery objectives. Redundancy alone is not backup; retention and access restrictions matter.

Worked example: A corrupted/delete event can replicate to every replica, so a protected recoverable copy is a separate control.
Exam question: Does a successful backup job prove restoration works?
Answer: No. Test actual recovery of the needed version/data.

19. Incident response and evidence

Prepare roles and contacts, detect/assess, contain, preserve evidence, remove cause, recover and learn. Steps can overlap; exact notification duties depend on current applicable rules.

Worked example: Do not delete relevant logs in a rush; share only necessary evidence with authorized responders.
Exam question: Should a suspected incident be publicly described with private records?
Answer: No. Protect evidence and use authorized reporting channels.
Prepare -> detect/assess -> contain
 -> preserve + investigate evidence
 -> remove cause -> recover/test
 -> review and improve
Incident steps can overlap. Protect evidence and use authorized reporting routes.

20. Security testing and responsible disclosure

Test only systems within permission and scope. Document defensive findings, impact and reproducible evidence without unnecessary exploitation/disclosure.

Worked example: Use synthetic local examples here; report real issues through the owner's stated route rather than probing unrelated accounts.
Exam question: Does a student exercise grant unlimited production testing permission?
Answer: No. Scope and authorization are separate.

21. Privacy purpose and data minimization

Privacy asks whether collection/use/sharing/retention is appropriate, not only whether data is encrypted. Define purpose and collect the minimum justified fields.

Worked example: A study planner generally does not need continuous location history to track tasks.
Exam question: Can a perfectly encrypted database still violate privacy expectations?
Answer: Yes. Unnecessary collection or retention can be inappropriate.
Purpose -> minimum needed fields
 -> limited access/use/sharing
 -> retention review -> safe deletion
Encryption does not justify collecting unnecessary information.

22. Pseudonymization, anonymization and reidentification

Pseudonyms replace direct identifiers but linked/contextual data may still identify people. Anonymization claims need careful evaluation; hashing a name is not a universal guarantee.

Worked example: Rare combinations of dates, places or events can reidentify a record even after a name is removed.
Exam question: Does replacing names with IDs always make data anonymous?
Answer: No. Linkability and auxiliary information remain.

23. Retention, sharing and legal scope

Limit retention/access/sharing to stated purposes and verified obligations. Current laws, institutional rules and contracts depend on jurisdiction/context; these notes are not legal advice.

Worked example: Define deletion review and permitted recipients; do not invent a universal deadline or consent rule.
Exam question: Can a generic security chapter establish exact current legal duties?
Answer: No. Consult applicable current sources and qualified advice where needed.

24. Defense in depth and secure lifecycle

Combine preventive, detective and recovery controls with threat-informed design, dependency updates, review and monitoring. One control's failure should not imply unlimited access.

Worked example: Authorization, parameterization, logging and protected backups address different failure paths in a record system.
Exam question: Does adding many controls automatically create a correct design?
Answer: No. Coverage, configuration, failure behavior and testing matter.

25. Exam and defensive checklist

Distinguish threat/vulnerability/control, authn/authz, hash/encryption/MAC/signature and security/privacy. Explain scope and limits with one concrete defensive example.

Worked example: Trace who may read/change a task, how query data is bound, what logs omit and how recovery is verified.
Exam question: What makes a good security answer?
Answer: Correct objective, threat model, control, worked check and residual limits.

Security objective and control

ObjectiveExample controlLimit
ConfidentialityAccess rules + suitable encryptionCompromised endpoint/key remains a threat
IntegrityPermission + authenticated changesUntrusted expected hashes do not prove origin
AvailabilityProtected backups + recoveryBackup success is not restore proof
PrivacyPurpose/minimization/retentionEncrypted unnecessary collection can still be wrong

Cryptographic distinctions

MechanismPurposeImportant limit
EncryptionRecover plaintext with authorized keyDoes not replace permissions
DigestOne-way content fingerprintTrusted expected value needed
MAC/HMACShared-key message authenticationBoth key holders can create tags; replay separate
Digital signaturePrivate signing/public verificationIdentity depends on trusted key binding
Password hashingResist password guessing with dedicated schemePlain fast digest is unsuitable

Application boundary defenses

MechanismAddressesDoes not replace
AuthenticationClaimed identityObject authorization
Parameterized SQLValues separate from syntaxBusiness permissions
Contextual output encodingData not executable markup/codeEvery context with one generic escape
CORSBrowser cross-origin response accessCSRF/authentication
TLSAuthenticated transit channelTrust in all content or endpoint hygiene

Revision and defensive checklist

State assets, threat scenario, permission scope and residual risk. Distinguish identity from allowed action and data protection from justified use. Verify restore, actual access checks and expected failure behavior. Do not adopt teaching keys/digests as production credential systems.

Resources and sources

Current defensive guidance supports application controls, password handling and privacy concepts. Historical OWASP links from the original page are preserved as historical references, not the current ranking. No fixed legal deadline is inferred here.

Comments