← Computer Science notes

Unit 2 · Operating Systems

Chapters 6, 7 · I/O Systems, Protection & Security

pdcampus.in
pdcampus.in • DSSSB TGT CS
Beginner Topper
I/O Systems, Protection & Security Unit 5 • Ch 3 • Programmed I/O Interrupt DMA, Access Matrix ACL Capability, CIA Triad Threats Malware, Encryption Authentication Firewall
Beginner Story Mode Complete Notes • Unit 5 Final

Imagine CPU is boss, devices are workers (printer, disk, keyboard). How does boss talk to workers? 3 ways:
Programmed I/O: Boss constantly asks worker "done? done? done?" polling busy waiting wastes CPU.
Interrupt-driven I/O: Boss says do work and goes to do other work, worker interrupts boss when done "Boss I'm done!" via ISR Interrupt Service Routine efficient.
DMA Direct Memory Access: Boss hires manager DMA controller transfers data directly between device and memory without CPU involvement CPU free to do other work DMA steals cycles cycle stealing fast for bulk transfer disk.

Protection = Inside security who can access what inside system? Access Matrix rows=Domains (process, user) columns=Objects (file, device) cells=Rights (read/write/execute). Domain=process/user who wants access Object=file/device what is accessed Rights=what can do. Implementation ACL Access Control List column-wise per object stored with object file→{process:r,w,x; user:r} easy to list who can access file, Capability List row-wise per domain stored with domain process→{file:r,w,x; device:r,x} like ticket/token held by domain. Revocation ACL→remove domain from object's list→easy Capability→must reclaim capability from domain→harder. Principle of least privilege give each domain only minimum rights it needs to function limits damage if compromised. Protection Rings Ring 0 kernel highest privilege OS runs here Ring 3 user lowest privilege user apps run here Goal enforce isolation control access safely.

Security = Outside protection from external threats CIA triad: Confidentiality keep data secret only authorized access, Integrity data remains accurate not altered or tampered, Availability system & data accessible when needed + Authentication verify identity of user/system + Non-repudiation sender cannot deny having sent it. Threats 4 types: Interruption→availability service disrupted stopped, Interception→confidentiality data eavesdropped/sniffed, Modification→integrity data altered/changed, Fabrication→authenticity fake data/message introduced.

Malware types must know: Virus attaches to a file requires host to run, Worm standalone self-replicates spreads across network, Trojan disguises as useful program but is malicious, Spyware spies on user collects activity/data secretly, Ransomware encrypts files demands ransom payment, Rootkit hides itself to evade detection & maintain control.
Attacks: DoS Denial of Service flood→overwhelm target cause outage, DDoS Distributed Denial of Service many devices/botnet flood target, Buffer Overflow exploit to overwrite memory execute code, Man-in-the-Middle intercept/relay communications between parties.

Security Mechanisms: Encryption symmetric same key DES AES fast uses same key both sides, asymmetric public private key RSA slow public encrypt private decrypt digital signature private encrypt public decrypt, Authentication passwords hashed salt one-time passwords biometrics multi-factor MFA, Firewalls packet filter stateful application gateway, Intrusion Detection IDS NIDS HIDS anomaly signature, Digital Signature and Certificates CA, Protection vs Security Protection controls access inside system Access Matrix Security protects from external threats CIA. Let's learn with handwritten diagrams.

1. I/O Systems - Programmed I/O vs Interrupt vs DMA
I/O Systems Programmed Interrupt DMA handwritten
Fig 1: I/O Subsystem User process → kernel I/O subsystem → device driver → device controller → device | Programmed I/O CPU polls status register busy waiting CPU constantly checks if device ready waste CPU inefficient for slow devices | Interrupt-driven I/O CPU does other work device interrupts when ready ISR Interrupt Service Routine CPU saves context jumps to ISR handles I/O returns efficient CPU not wasting | DMA Direct Memory Access controller transfers directly memory without CPU CPU initiates DMA transfer DMA controller moves data device↔memory directly cycle stealing CPU free fast for bulk transfer disk I/O | Comparison CPU involvement Programmed high polling Interrupt low interrupt DMA minimal setup only Efficiency Programmed low Interrupt medium DMA high for bulk | I/O Hardware polling interrupt DMA controller

I/O Subsystem Layer:
- User process → kernel I/O subsystem (scheduling, buffering, caching, spooling) → device driver (knows device specifics) → device controller (hardware interface) → device (printer, disk, keyboard).
- Kernel I/O subsystem provides services: scheduling of I/O requests, buffering temporary storage to cope with speed mismatch, caching faster access, spooling queue for shared devices like printer, device reservation.

3 Methods of I/O Handling:
- 1) Programmed I/O (Polling):
- CPU polls status register busy waiting constantly checks if device ready "done? done?".
- CPU executes loop: while(device not ready) check status; then transfer data.
- Wastes CPU inefficient CPU busy waiting cannot do other work waiting.
- Good for fast devices or when device ready quickly but inefficient for slow devices.
- No interrupt hardware needed simple.

- 2) Interrupt-driven I/O:
- CPU does other work after initiating I/O device interrupts CPU when ready.
- Steps: CPU starts I/O → goes to do other process → device finishes → raises interrupt → CPU saves current context → jumps to ISR Interrupt Service Routine → handles I/O transfer → restores context → resumes.
- Efficient CPU not wasting time polling can do other useful work during I/O.
- Needs interrupt controller and ISR handling overhead context switch per interrupt.
- Better than programmed for most devices.

- 3) DMA Direct Memory Access:
- DMA controller transfers data directly between device and memory without CPU involvement for each byte.
- Steps: CPU programs DMA controller with source, destination, count → CPU free to do other work → DMA controller transfers data device↔memory directly stealing memory cycles cycle stealing → when done DMA interrupts CPU "transfer complete".
- CPU involvement minimal only setup and completion interrupt.
- Fast for bulk transfer disk I/O large blocks high speed devices.
- DMA steals cycles cycle stealing uses memory bus while CPU may need it slight slowdown but overall efficient.
- Needs DMA controller hardware.

Comparison Table:
- Programmed I/O: CPU involvement High polling, Efficiency Low for slow devices, Hardware Simple no interrupt, Use Fast devices where waiting short.
- Interrupt-driven: CPU involvement Low interrupt, Efficiency Medium, Hardware Interrupt controller ISR, Use Most devices moderate speed.
- DMA: CPU involvement Minimal setup only, Efficiency High for bulk transfer, Hardware DMA controller, Use Bulk transfer disk high speed devices large data.

I/O Hardware Techniques:
- Polling, Interrupts, DMA controller, I/O channels.
- Blocking vs Non-blocking I/O: Blocking process waits until I/O complete suspended, Non-blocking process continues returns immediately.

I/O Subsystem User process → kernel I/O subsystem → device driver → device controller → device Kernel provides scheduling buffering caching spooling reservation | Programmed I/O polling CPU polls status register busy waiting CPU constantly checks if device ready waste CPU inefficient for slow devices CPU High polling Efficiency Low Hardware Simple | Interrupt-driven I/O CPU does other work device interrupts when ready ISR Interrupt Service Routine CPU saves context jumps to ISR handles returns efficient CPU not wasting Needs interrupt controller overhead context switch per interrupt CPU Low interrupt Efficiency Medium Hardware Interrupt controller ISR | DMA Direct Memory Access controller transfers directly memory without CPU CPU programs DMA source destination count CPU free DMA transfers device↔memory directly cycle stealing when done interrupts CPU transfer complete CPU Minimal setup only Efficiency High for bulk transfer disk Hardware DMA controller Needs DMA controller | Comparison Programmed High Low Simple Fast devices Interrupt Low Medium Interrupt controller Most devices DMA Minimal High DMA controller Bulk disk large data | Blocking process waits until I/O complete suspended Non-blocking continues returns immediately
2. Protection - Access Matrix & ACL vs Capability
Protection Access Matrix ACL vs Capability handwritten
Fig 2: Access Matrix A model that defines protection rights for each (domain, object) pair Rows = Domains Columns = Objects Cells = Rights (read/write/execute) | Table Domains\Objects file device process read write execute read execute user read read write Domain examples process user Object examples file device Each cell = the rights the domain has on the object | ACL vs Capability Implementation ACL Access Control List Column-wise list of domains & rights for each object Stored with the object Example file → { process:r,w,x; user:r } Easier to list who can access the file | Implementation Capability List Row-wise list of objects & rights for each domain Stored with the domain Example process → { file:r,w,x; device:r,x } Like a ticket/token held by the domain | Revocation ACL→remove domain from object's list→easy Capability→must reclaim capability from domain→harder | Principle of Least Privilege Give each domain only minimum rights it needs to function Limits damage if process is compromised | Protection Rings Ring 0 kernel highest privilege OS/kernel runs here Ring 3 user lowest privilege user applications run here Goal enforce isolation control access to resources safely

Protection Overview: Protection controls access inside system who can access what internal mechanism.

Access Matrix Model:
- A model that defines protection rights for each (domain, object) pair.
- Rows = Domains, Columns = Objects, Cells = Rights (read/write/execute).
- Domain = process, user who wants access subject that initiates request.
- Object = file, device, memory segment, process what is accessed resource.
- Each cell = the rights the domain has on the object e.g., read, write, execute, rwx.
- Example table: Domains\Objects | file | device | process: file read,write,execute, device read,execute; user: file read, device read,write.
- Domain examples: process, user; Object examples: file, device; Each cell = the rights the domain has on the object.
- Access matrix is abstract model not actually stored as matrix sparse many empty cells implementation via ACL or Capability List.

Implementation Two Ways:
- 1) ACL Access Control List Column-wise:
- Column-wise list of domains & rights for each object.
- Stored with the object e.g., file's inode stores ACL.
- Example: file → { process: r,w,x ; user: r } means process can read write execute file user can only read.
- Easier to list who can access the file answer question "Who can access this file?" quickly.
- Used in Unix Linux Windows file systems.
- ACL entry format: domain: rights.

- 2) Capability List Row-wise:
- Row-wise list of objects & rights for each domain.
- Stored with the domain e.g., process's PCB stores capability list.
- Example: process → { file: r,w,x ; device: r,x } means process has rights rwx on file rx on device.
- Like a ticket/token held by the domain must present capability to access object.
- Easier to list what objects a domain can access answer "What can this process access?" quickly.
- Used in capability-based systems.

Revocation:
- ACL → remove the domain from the object's list → easy just delete entry from ACL of object.
- Capability → must reclaim capability from the domain → harder need to find capability in domain and remove must search all domains.
- ACL easier for revocation, Capability harder.

Principle of Least Privilege:
- Give each domain only the minimum rights it needs to function → Limits damage if process is compromised attacker gets only limited rights not all rights.
- Example: Web browser needs network read but not write to system files give only network read.

Protection Rings:
- Ring 0: kernel highest privilege OS/kernel runs here can execute all instructions privileged instructions access all memory.
- Ring 1,2: device drivers services intermediate.
- Ring 3: user lowest privilege user applications run here cannot execute privileged instructions must syscall to kernel.
- Goal: enforce isolation control access to resources safely hardware support for protection.
- Intel x86 has 4 rings 0-3, ARM has exception levels.

Access Matrix A model that defines protection rights for each (domain, object) pair Rows = Domains Columns = Objects Cells = Rights (read/write/execute) | Table Domains\Objects file device process read write execute read execute user read read write Domain examples process user Object examples file device Each cell = rights domain has on object | ACL vs Capability ACL Access Control List Column-wise list of domains & rights for each object Stored with object Example file → { process:r,w,x; user:r } Easier to list who can access file Used Unix Linux Windows | Capability List Row-wise list of objects & rights for each domain Stored with domain Example process → { file:r,w,x; device:r,x } Like ticket/token held by domain Easier to list what domain can access Capability-based | Revocation ACL→remove domain from object's list→easy Capability→must reclaim capability from domain→harder | Principle of Least Privilege Give each domain only minimum rights it needs to function Limits damage if compromised | Protection Rings Ring 0 kernel highest privilege OS/kernel runs here Ring 3 user lowest privilege user applications run here Goal enforce isolation control access to resources safely Intel x86 4 rings ARM exception levels
3. Security - Threats, Malware, Attacks - CIA Triad
Security Threats Malware Attacks handwritten
Fig 3: Security goals CIA triad Confidentiality keep data secret only authorized access Integrity data remains accurate not altered or tampered Availability system & data accessible when needed + Authentication verify identity of user/system + Non-repudiation sender cannot deny having sent it | Threats 4 types Interruption→availability service disrupted or stopped Interception→confidentiality data eavesdropped/sniffed Modification→integrity data altered/changed Fabrication→authenticity fake data/message introduced | Malware Virus attaches to a file requires host to run Worm standalone self-replicates spreads across network Trojan disguises as useful program but is malicious Spyware spies on user collects activity/data secretly Ransomware encrypts files demands ransom payment Rootkit hides itself to evade detection & maintain control | Attacks DoS Denial of Service flood→overwhelm target cause outage DDoS Distributed Denial of Service many devices/botnet flood target flood target Buffer Overflow exploit to overwrite memory execute code Man-in-the-Middle intercept/relay communications between parties

Security Goals CIA Triad + 2:
- Confidentiality: Keep data secret / only authorized access no unauthorized disclosure e.g., encryption.
- Integrity: Data remains accurate / not altered or tampered no unauthorized modification e.g., checksum hash.
- Availability: System & data accessible when needed no denial of service e.g., redundancy.
- + Authentication: Verify identity of user/system are you who you claim? passwords biometrics.
- + Non-repudiation: Sender cannot deny having sent it proof of origin digital signatures.

Threats 4 Types Mapping to Goals:
- Interruption → availability: Service disrupted or stopped e.g., DoS attack cuts network destroys file system.
- Interception → confidentiality: Data eavesdropped/sniffed unauthorized access e.g., wiretapping sniffing passwords.
- Modification → integrity: Data altered/changed unauthorized modification e.g., tampering with database changing values.
- Fabrication → authenticity: Fake data/message introduced e.g., fake transactions fake identity.

Malware Types:
- Virus: Attaches to a file requires host to run cannot run alone replicates when host executed e.g., attaches to .exe file.
- Worm: Standalone self-replicates spreads across network no host needed exploits vulnerabilities e.g., Morris worm.
- Trojan: Disguises as useful program but is malicious pretends to be game but installs backdoor e.g., fake antivirus.
- Spyware: Spies on user collects activity/data secretly keylogger screen capture browsing history.
- Ransomware: Encrypts files demands ransom payment to decrypt e.g., WannaCry CryptoLocker.
- Rootkit: Hides itself to evade detection & maintain control hides files processes maintains backdoor access.
- Difference: Virus needs host file worm standalone Trojan disguises.

Attacks:
- DoS Denial of Service flood → overwhelm target cause outage: Single machine floods target with requests e.g., SYN flood ping flood target cannot serve legitimate users.
- DDoS Distributed Denial of Service many devices/botnet flood target: Many compromised devices botnet flood target harder to block many sources e.g., Mirai botnet.
- Buffer Overflow: Exploit to overwrite memory beyond buffer boundary execute malicious code e.g., strcpy without bounds check overwrites return address jumps to shellcode.
- Man-in-the-Middle: Intercept/relay communications between parties eavesdrop and possibly modify attacker sits between client and server client thinks talking to server server thinks talking to client attacker intercepts.
- Other attacks: Phishing fake emails to steal credentials, SQL Injection inject SQL via input to manipulate database, Cross-Site Scripting XSS inject script into web page.

Security goals CIA triad Confidentiality keep data secret only authorized access Integrity data remains accurate not altered or tampered Availability system & data accessible when needed + Authentication verify identity of user/system + Non-repudiation sender cannot deny having sent it | Threats Interruption→availability service disrupted or stopped Interception→confidentiality data eavesdropped/sniffed Modification→integrity data altered/changed Fabrication→authenticity fake data/message introduced | Malware Virus attaches to a file requires host to run Worm standalone self-replicates spreads across network Trojan disguises as useful program but is malicious Spyware spies on user collects activity/data secretly Ransomware encrypts files demands ransom payment Rootkit hides itself to evade detection & maintain control Difference Virus needs host worm standalone Trojan disguises | Attacks DoS Denial of Service flood→overwhelm target cause outage DDoS Distributed Denial of Service many devices/botnet flood target Buffer Overflow exploit to overwrite memory execute code Man-in-the-Middle intercept/relay communications between parties Other Phishing fake emails SQL Injection inject SQL XSS inject script
4. Security Mechanisms - Encryption & Authentication - Final Shield
Security Mechanisms Encryption Authentication handwritten
Fig 4: Encryption symmetric same key DES AES fast same key encrypt decrypt vs asymmetric public private key RSA slow public encrypt private decrypt digital signature private encrypt public decrypt Key distribution symmetric need secure channel asymmetric public can be shared Symmetric fast Asymmetric slow hybrid uses both Asymmetric to exchange symmetric key then symmetric for data | Authentication passwords hashed salt not plain store hash(salt+password) One-time passwords OTP Biometrics fingerprint iris face Multi-factor MFA something you know password + something you have phone OTP + something you are biometrics | Firewalls packet filter filters IP port stateful keeps connection state application gateway proxy firewall IDS Intrusion Detection NIDS Network IDS monitors network HIDS Host IDS monitors host anomaly detection baseline signature detection known patterns | Digital Signature and Certificates CA Certificate Authority signs certificate public key + identity Protection vs Security Protection controls access inside system Access Matrix ACL Capability Security protects from external threats CIA triad outside attackers malware

Encryption:
- Symmetric same key: DES Data Encryption Standard 56-bit old insecure, AES Advanced Encryption Standard 128/192/256-bit modern fast. Same key for encrypt and decrypt fast efficient for bulk data. Need secure channel to share key key distribution problem if attacker intercepts key can decrypt. Example: AES key K encrypt plaintext P → ciphertext C = Encrypt(K,P) decrypt P = Decrypt(K,C) same K.
- Asymmetric public private key: RSA Rivest Shamir Adleman public private key pair. Slow compared to symmetric but solves key distribution. Public key can be shared openly private key secret. Two uses:
- Public encrypt private decrypt: Sender encrypts with receiver's public key only receiver with private key can decrypt confidentiality. Example: Alice wants to send secret to Bob Alice encrypts with Bob's public key Bob decrypts with his private key.
- Private encrypt public decrypt = Digital signature: Sender encrypts with own private key anyone with sender's public key can decrypt verifies sender authenticity non-repudiation. Example: Alice signs message with her private key Bob verifies with Alice's public key proves message from Alice and not tampered integrity.
- Key distribution symmetric need secure channel to share key asymmetric public can be shared openly no secure channel needed for public key but need to verify public key belongs to correct person via certificates.
- Symmetric fast Asymmetric slow hybrid approach uses both Asymmetric to exchange symmetric session key securely then symmetric for bulk data fast e.g., TLS HTTPS uses hybrid RSA/AES.
- DES AES symmetric block ciphers, RSA asymmetric, Diffie-Hellman key exchange.

Authentication:
- Passwords: Not stored plain store hashed with salt hash(salt+password) salt random per user prevents rainbow table attack. On login hash entered password with stored salt compare with stored hash. Example: password "hello" salt "x5" store hash(x5+hello).
- One-time passwords OTP: Password valid only once or short time e.g., SMS OTP TOTP time-based.
- Biometrics: Fingerprint iris face recognition something you are.
- Multi-factor MFA: Combine factors something you know password + something you have phone OTP token + something you are biometrics at least 2 factors. More secure than single factor.
- MFA example: Password (know) + phone OTP (have) + fingerprint (are) = 3-factor.

Firewalls:
- Packet filter filters based on IP port protocol stateless simple fast.
- Stateful keeps connection state tracks TCP connections more secure.
- Application gateway proxy firewall filters at application layer e.g., HTTP proxy understands HTTP.
- Firewall sits between internal network and external internet filters traffic based on rules allow/deny.

Intrusion Detection IDS:
- NIDS Network IDS monitors network traffic detects intrusions network-wide.
- HIDS Host IDS monitors host system logs files processes detects intrusions on single host.
- Anomaly detection baseline normal behavior detects deviation from baseline may have false positives.
- Signature detection known attack patterns signatures detects known attacks low false positive but cannot detect new attacks.
- IDS detects IDS + IPS Intrusion Prevention System blocks as well as detects.

Digital Signature and Certificates:
- Digital Signature: Hash message then encrypt hash with sender's private key signature = Encrypt(private_key, hash(message)). Receiver decrypts signature with sender's public key and compares hash verifies integrity and authenticity non-repudiation.
- CA Certificate Authority trusted third party signs certificate binding public key to identity. Certificate = public key + identity + CA signature. Browser has CA public keys pre-installed verifies server certificate.
- PKI Public Key Infrastructure system for managing certificates.

Protection vs Security Difference:
- Protection controls access inside system Access Matrix ACL Capability internal access control who can access what inside OS.
- Security protects from external threats CIA triad outside attackers malware network attacks external.
- Protection is internal Security is external both needed.

Encryption symmetric same key DES 56-bit old AES 128/192/256-bit modern fast same key encrypt decrypt Need secure channel to share key Example C=Encrypt(K,P) P=Decrypt(K,C) same K | Asymmetric public private key RSA slow public encrypt private decrypt digital signature private encrypt public decrypt Two uses Public encrypt private decrypt confidentiality Alice encrypts with Bob's public Bob decrypts with private Private encrypt public decrypt = Digital signature authenticity non-repudiation Alice signs with private Bob verifies with Alice's public | Key distribution symmetric need secure channel asymmetric public can be shared openly public key shared no secure channel but need verify belongs via certificates | Symmetric fast Asymmetric slow hybrid uses both Asymmetric to exchange symmetric key then symmetric for data fast TLS HTTPS hybrid RSA/AES | Authentication passwords hashed salt not plain store hash(salt+password) salt random per user prevents rainbow table login hash entered with stored salt compare One-time passwords OTP SMS TOTP time-based Biometrics fingerprint iris face something you are Multi-factor MFA something you know password + something you have phone OTP + something you are biometrics at least 2 factors more secure | Firewalls packet filter IP port stateless simple fast stateful keeps connection state tracks TCP more secure application gateway proxy firewall application layer HTTP proxy Filters traffic between internal and external allow/deny | IDS Intrusion Detection NIDS Network IDS monitors network HIDS Host IDS monitors host anomaly baseline normal deviation may false positives signature known patterns low false positive cannot detect new attacks IDS detects IPS blocks | Digital Signature Hash message then encrypt hash with private key signature=Encrypt(private_key,hash(message)) Receiver decrypts with public compares hash verifies integrity authenticity non-repudiation | CA Certificate Authority trusted third party signs certificate public key+identity+CA signature Certificate=public key+identity+CA signature Browser has CA public keys pre-installed verifies server PKI Public Key Infrastructure | Protection vs Security Protection controls access inside system Access Matrix ACL Capability internal who can access what inside OS Security protects from external threats CIA triad outside attackers malware external both needed
5. DSSSB Traps & PYQ Practice - Unit 5 Final
  • Q: I/O Subsystem? → User process → kernel I/O subsystem → device driver → device controller → device Kernel provides scheduling buffering caching spooling reservation
  • Q: Programmed I/O? → CPU polls status register busy waiting constantly checks if device ready waste CPU inefficient for slow devices CPU High polling Efficiency Low Hardware Simple no interrupt Use Fast devices where waiting short
  • Q: Interrupt-driven I/O? → CPU does other work device interrupts when ready ISR Interrupt Service Routine CPU saves context jumps to ISR handles I/O returns efficient CPU not wasting Needs interrupt controller overhead context switch per interrupt CPU Low interrupt Efficiency Medium Hardware Interrupt controller ISR Use Most devices moderate speed
  • Q: DMA? → Direct Memory Access controller transfers directly memory without CPU CPU programs DMA source destination count CPU free DMA transfers device↔memory directly cycle stealing when done interrupts CPU transfer complete CPU Minimal setup only Efficiency High for bulk transfer disk Hardware DMA controller Needs DMA controller Use Bulk disk large data fast | Cycle stealing uses memory bus while CPU may need slight slowdown but efficient
  • Q: Comparison? → Programmed High Low Simple Fast devices Interrupt Low Medium Interrupt controller Most devices DMA Minimal High DMA controller Bulk disk large data
  • Q: Blocking vs Non-blocking? → Blocking process waits until I/O complete suspended Non-blocking continues returns immediately
  • Q: Protection? → Controls access inside system who can access what internal mechanism
  • Q: Access Matrix? → Model defines protection rights for each (domain, object) pair Rows=Domains Columns=Objects Cells=Rights read/write/execute Domain=process user who wants access Object=file device what is accessed Rights=what can do Example Domains\Objects file device process rwx rx user r rw Domain process user Object file device Each cell=rights domain has on object Abstract model not stored as matrix sparse implementation via ACL or Capability
  • Q: ACL? → Access Control List Column-wise list of domains & rights for each object Stored with object Example file→{process:r,w,x; user:r} means process can rwx file user only r Easier to list who can access file Who can access this file? quickly Used Unix Linux Windows ACL entry domain:rights
  • Q: Capability List? → Row-wise list of objects & rights for each domain Stored with domain Example process→{file:r,w,x; device:r,x} means process has rights rwx on file rx on device Like ticket/token held by domain must present capability to access Easier to list what objects domain can access What can this process access? quickly Capability-based systems
  • Q: ACL vs Capability? → ACL Column-wise Stored with object Example file→{process:r,w,x; user:r} Easier who can access file Used Unix Linux Windows vs Capability Row-wise Stored with domain Example process→{file:r,w,x; device:r,x} Like ticket/token held by domain Easier what domain can access Capability-based
  • Q: Revocation? → ACL→remove domain from object's list→easy just delete entry from ACL of object Capability→must reclaim capability from domain→harder need to find capability in domain and remove search all domains ACL easier for revocation Capability harder
  • Q: Principle of Least Privilege? → Give each domain only minimum rights it needs to function Limits damage if process compromised attacker gets only limited rights not all Example Web browser needs network read but not write to system files give only network read
  • Q: Protection Rings? → Ring 0 kernel highest privilege OS/kernel runs here can execute all instructions privileged instructions access all memory Ring 1,2 device drivers services intermediate Ring 3 user lowest privilege user applications run here cannot execute privileged instructions must syscall to kernel Goal enforce isolation control access to resources safely hardware support Intel x86 4 rings 0-3 ARM exception levels
  • Q: Security? → Protects from external threats CIA triad outside attackers malware network attacks external
  • Q: CIA Triad? → Confidentiality keep data secret only authorized access no unauthorized disclosure encryption Integrity data remains accurate not altered or tampered no unauthorized modification checksum hash Availability system & data accessible when needed no denial of service redundancy + Authentication verify identity are you who you claim? passwords biometrics + Non-repudiation sender cannot deny having sent it proof of origin digital signatures
  • Q: Threats 4 types? → Interruption→availability service disrupted or stopped e.g., DoS cuts network destroys file system Interception→confidentiality data eavesdropped/sniffed unauthorized access e.g., wiretapping sniffing passwords Modification→integrity data altered/changed unauthorized modification e.g., tampering database changing values Fabrication→authenticity fake data/message introduced e.g., fake transactions fake identity
  • Q: Malware? → Virus attaches to a file requires host to run cannot run alone replicates when host executed attaches to .exe Worm standalone self-replicates spreads across network no host needed exploits vulnerabilities Morris worm Trojan disguises as useful program but is malicious pretends game but installs backdoor fake antivirus Spyware spies on user collects activity/data secretly keylogger screen capture browsing history Ransomware encrypts files demands ransom payment to decrypt WannaCry CryptoLocker Rootkit hides itself to evade detection & maintain control hides files processes maintains backdoor Difference Virus needs host file worm standalone Trojan disguises
  • Q: DoS? → Denial of Service flood→overwhelm target cause outage Single machine floods target with requests SYN flood ping flood target cannot serve legitimate users
  • Q: DDoS? → Distributed Denial of Service many devices/botnet flood target Many compromised devices botnet flood target harder to block many sources Mirai botnet
  • Q: Buffer Overflow? → Exploit to overwrite memory beyond buffer boundary execute malicious code strcpy without bounds check overwrites return address jumps to shellcode
  • Q: Man-in-the-Middle? → Intercept/relay communications between parties eavesdrop and possibly modify attacker sits between client and server client thinks talking to server server thinks talking to client attacker intercepts
  • Q: Other attacks? → Phishing fake emails to steal credentials SQL Injection inject SQL via input to manipulate database XSS Cross-Site Scripting inject script into web page
  • Q: Encryption? → Symmetric same key DES 56-bit old insecure AES 128/192/256-bit modern fast same key encrypt decrypt fast efficient bulk data need secure channel to share key key distribution problem if attacker intercepts key can decrypt C=Encrypt(K,P) P=Decrypt(K,C) same K
  • Q: Asymmetric? → Public private key RSA slow public private key pair slow but solves key distribution public key shared openly private key secret Two uses Public encrypt private decrypt confidentiality Sender encrypts with receiver's public only receiver private can decrypt Alice to Bob Alice encrypts with Bob's public Bob decrypts private Private encrypt public decrypt = Digital signature authenticity non-repudiation Sender encrypts own private anyone with sender's public can decrypt verifies sender authenticity non-repudiation Alice signs with private Bob verifies with Alice's public proves from Alice not tampered
  • Q: Key distribution? → Symmetric need secure channel to share key Asymmetric public can be shared openly no secure channel needed for public key but need to verify public key belongs to correct person via certificates
  • Q: Symmetric vs Asymmetric speed? → Symmetric fast Asymmetric slow hybrid uses both Asymmetric to exchange symmetric session key securely then symmetric for bulk data fast TLS HTTPS hybrid RSA/AES DES AES symmetric block ciphers RSA asymmetric Diffie-Hellman key exchange
  • Q: Authentication passwords? → Not stored plain store hashed with salt hash(salt+password) salt random per user prevents rainbow table attack On login hash entered password with stored salt compare with stored hash Example password hello salt x5 store hash(x5+hello)
  • Q: OTP? → One-time passwords valid only once or short time SMS OTP TOTP time-based
  • Q: Biometrics? → Fingerprint iris face recognition something you are
  • Q: MFA? → Multi-factor Combine something you know password + something you have phone OTP token + something you are biometrics at least 2 factors more secure than single factor Example Password know + phone OTP have + fingerprint are = 3-factor
  • Q: Firewalls? → Packet filter filters IP port protocol stateless simple fast Stateful keeps connection state tracks TCP connections more secure Application gateway proxy firewall application layer e.g., HTTP proxy understands HTTP Firewall sits between internal and external filters traffic based on rules allow/deny
  • Q: IDS? → NIDS Network IDS monitors network traffic detects intrusions network-wide HIDS Host IDS monitors host system logs files processes detects intrusions on single host Anomaly detection baseline normal behavior detects deviation may false positives Signature detection known attack patterns signatures detects known attacks low false positive cannot detect new attacks IDS detects IPS Intrusion Prevention System blocks as well as detects
  • Q: Digital Signature? → Hash message then encrypt hash with sender's private key signature=Encrypt(private_key,hash(message)) Receiver decrypts signature with sender's public key and compares hash verifies integrity and authenticity non-repudiation
  • Q: CA? → Certificate Authority trusted third party signs certificate binding public key to identity Certificate=public key+identity+CA signature Browser has CA public keys pre-installed verifies server certificate PKI Public Key Infrastructure system for managing certificates
  • Q: PKI? → Public Key Infrastructure system for managing certificates
  • Q: Protection vs Security? → Protection controls access inside system Access Matrix ACL Capability internal access control who can access what inside OS Security protects from external threats CIA triad outside attackers malware network attacks external both needed
  • Q: Difference Virus Worm Trojan? → Virus needs host file attaches requires host to run Worm standalone self-replicates spreads across network no host needed exploits vulnerabilities Trojan disguises as useful program but is malicious pretends useful but installs backdoor
I/O Subsystem User process → kernel I/O subsystem → device driver → device controller → device Kernel provides scheduling buffering caching spooling reservation | Programmed I/O polling CPU polls status register busy waiting constantly checks if device ready waste CPU inefficient for slow devices CPU High polling Efficiency Low Hardware Simple no interrupt Use Fast devices where waiting short | Interrupt-driven I/O CPU does other work device interrupts when ready ISR Interrupt Service Routine CPU saves context jumps to ISR handles returns efficient CPU not wasting Needs interrupt controller overhead context switch per interrupt CPU Low interrupt Efficiency Medium Hardware Interrupt controller ISR Use Most devices moderate speed | DMA Direct Memory Access controller transfers directly memory without CPU CPU programs DMA source destination count CPU free DMA transfers device↔memory directly cycle stealing when done interrupts transfer complete CPU Minimal setup only Efficiency High for bulk transfer disk Hardware DMA controller Needs DMA controller Use Bulk disk large data fast Cycle stealing uses memory bus while CPU may need slight slowdown but efficient | Blocking process waits until I/O complete suspended Non-blocking continues returns immediately | Access Matrix Model defines protection rights for each (domain, object) pair Rows=Domains Columns=Objects Cells=Rights read/write/execute Domain=process user who wants access Object=file device what is accessed Rights=what can do Example Domains\Objects file device process rwx rx user r rw Domain process user Object file device Each cell=rights domain has on object Abstract model not stored as matrix sparse implementation via ACL or Capability | ACL Access Control List Column-wise list of domains & rights for each object Stored with object Example file→{process:r,w,x; user:r} means process can rwx file user only r Easier to list who can access file Who can access this file? quickly Used Unix Linux Windows ACL entry domain:rights | Capability List Row-wise list of objects & rights for each domain Stored with domain Example process→{file:r,w,x; device:r,x} means process has rights rwx on file rx on device Like ticket/token held by domain must present capability to access Easier to list what objects domain can access What can this process access? quickly Capability-based systems | Revocation ACL→remove domain from object's list→easy just delete entry from ACL of object Capability→must reclaim capability from domain→harder need to find capability in domain and remove search all domains ACL easier for revocation Capability harder | Principle of Least Privilege Give each domain only minimum rights it needs to function Limits damage if process compromised attacker gets only limited rights not all Example Web browser needs network read but not write to system files give only network read | Protection Rings Ring 0 kernel highest privilege OS/kernel runs here can execute all instructions privileged instructions access all memory Ring 1,2 device drivers services intermediate Ring 3 user lowest privilege user applications run here cannot execute privileged instructions must syscall to kernel Goal enforce isolation control access to resources safely hardware support Intel x86 4 rings 0-3 ARM exception levels | Security Protects from external threats CIA triad outside attackers malware network attacks external | CIA Triad Confidentiality keep data secret only authorized access no unauthorized disclosure encryption Integrity data remains accurate not altered or tampered no unauthorized modification checksum hash Availability system & data accessible when needed no denial of service redundancy + Authentication verify identity are you who you claim? passwords biometrics + Non-repudiation sender cannot deny having sent it proof of origin digital signatures | Threats 4 types Interruption→availability service disrupted or stopped e.g., DoS cuts network destroys file system Interception→confidentiality data eavesdropped/sniffed unauthorized access e.g., wiretapping sniffing passwords Modification→integrity data altered/changed unauthorized modification e.g., tampering database changing values Fabrication→authenticity fake data/message introduced e.g., fake transactions fake identity | Malware Virus attaches to a file requires host to run cannot run alone replicates when host executed attaches to .exe Worm standalone self-replicates spreads across network no host needed exploits vulnerabilities Morris worm Trojan disguises as useful program but is malicious pretends game but installs backdoor fake antivirus Spyware spies on user collects activity/data secretly keylogger screen capture browsing history Ransomware encrypts files demands ransom payment to decrypt WannaCry CryptoLocker Rootkit hides itself to evade detection & maintain control hides files processes maintains backdoor Difference Virus needs host file worm standalone Trojan disguises | DoS Denial of Service flood→overwhelm target cause outage Single machine floods target with requests SYN flood ping flood target cannot serve legitimate users | DDoS Distributed Denial of Service many devices/botnet flood target Many compromised devices botnet flood target harder to block many sources Mirai botnet | Buffer Overflow Exploit to overwrite memory beyond buffer boundary execute malicious code strcpy without bounds check overwrites return address jumps to shellcode | Man-in-the-Middle Intercept/relay communications between parties eavesdrop and possibly modify attacker sits between client and server client thinks talking to server server thinks talking to client attacker intercepts | Other attacks Phishing fake emails to steal credentials SQL Injection inject SQL via input to manipulate database XSS Cross-Site Scripting inject script into web page | Encryption Symmetric same key DES 56-bit old insecure AES 128/192/256-bit modern fast same key encrypt decrypt fast efficient bulk data need secure channel to share key key distribution problem if attacker intercepts key can decrypt C=Encrypt(K,P) P=Decrypt(K,C) same K | Asymmetric Public private key RSA slow public private key pair slow but solves key distribution public key shared openly private key secret Two uses Public encrypt private decrypt confidentiality Sender encrypts with receiver's public only receiver private can decrypt Alice to Bob Alice encrypts with Bob's public Bob decrypts private Private encrypt public decrypt = Digital signature authenticity non-repudiation Sender encrypts own private anyone with sender's public can decrypt verifies sender authenticity non-repudiation Alice signs with private Bob verifies with Alice's public proves from Alice not tampered | Key distribution Symmetric need secure channel to share key Asymmetric public can be shared openly no secure channel needed for public key but need to verify public key belongs to correct person via certificates | Symmetric vs Asymmetric speed Symmetric fast Asymmetric slow hybrid uses both Asymmetric to exchange symmetric session key securely then symmetric for bulk data fast TLS HTTPS hybrid RSA/AES DES AES symmetric block ciphers RSA asymmetric Diffie-Hellman key exchange | Authentication passwords hashed salt not plain store hashed with salt hash(salt+password) salt random per user prevents rainbow table attack On login hash entered password with stored salt compare with stored hash Example password hello salt x5 store hash(x5+hello) | OTP One-time passwords valid only once or short time SMS OTP TOTP time-based | Biometrics Fingerprint iris face recognition something you are | MFA Multi-factor Combine something you know password + something you have phone OTP token + something you are biometrics at least 2 factors more secure than single factor Example Password know + phone OTP have + fingerprint are = 3-factor | Firewalls Packet filter filters IP port protocol stateless simple fast Stateful keeps connection state tracks TCP connections more secure Application gateway proxy firewall application layer e.g., HTTP proxy understands HTTP Firewall sits between internal and external filters traffic based on rules allow/deny | IDS NIDS Network IDS monitors network traffic detects intrusions network-wide HIDS Host IDS monitors host system logs files processes detects intrusions on single host Anomaly detection baseline normal behavior detects deviation may false positives Signature detection known attack patterns signatures detects known attacks low false positive cannot detect new attacks IDS detects IPS Intrusion Prevention System blocks as well as detects | Digital Signature Hash message then encrypt hash with sender's private key signature=Encrypt(private_key,hash(message)) Receiver decrypts signature with sender's public key and compares hash verifies integrity and authenticity non-repudiation | CA Certificate Authority trusted third party signs certificate binding public key to identity Certificate=public key+identity+CA signature Browser has CA public keys pre-installed verifies server certificate PKI Public Key Infrastructure system for managing certificates | PKI Public Key Infrastructure system for managing certificates | Protection vs Security Protection controls access inside system Access Matrix ACL Capability internal access control who can access what inside OS Security protects from external threats CIA triad outside attackers malware network attacks external both needed | Difference Virus Worm Trojan Virus needs host file attaches requires host to run Worm standalone self-replicates spreads across network no host needed exploits vulnerabilities Trojan disguises as useful program but is malicious pretends useful but installs backdoor

Final Recap - Unit 5 Complete: CPU boss devices workers printer disk keyboard How boss talk to workers? 3 ways Programmed I/O Boss constantly asks worker done? done? done? polling busy waiting wastes CPU Interrupt-driven I/O Boss says do work and goes to do other work worker interrupts boss when done Boss I'm done! via ISR Interrupt Service Routine efficient DMA Direct Memory Access Boss hires manager DMA controller transfers data directly between device and memory without CPU involvement CPU free to do other work DMA steals cycles cycle stealing fast for bulk transfer disk. Protection Inside security who can access what inside system Access Matrix rows=Domains process user columns=Objects file device cells=Rights read/write/execute Domain=process/user who wants access Object=file/device what is accessed Rights=what can do Implementation ACL Access Control List column-wise per object stored with object file→{process:r,w,x; user:r} easy to list who can access file Capability List row-wise per domain stored with domain process→{file:r,w,x; device:r,x} like ticket/token held by domain Revocation ACL→remove domain from object's list→easy Capability→must reclaim capability from domain→harder Principle of least privilege give each domain only minimum rights it needs to function limits damage if compromised Protection Rings Ring 0 kernel highest privilege OS runs here Ring 3 user lowest privilege user apps run here Goal enforce isolation control access safely. Security Outside protection from external threats CIA triad Confidentiality keep data secret only authorized access Integrity data remains accurate not altered or tampered Availability system & data accessible when needed + Authentication verify identity + Non-repudiation sender cannot deny having sent it Threats 4 types Interruption→availability service disrupted stopped Interception→confidentiality data eavesdropped/sniffed Modification→integrity data altered/changed Fabrication→authenticity fake data/message introduced Malware types must know Virus attaches to a file requires host to run Worm standalone self-replicates spreads across network Trojan disguises as useful program but is malicious Spyware spies on user collects activity/data secretly Ransomware encrypts files demands ransom payment Rootkit hides itself to evade detection & maintain control Difference Virus needs host file worm standalone Trojan disguises Attacks DoS Denial of Service flood→overwhelm target cause outage DDoS Distributed Denial of Service many devices/botnet flood target Buffer Overflow exploit to overwrite memory execute code Man-in-the-Middle intercept/relay communications between parties Other Phishing fake emails SQL Injection inject SQL XSS inject script. Security Mechanisms Encryption symmetric same key DES AES fast same key encrypt decrypt vs asymmetric public private key RSA slow public encrypt private decrypt digital signature private encrypt public decrypt Key distribution symmetric need secure channel asymmetric public can be shared Symmetric fast Asymmetric slow hybrid uses both Asymmetric to exchange symmetric key then symmetric for data Authentication passwords hashed salt not plain store hash(salt+password) One-time passwords OTP Biometrics fingerprint iris face Multi-factor MFA something you know password + something you have phone OTP + something you are biometrics Firewalls packet filter stateful application gateway proxy firewall IDS Intrusion Detection NIDS Network IDS monitors network HIDS Host IDS monitors host anomaly detection baseline signature detection known patterns Digital Signature and Certificates CA Certificate Authority signs certificate public key+identity Protection vs Security Protection controls access inside system Access Matrix ACL Capability internal Security protects from external threats CIA triad outside attackers malware. If you remember I/O Subsystem User→kernel I/O→device driver→device controller→device Programmed polling busy waiting waste CPU inefficient Interrupt CPU does other work device interrupts ISR efficient DMA controller transfers directly memory without CPU cycle stealing fast bulk disk Comparison Programmed High Low Simple Fast devices Interrupt Low Medium Interrupt controller Most devices DMA Minimal High DMA controller Bulk disk large data and Access Matrix Rows Domains process user Columns Objects file device Cells Rights rwx Domain process user Object file device Each cell rights Abstract model sparse ACL or Capability ACL Column-wise Stored with object Example file→{process:r,w,x; user:r} Easier who can access file Used Unix Linux Windows Capability Row-wise Stored with domain Example process→{file:r,w,x; device:r,x} Like ticket/token held by domain Easier what domain can access Capability-based Revocation ACL→remove domain from object's list→easy Capability→must reclaim from domain→harder Least Privilege Give each domain only minimum rights limits damage if compromised Protection Rings Ring 0 kernel highest privilege OS runs here Ring 3 user lowest privilege user apps run here Goal enforce isolation control access safely and CIA Triad Confidentiality keep secret only authorized Integrity accurate not altered Availability accessible when needed Authentication verify identity Non-repudiation sender cannot deny Threats Interruption→availability disrupted stopped Interception→confidentiality eavesdropped sniffed Modification→integrity altered changed Fabrication→authenticity fake data introduced Malware Virus attaches file requires host Worm standalone self-replicates spreads network Trojan disguises useful but malicious Spyware spies collects secretly Ransomware encrypts demands ransom Rootkit hides evade detection maintain control Difference Virus needs host worm standalone Trojan disguises Attacks DoS flood overwhelm outage DDoS many devices botnet flood Buffer Overflow overwrite memory execute code Man-in-the-Middle intercept relay between parties Phishing fake emails SQL Injection inject SQL XSS inject script Encryption Symmetric same key DES 56-bit old AES 128/192/256 modern fast same key encrypt decrypt Need secure channel C=Encrypt(K,P) P=Decrypt(K,C) same K Asymmetric public private key RSA slow public encrypt private decrypt digital signature private encrypt public decrypt Two uses Public encrypt private decrypt confidentiality Alice encrypts with Bob's public Bob decrypts private Private encrypt public decrypt = Digital signature authenticity non-repudiation Alice signs private Bob verifies public Key distribution symmetric need secure channel asymmetric public can be shared openly but need verify via certificates Symmetric fast Asymmetric slow hybrid Asymmetric to exchange symmetric key then symmetric for data fast TLS HTTPS hybrid RSA/AES Authentication passwords hashed salt hash(salt+password) salt random prevents rainbow table login hash entered with stored salt compare OTP One-time valid once short time SMS TOTP Biometrics fingerprint iris face something you are MFA something you know password + something you have phone OTP + something you are biometrics at least 2 factors more secure Firewalls packet filter IP port stateless simple fast stateful keeps connection state tracks TCP more secure application gateway proxy application layer HTTP proxy Filters between internal external allow/deny IDS NIDS Network monitors network HIDS Host monitors host anomaly baseline deviation may false positives signature known patterns low false positive cannot detect new IDS detects IPS blocks Digital Signature Hash then encrypt hash with private key signature=Encrypt(private_key,hash(message)) Receiver decrypts with public compares hash verifies integrity authenticity non-repudiation CA Certificate Authority trusted third party signs certificate binding public key to identity Certificate=public key+identity+CA signature Browser has CA public keys pre-installed verifies server PKI Public Key Infrastructure Protection vs Security Protection internal Access Matrix ACL Capability internal who can access what inside OS Security external CIA outside attackers malware external both needed DSSSB 6 marks fixed! Unit 5 Complete!

Topper Revision 1 Page = Full Chapter • Unit 5 Final

I/O Systems

I/O Subsystem User process → kernel I/O subsystem → device driver → device controller → device Kernel scheduling buffering caching spooling reservation | Programmed I/O polling CPU polls status register busy waiting waste CPU inefficient for slow CPU High polling Efficiency Low Hardware Simple | Interrupt-driven I/O CPU does other work device interrupts when ready ISR CPU saves context jumps to ISR handles returns efficient CPU not wasting Needs interrupt controller overhead context switch CPU Low Efficiency Medium Hardware Interrupt controller ISR | DMA Direct Memory Access controller transfers directly memory without CPU CPU programs DMA source destination count CPU free DMA device↔memory directly cycle stealing when done interrupts transfer complete CPU Minimal Efficiency High Hardware DMA controller Needs DMA controller | Blocking waits until I/O complete suspended Non-blocking continues returns immediately

Protection

ConceptDefinitionExample
Access MatrixModel defines protection rights for each (domain, object) pair Rows=Domains Columns=Objects Cells=Rights rwx Domain=process user Object=file device Each cell=rights domain has on object Abstract sparse ACL or Capability implementationDomains\Objects file device process rwx rx user r rw Domain process user Object file device Each cell rights
ACLAccess Control List Column-wise list of domains & rights for each object Stored with object Easier who can access file Who can access this file? quickly Used Unix Linux Windows ACL entry domain:rightsfile→{process:r,w,x; user:r} means process can rwx file user only r
Capability ListRow-wise list of objects & rights for each domain Stored with domain Like ticket/token held by domain must present capability Easier what domain can access What can this process access? quickly Capability-based systemsprocess→{file:r,w,x; device:r,x} means process has rights rwx on file rx on device
RevocationACL→remove domain from object's list→easy just delete entry Capability→must reclaim capability from domain→harder need to find and remove search all domains ACL easier Capability harderACL easy Capability hard
Least PrivilegeGive each domain only minimum rights it needs to function Limits damage if compromised attacker gets only limited rights not allWeb browser needs network read but not write to system files give only network read
Protection RingsRing 0 kernel highest privilege OS/kernel runs here can execute all privileged instructions access all memory Ring 1,2 device drivers services intermediate Ring 3 user lowest privilege user applications run here cannot execute privileged instructions must syscall to kernel Goal enforce isolation control access safely hardware supportIntel x86 4 rings 0-3 ARM exception levels

Security

CIAMeaningProtection
ConfidentialityKeep data secret only authorized access no unauthorized disclosureEncryption
IntegrityData remains accurate not altered or tampered no unauthorized modificationChecksum hash
AvailabilitySystem & data accessible when needed no denial of serviceRedundancy
AuthenticationVerify identity are you who you claim?Passwords biometrics
Non-repudiationSender cannot deny having sent it proof of originDigital signatures
Threat→ GoalExample
Interruptionavailability service disrupted or stoppedDoS cuts network destroys file system
Interceptionconfidentiality data eavesdropped/sniffed unauthorized accessWiretapping sniffing passwords
Modificationintegrity data altered/changed unauthorized modificationTampering database changing values
Fabricationauthenticity fake data/message introducedFake transactions fake identity
MalwareHowNeeds Host?
VirusAttaches to a file requires host to run cannot run alone replicates when host executed attaches to .exeYes needs host file
WormStandalone self-replicates spreads across network no host needed exploits vulnerabilities Morris wormNo standalone
TrojanDisguises as useful program but is malicious pretends game but installs backdoor fake antivirusDisguises
SpywareSpies on user collects activity/data secretly keylogger screen capture browsing historySecret
RansomwareEncrypts files demands ransom payment to decrypt WannaCry CryptoLockerEncrypts
RootkitHides itself to evade detection & maintain control hides files processes maintains backdoorHides
AttackHowEffect
DoSDenial of Service flood→overwhelm target Single machine floods with requests SYN flood ping floodOverwhelm target cause outage target cannot serve legitimate users
DDoSDistributed Denial of Service many devices/botnet flood target Many compromised devices botnet floodHarder to block many sources Mirai botnet
Buffer OverflowExploit to overwrite memory beyond buffer boundary strcpy without bounds check overwrites return address jumps to shellcodeOverwrite memory execute code
Man-in-the-MiddleIntercept/relay communications between parties eavesdrop and possibly modify attacker sits between client and server client thinks talking to server server thinks talking to client attacker interceptsEavesdrop modify
OtherPhishing fake emails to steal credentials SQL Injection inject SQL via input to manipulate database XSS Cross-Site Scripting inject script into web pageSteal credentials manipulate database inject script

Security Mechanisms

MechanismHowExample
Symmetric EncryptionSame key DES 56-bit old insecure AES 128/192/256-bit modern fast same key encrypt decrypt fast efficient bulk data need secure channel to share key key distribution problem if attacker intercepts key can decrypt C=Encrypt(K,P) P=Decrypt(K,C) same KDES AES symmetric block ciphers AES 128/192/256
Asymmetric EncryptionPublic private key RSA slow public private key pair slow but solves key distribution public key shared openly private key secret Two uses Public encrypt private decrypt confidentiality Sender encrypts with receiver's public only receiver private can decrypt Alice to Bob Alice encrypts with Bob's public Bob decrypts private Private encrypt public decrypt = Digital signature authenticity non-repudiation Sender encrypts own private anyone with sender's public can decrypt verifies sender authenticity non-repudiation Alice signs with private Bob verifies with Alice's public proves from Alice not tamperedRSA Diffie-Hellman key exchange
Key DistributionSymmetric need secure channel to share key Asymmetric public can be shared openly no secure channel needed for public key but need to verify public key belongs to correct person via certificatesSymmetric need secure Asymmetric public can be shared
SpeedSymmetric fast Asymmetric slow hybrid uses both Asymmetric to exchange symmetric session key securely then symmetric for bulk data fast TLS HTTPS hybrid RSA/AESHybrid TLS HTTPS RSA/AES
PasswordsNot stored plain store hashed with salt hash(salt+password) salt random per user prevents rainbow table attack On login hash entered password with stored salt compare with stored hash Example password hello salt x5 store hash(x5+hello)hash(salt+password) salt random prevents rainbow table
OTPOne-time passwords valid only once or short time SMS OTP TOTP time-basedSMS OTP TOTP
BiometricsFingerprint iris face recognition something you areFingerprint iris face
MFAMulti-factor Combine something you know password + something you have phone OTP token + something you are biometrics at least 2 factors more secure than single factor Example Password know + phone OTP have + fingerprint are = 3-factorPassword know + phone OTP have + fingerprint are = 3-factor
FirewallsPacket filter filters IP port protocol stateless simple fast Stateful keeps connection state tracks TCP connections more secure Application gateway proxy firewall application layer e.g., HTTP proxy understands HTTP Firewall sits between internal and external filters traffic based on rules allow/denyPacket filter IP port stateless Stateful tracks TCP Application gateway proxy HTTP proxy
IDSNIDS Network IDS monitors network traffic detects intrusions network-wide HIDS Host IDS monitors host system logs files processes detects intrusions on single host Anomaly detection baseline normal behavior detects deviation may false positives Signature detection known attack patterns signatures detects known attacks low false positive cannot detect new attacks IDS detects IPS Intrusion Prevention System blocks as well as detectsNIDS Network HIDS Host Anomaly baseline deviation may false positives Signature known patterns low false positive cannot detect new IDS detects IPS blocks
Digital SignatureHash message then encrypt hash with sender's private key signature=Encrypt(private_key,hash(message)) Receiver decrypts signature with sender's public key and compares hash verifies integrity and authenticity non-repudiationsignature=Encrypt(private_key,hash(message)) Receiver decrypts with public compares hash
CACertificate Authority trusted third party signs certificate binding public key to identity Certificate=public key+identity+CA signature Browser has CA public keys pre-installed verifies server certificate PKI Public Key Infrastructure system for managing certificatesCertificate=public key+identity+CA signature Browser has CA public keys pre-installed PKI
Protection vs SecurityProtection controls access inside system Access Matrix ACL Capability internal access control who can access what inside OS Security protects from external threats CIA triad outside attackers malware network attacks external both neededProtection internal Access Matrix ACL Capability Security external CIA outside attackers malware

PYQ Traps Unit 5 Final:
• I/O Subsystem User→kernel I/O→device driver→device controller→device Kernel scheduling buffering caching spooling reservation
• Programmed I/O polling CPU polls status register busy waiting waste CPU inefficient for slow CPU High polling Efficiency Low Hardware Simple Fast devices where waiting short
• Interrupt-driven I/O CPU does other work device interrupts when ready ISR CPU saves context jumps to ISR handles returns efficient CPU not wasting Needs interrupt controller overhead context switch per interrupt CPU Low Efficiency Medium Hardware Interrupt controller ISR Most devices moderate speed
• DMA Direct Memory Access controller transfers directly memory without CPU CPU programs DMA source destination count CPU free DMA device↔memory directly cycle stealing when done interrupts transfer complete CPU Minimal Efficiency High Hardware DMA controller Needs DMA controller Bulk disk large data fast Cycle stealing uses memory bus while CPU may need slight slowdown but efficient
• Blocking waits until I/O complete suspended Non-blocking continues returns immediately
• Access Matrix Model defines protection rights for each (domain, object) pair Rows=Domains Columns=Objects Cells=Rights rwx Domain=process user Object=file device Each cell=rights domain has on object Abstract model not stored as matrix sparse implementation via ACL or Capability
• ACL Access Control List Column-wise list of domains & rights for each object Stored with object Example file→{process:r,w,x; user:r} means process can rwx file user only r Easier to list who can access file Who can access this file? quickly Used Unix Linux Windows ACL entry domain:rights
• Capability List Row-wise list of objects & rights for each domain Stored with domain Example process→{file:r,w,x; device:r,x} means process has rights rwx on file rx on device Like ticket/token held by domain must present capability to access Easier to list what objects domain can access What can this process access? quickly Capability-based systems
• ACL vs Capability ACL Column-wise Stored with object Example file→{process:r,w,x; user:r} Easier who can access file Used Unix Linux Windows vs Capability Row-wise Stored with domain Example process→{file:r,w,x; device:r,x} Like ticket/token held by domain Easier what domain can access Capability-based
• Revocation ACL→remove domain from object's list→easy just delete entry from ACL of object Capability→must reclaim capability from domain→harder need to find capability in domain and remove search all domains ACL easier for revocation Capability harder
• Principle of Least Privilege Give each domain only minimum rights it needs to function Limits damage if process compromised attacker gets only limited rights not all Example Web browser needs network read but not write to system files give only network read
• Protection Rings Ring 0 kernel highest privilege OS/kernel runs here can execute all privileged instructions access all memory Ring 1,2 device drivers services intermediate Ring 3 user lowest privilege user applications run here cannot execute privileged instructions must syscall to kernel Goal enforce isolation control access to resources safely hardware support Intel x86 4 rings 0-3 ARM exception levels
• Security Protects from external threats CIA triad outside attackers malware network attacks external
• CIA Triad Confidentiality keep data secret only authorized access no unauthorized disclosure encryption Integrity data remains accurate not altered or tampered no unauthorized modification checksum hash Availability system & data accessible when needed no denial of service redundancy + Authentication verify identity are you who you claim? passwords biometrics + Non-repudiation sender cannot deny having sent it proof of origin digital signatures
• Threats 4 types Interruption→availability service disrupted or stopped e.g., DoS cuts network destroys file system Interception→confidentiality data eavesdropped/sniffed unauthorized access e.g., wiretapping sniffing passwords Modification→integrity data altered/changed unauthorized modification e.g., tampering database changing values Fabrication→authenticity fake data/message introduced e.g., fake transactions fake identity
• Malware Virus attaches to a file requires host to run cannot run alone replicates when host executed attaches to .exe Worm standalone self-replicates spreads across network no host needed exploits vulnerabilities Morris worm Trojan disguises as useful program but is malicious pretends game but installs backdoor fake antivirus Spyware spies on user collects activity/data secretly keylogger screen capture browsing history Ransomware encrypts files demands ransom payment to decrypt WannaCry CryptoLocker Rootkit hides itself to evade detection & maintain control hides files processes maintains backdoor Difference Virus needs host file worm standalone Trojan disguises
• DoS Denial of Service flood→overwhelm target cause outage Single machine floods target with requests SYN flood ping flood target cannot serve legitimate users
• DDoS Distributed Denial of Service many devices/botnet flood target Many compromised devices botnet flood target harder to block many sources Mirai botnet
• Buffer Overflow Exploit to overwrite memory beyond buffer boundary execute malicious code strcpy without bounds check overwrites return address jumps to shellcode
• Man-in-the-Middle Intercept/relay communications between parties eavesdrop and possibly modify attacker sits between client and server client thinks talking to server server thinks talking to client attacker intercepts
• Other attacks Phishing fake emails to steal credentials SQL Injection inject SQL via input to manipulate database XSS Cross-Site Scripting inject script into web page
• Encryption Symmetric same key DES 56-bit old insecure AES 128/192/256-bit modern fast same key encrypt decrypt fast efficient bulk data need secure channel to share key key distribution problem if attacker intercepts key can decrypt C=Encrypt(K,P) P=Decrypt(K,C) same K
• Asymmetric Public private key RSA slow public private key pair slow but solves key distribution public key shared openly private key secret Two uses Public encrypt private decrypt confidentiality Sender encrypts with receiver's public only receiver private can decrypt Alice to Bob Alice encrypts with Bob's public Bob decrypts private Private encrypt public decrypt = Digital signature authenticity non-repudiation Sender encrypts own private anyone with sender's public can decrypt verifies sender authenticity non-repudiation Alice signs with private Bob verifies with Alice's public proves from Alice not tampered
• Key distribution Symmetric need secure channel to share key Asymmetric public can be shared openly no secure channel needed for public key but need to verify public key belongs to correct person via certificates
• Symmetric vs Asymmetric speed Symmetric fast Asymmetric slow hybrid uses both Asymmetric to exchange symmetric session key securely then symmetric for bulk data fast TLS HTTPS hybrid RSA/AES DES AES symmetric block ciphers RSA asymmetric Diffie-Hellman key exchange
• Authentication passwords hashed salt not plain store hashed with salt hash(salt+password) salt random per user prevents rainbow table attack On login hash entered password with stored salt compare with stored hash Example password hello salt x5 store hash(x5+hello)
• OTP One-time passwords valid only once or short time SMS OTP TOTP time-based
• Biometrics Fingerprint iris face recognition something you are
• MFA Multi-factor Combine something you know password + something you have phone OTP token + something you are biometrics at least 2 factors more secure than single factor Example Password know + phone OTP have + fingerprint are = 3-factor
• Firewalls Packet filter filters IP port protocol stateless simple fast Stateful keeps connection state tracks TCP connections more secure Application gateway proxy firewall application layer e.g., HTTP proxy understands HTTP Firewall sits between internal and external filters traffic based on rules allow/deny
• IDS NIDS Network IDS monitors network traffic detects intrusions network-wide HIDS Host IDS monitors host system logs files processes detects intrusions on single host Anomaly detection baseline normal behavior detects deviation may false positives Signature detection known attack patterns signatures detects known attacks low false positive cannot detect new attacks IDS detects IPS Intrusion Prevention System blocks as well as detects
• Digital Signature Hash message then encrypt hash with sender's private key signature=Encrypt(private_key,hash(message)) Receiver decrypts signature with sender's public key and compares hash verifies integrity and authenticity non-repudiation
• CA Certificate Authority trusted third party signs certificate binding public key to identity Certificate=public key+identity+CA signature Browser has CA public keys pre-installed verifies server certificate PKI Public Key Infrastructure system for managing certificates
• PKI Public Key Infrastructure system for managing certificates
• Protection vs Security Protection controls access inside system Access Matrix ACL Capability internal access control who can access what inside OS Security protects from external threats CIA triad outside attackers malware network attacks external both needed
• Difference Virus Worm Trojan Virus needs host file attaches requires host to run Worm standalone self-replicates spreads across network no host needed exploits vulnerabilities Trojan disguises as useful program but is malicious pretends useful but installs backdoor

© 2026 pdcampus.in · All rights reserved. · Made with ❤️ for Indian students.