📌 Snapshot
- Network security decoded: malware types, antivirus, firewalls, HTTPS, cookies, hackers and network attacks.
- Virus, worm, Trojan, ransomware, spyware, adware and keylogger separated by how they spread and what they want.
- How signature, sandbox, heuristic and real time detection work, and why a firewall is the first barrier.
- Hat colours of hackers, DoS versus DDoS, and snooping versus eavesdropping, the pairs NTA loves to swap.
📖 Detailed Notes
Written and reviewed by Rohit Singh, Computer Science & Commerce faculty at UniDrill (MCA, Osmania University · 6 years teaching). Based on NCERT Computer Science Class XII, Chapter 12.
Why is a computer that never connects to anything the safest one?
A computer with no link to any other device or network cannot be attacked through a network, and a computer with no link is also not very useful. The world is moving towards full connectivity, so we cannot hide our devices from the network. We have to defend them instead. Network security is the protection of a device and its data from illegitimate access or misuse. A threat is any way to exploit a weakness (vulnerability) in a network or communication system to cause harm or damage someone's reputation.
This chapter follows one story: the attackers (malware, hackers, network attacks) and the defenders (antivirus, firewalls, HTTPS, careful habits).
Malware: the seven names to separate
Malware is short for MALicious softWARE. It is any software built to damage hardware, steal data or cause other trouble to the user. The same few questions separate all the types: does it need a host file, does it spread on its own, and what does it want?
| Malware | Needs a host program? | How it spreads | What it wants |
|---|---|---|---|
| Virus | Yes. It inserts its code into executable files | Needs human triggering: it stays dormant until the infected file is opened | Steal passwords or data, corrupt files, spam your contacts, take control of the machine |
| Worm | No. A standalone program | Replicates on its own and spreads through the network | Unexpected or damaging behaviour on the infected system |
| Trojan | No, it poses as a legitimate program | Does not copy itself or infect files. The user is tricked into installing it, for example by opening an attachment or running a downloaded file | Acts like a virus or worm once installed. May open a backdoor for others |
| Ransomware | Not applicable | Arrives like any malware | Blocks or encrypts the user's data, or threatens to publish it, and demands a ransom |
| Spyware | Not applicable | Installed without the user's knowledge | Secretly records and sends information: internet usage, card and bank details, passwords |
| Adware | Not applicable | Displayed through pop ups, web pages or installation screens | Earns revenue for its creator by showing ads or pay per click. Usually annoying but harmless, yet it can lead to other malware through unsafe links |
| Keylogger | Software or hardware | Installed secretly | Records every key pressed, which reveals passwords, emails and private chats |
Some facts attached to each name are frequent exam questions. The term computer virus was coined by Fred Cohen in 1985. Well known viruses include CryptoLocker, ILOVEYOU, MyDoom, Sasser, Netsky, Slammer and Stuxnet. Example worms are Storm Worm, Sobig, MSBlast, Code Red, Nimda and the Morris Worm. The ransomware WannaCry infected almost 200,000 computers in 150 countries in May 2017, encrypting data and demanding payment in Bitcoin. A Trojan is named after the wooden horse of ancient Troy: it looks like a gift but hides soldiers inside.
Worked example: name the malware. Read each case and decide which malware it is.
| Case | Clue | Malware |
|---|---|---|
| A free game from a website installs, and later someone gets remote access. The game never copies itself | Looks legitimate, no self replication, backdoor | Trojan |
| A program travels across a school LAN and appears on 40 computers overnight. Nobody opened any file | Spreads on its own, standalone | Worm |
| A student plugs in a pen drive. After a teacher opens a document from it, other files become infected | Attached to a file, triggered by a human opening it | Virus |
| All files are locked, and a message asks for payment in cryptocurrency | Blocks data and demands ransom | Ransomware |
| A free toolbar quietly sends the websites you visit to an advertiser | Gathers information without consent | Spyware |
| Pop ups appear on every page, and one of them leads to a fake download | Shows ads, paves the way for other malware | Adware |
The common wrong answer in the first case is virus. A virus would copy itself into other files, and this program does not.
Pause and predict: A program replicates and spreads to other computers through the network, but the user never opened any infected file. Is it a virus or a worm?
Check your answer: A worm. A virus needs a human to open or run an infected file, while a worm replicates on its own and does not need a host.
Keyloggers and the virtual keyboard. A keylogger can be software, or a hardware device such as a thin transparent keyboard placed over the real one. If you must sign in on an unknown computer, use an online virtual keyboard. It helps because the layout changes each time, so a keylogger cannot easily work out which key was pressed.
| Feature | On screen keyboard | Online virtual keyboard |
|---|---|---|
| What it is | A software keyboard of the operating system | A web based or standalone software keyboard |
| Key layout | Fixed QWERTY layout | Randomised every time it is used |
| Against keyloggers | Weak, the fixed layout can be exploited by sophisticated keylogger software | Safer, the layout changes so recorded positions are useless |
How malware reaches you, and the signs
| Route | Example |
|---|---|
| Downloaded from the Internet | Disguised files, especially "free stuff" |
| Spam email | Unsolicited emails with hyperlinks or attachments |
| Removable storage | Pen drives, memory cards, music players and phones carry replicating malware to other systems |
| Network propagation | Worms moving from one computer to another over a network connection |
Signs of infection include repeated pop ups asking you to visit a site or download software, a changed browser homepage, mass emails sent from your account, a slow computer that crashes, unknown programs starting at boot, programs opening and closing by themselves, sudden loss of storage space, and programs or files appearing or disappearing.
Prevention is a habit list. Use antivirus and keep it updated, apply software updates and patches, configure browser security, take regular backups, use a firewall, never use pirated software (choose Free and Open Source Software instead), scan removable drives before copying, avoid clicking links or attachments from unsolicited emails, and avoid typing sensitive data on unknown computers or public Wi-Fi. Look for the lock icon in the address bar while paying online. Never install an "antivirus" offered in a pop up. Close such an ad with the X icon at the top right and not with the "close" button inside it, and cancel the installation straight away if it has begun.
Antivirus: five ways to catch malware
An antivirus (also called anti-malware) was first built to find and remove viruses, and now prevents, detects and removes many kinds of malware.
| Method | How it works | Strength | Weakness |
|---|---|---|---|
| Signature based detection | Compares files with a database of virus signatures, the Virus Definition File (VDF), updated continuously | Fast and reliable for known malware | Useless with an outdated VDF. Misses polymorphic malware (changes its signature) and malware with an encrypted portion |
| Sandbox detection | Runs a new file in a virtual environment and watches its behaviour | Very safe, since the file cannot reach the real resources | A little slow |
| Data mining techniques | Machine learning and data mining classify a file's behaviour as benign or malicious | Can judge unknown files | Depends on training |
| Heuristics | Compares the source code of a suspect program with known viruses in a heuristic database. If most of the code matches, it is marked as a possible threat | Spots variants of known malware | Needs a match with known patterns |
| Real time protection | Keeps running in the background and watches programs while they run in main memory | Catches malware that stays dormant and wakes later | Constantly uses resources |
A virus signature is a consecutive sequence of bytes found in a certain malware sample. It sits inside the malware or infected file and not in clean files.
Pause and predict: Your antivirus has not updated for two years. Why is it almost as bad as having none?
Check your answer: Its signature database (VDF) does not contain the signatures of new malware, so new malware passes unnoticed.
Beyond the textbook. For the exam: learn the five methods and the line "an antivirus with an outdated VDF is as good as no antivirus". In reality: because attackers change their code constantly, modern products combine all these methods. A signature catches the known, a sandbox or behaviour check catches the strange, and updates keep the databases current.
Spam, HTTP and HTTPS
Spam is unwanted data, an email, a message or an advertisement. The best known form is email spam: a mailing list of addresses receives repeated advertisement links and invitations that clutter the inbox and often trick people into buying something or downloading malware. Email services have automatic spam filters, and you can mark a message as spam so that it stops arriving in the inbox.
HTTP and HTTPS are both protocols for how data moves over the World Wide Web between browser and server.
| Feature | HTTP | HTTPS |
|---|---|---|
| Full form | HyperText Transfer Protocol | HyperText Transfer Protocol Secure |
| Data on the network | Sent as it is, not scrambled | Encrypted before sending, decrypted at the receiver |
| Risk | Open to attack by hackers | Safe against eavesdroppers on the line |
| Needs | Nothing special | An SSL digital certificate |
| Suitable for | Public information: news portals, blogs | Banking, passwords, personal information |
Beyond the textbook. For the exam: HTTPS needs an SSL digital certificate and encrypts data. In reality: the modern secure layer is called TLS, the successor of SSL, though the certificate is still commonly called an SSL certificate. Also, the padlock only says that the connection is encrypted. It does not prove the website is honest, so you still need to check the address carefully.
Firewall: the first barrier
A firewall is a network security system that protects a trusted private network from unauthorised access or traffic from an untrusted outside network such as the Internet. It can be software, hardware or both. It works as a network filter: using predefined security rules, it watches and controls incoming and outgoing traffic. For example, a school firewall can allow the accountant to reach the finance server but stop students from reaching it. Because worms travel across networks, the firewall acts as the first barrier against them.
| Type | Placed | Monitors |
|---|---|---|
| Network firewall | Between two or more networks | Traffic between those networks |
| Host based firewall | On a single computer | Traffic to and from that computer |
Cookies
A cookie is a small file or data packet stored on the client's computer by a website. The name comes from the "magic cookie", a packet of data that a program receives and sends back unchanged. A cookie is edited only by the website that created it, and the user's computer is only the host that stores it. Cookies keep browsing information, such as the items in a shopping cart, login details, language preference or recently viewed pages.
| Type | Job |
|---|---|
| Session cookie | Tracks the current session and ends it after a time out, as in banking sites |
| Authentication cookie | Checks whether you have already logged in, so you do not log in on every page |
| Auto fill cookie | Fills your name, address and date of birth in forms automatically |
Normally cookies do not infect a computer. The risks are special kinds: supercookies (some malware disguises as these), zombie cookies (recreated after being deleted) and third party cookies (share your data for advertising or tracking, such as showing ads for an item you searched earlier). So be careful when you allow a site to store cookies.
Hackers and crackers
Hackers are people with deep knowledge of computer systems, operating systems, networks and programming. They use it to find loopholes and weaknesses. What separates them is intent.
| Type | Intent | Role |
|---|---|---|
| White hat (ethical hacker) | Finds and helps fix security flaws | Security expert, hired by organisations, works against black hats |
| Black hat (cracker) | Uses knowledge unethically to break the law and exploit flaws | Disrupts security |
| Grey hat | Neutral. Hacks by exploiting vulnerabilities but not for money or political gain | Treats security as a challenge and hacks for fun |
A hacktivist is a hacker who aims to bring about political and social change.
Beyond the textbook. For the exam: a grey hat is neutral and hacks for fun. In reality: entering a system without permission is an offence under cyber law whatever the intention is. What makes the work of a white hat acceptable is that the owner has authorised the testing.
Network security threats
Denial of Service (DoS). An attacker stops authorised users from reaching a service by overloading it with illegitimate requests, for example by flooding a web server with packets from different IP addresses until it cannot serve genuine users. A server crash can be recovered by a restart, but flooding is hard to recover from because genuine requests are mixed in.
Distributed Denial of Service (DDoS). The flood comes from many compromised computers, called zombies, spread across the world. The attacker installs a malicious program called a bot on each, and the whole network of zombies is a botnet.
| Feature | DoS | DDoS |
|---|---|---|
| Source of requests | Usually one source | Many distributed zombie computers (a botnet) |
| Defence | Block the packets from that one source | Very hard, as the attack comes from many places |
Intrusion problems. Network intrusion is any unauthorised activity on a network. Besides DoS, Trojans and worms, three more attacks are listed.
| Attack | What the attacker does |
|---|---|
| Asymmetric routing | Sends the intrusion packets through multiple paths to bypass the network intrusion sensors |
| Buffer overflow | Overwrites memory areas with commands that run when a programming error (buffer overflow) occurs, which can start a DoS attack or give access to the network |
| Traffic flooding | Floods the intrusion detection system with packets, so it cannot monitor properly, and slips in during the chaos |
Snooping and eavesdropping. Snooping (also called sniffing) is the secret capture and analysis of network traffic by a program or utility with traffic monitoring capability. The packets are copied and put back, as if nothing happened. If data is not encrypted, it is exposed. Network administrators also use snooping for troubleshooting, and hubs or switches may have a SPAN (Sniffer Port Analyser) port for it. Eavesdropping is the unauthorised real time interception of a private communication, such as phone calls (VoIP), instant messages, video conferences or fax. On old phone lines it was called wiretapping. A laptop or phone with a built in microphone or camera can be hacked using rootkit malware.
| Feature | Snooping | Eavesdropping |
|---|---|---|
| Timing | Traffic can be stored and analysed later | Real time |
| Target | Network traffic in general | Private conversations between two parties |
| Everyday picture | Copying a letter meant for your friend and sending the original on | A hidden microphone or standing under the window |
| Always an attack? | No, administrators use it for troubleshooting | Unauthorised interception |
Exam traps
| Trap | Why it is tempting | Truth |
|---|---|---|
| A worm needs a host file | Viruses do | A worm is standalone and spreads on its own |
| A Trojan copies itself | It acts like a virus | A Trojan does not self replicate. The user installs it |
| Adware is as harmful as ransomware | Both are unwanted | Adware is usually annoying but harmless, though it can lead to other malware |
| The on screen keyboard stops keyloggers | It is software and not the real keyboard | It has a fixed QWERTY layout. The online virtual keyboard randomises the layout |
| HTTPS and HTTP both encrypt | The names are similar | Only HTTPS encrypts, and it needs an SSL digital certificate |
| DoS and DDoS are the same | Both overload a target | DDoS comes from many zombie computers and is much harder to stop |
| Snooping and eavesdropping are the same | Both listen in secretly | Eavesdropping is real time, snooping can be stored and analysed later |
| All hackers are criminals | Hacking sounds illegal | White hats are hired experts, grey hats are neutral, black hats are crackers |
60-second revision
| Topic | Key facts |
|---|---|
| Malware | Virus (host file, human trigger), worm (standalone, self spreading), Trojan (disguised, no copying), ransomware (data for ransom), spyware (secret spying), adware (ads, revenue), keylogger (records keys) |
| Spread | Internet downloads, spam email, removable storage, network |
| Antivirus | Signature (VDF), sandbox, data mining, heuristics, real time |
| Spam | Unwanted email or messages |
| HTTPS | Encrypts, needs SSL certificate |
| Firewall | Filters traffic by rules. Network firewall or host based firewall |
| Cookies | Session, authentication, auto fill. Risks: supercookie, zombie cookie, third party cookie |
| Hackers | White (ethical), black (cracker), grey (fun) |
| Attacks | DoS, DDoS (botnet of zombies), asymmetric routing, buffer overflow, traffic flooding |
| Listening in | Snooping (sniffing) versus eavesdropping (real time) |
Where this chapter connects
| Chapter | Link |
|---|---|
| The protocols and media being attacked and protected | Data Communication |
| LAN, WAN, devices and network layout where firewalls sit | Computer Networks |
| Browsers, email, HTTPS and cookies in daily use | Internet and Web |
| Law, privacy and ethics around cyber crime | Societal Impacts |
🎯 Practice MCQs
First 3 questions free · create a free account to unlock the rest — answers & explanations included, no payment needed
Q1. Which malware spreads through a network on its own and does not need a host program?
▸ Show answer & explanation
Answer: B
A worm is a standalone program that replicates itself and spreads across the network. A virus needs a host file and a human to open it. A Trojan does not replicate at all, and a keylogger records keystrokes.
Q2. A user downloads a free game. It does not copy itself, but it opens a backdoor that gives another person access to the computer. This malware is a
▸ Show answer & explanation
Answer: C
A program that looks like legitimate software, does not self replicate and gives access to others is a Trojan. A worm and a virus both copy themselves, and adware only shows advertisements.
Q3. In May 2017 a malware encrypted data on about 200,000 computers in 150 countries and demanded payment in Bitcoin. Which category does it belong to?
▸ Show answer & explanation
Answer: D
Malware that blocks or encrypts the user's data and demands a ransom is ransomware, and WannaCry is the example. Spyware watches the user, adware shows ads and a keylogger records the keys pressed.
🔒 12 more practice MCQs
Create a free account to unlock every MCQ in this chapter — answers and explanations included. No payment needed.
Already registered? Just log in and they'll all appear here.
Q4. Match List I with List II. List I: (i) spyware (ii) adware (iii) keylogger (iv) ransomware. List II: (p) records keys pressed (q) shows unwanted advertisements to earn revenue (r) secretly collects and sends information to an outsider (s) locks data and demands payment.
▸ Show answer & explanation
Answer: C
Spyware gathers information without consent, adware displays ads for revenue, a keylogger records keystrokes and ransomware demands payment for access to data. The other options mismatch at least two of these.
Q5. Which of the following statements about keyboards and keyloggers are correct? (i) The on screen keyboard of an operating system uses a fixed QWERTY layout. (ii) An online virtual keyboard randomises its layout each time it is used. (iii) A fixed layout is safer against keylogger software. (iv) A keylogger can be a hardware device.
▸ Show answer & explanation
Answer: C
Statements (i), (ii) and (iv) are true. Statement (iii) is false because the fixed layout of the on screen keyboard can be exploited by keylogger software, which is why the randomised virtual keyboard is safer.
Q6. An antivirus runs a new, unknown program inside a virtual environment and observes its behaviour before letting it reach the real system. This method is called
▸ Show answer & explanation
Answer: A
Running a file in an isolated virtual environment to watch its behaviour is sandbox detection. It is slow but safe. Signature based detection compares files against a database, heuristics compares the code with known viruses and real time protection monitors programs during execution in memory.
Q7. Assertion (A): An antivirus with an outdated Virus Definition File is as good as having no antivirus. Reason (R): Signature based detection compares files with the signatures stored in the Virus Definition File.
▸ Show answer & explanation
Answer: A
New malware has signatures that are not in an outdated definition file, so the comparison cannot recognise it and it infects the system undetected. That is why R explains A.
Q8. Which statements about HTTP and HTTPS are correct? (i) HTTP sends data over the network without scrambling it. (ii) HTTPS encrypts data before transmission and decrypts it at the receiver. (iii) HTTPS-based websites need an SSL digital certificate. (iv) HTTP is the better choice for online banking.
▸ Show answer & explanation
Answer: D
Statements (i), (ii) and (iii) are correct. Statement (iv) is wrong because HTTP leaves data readable and is suitable for public information such as news and blogs, while banking needs HTTPS.
Q9. A firewall installed on a single computer, monitoring only the traffic to and from that computer, is called a
▸ Show answer & explanation
Answer: D
A firewall placed on one computer is host based. A network firewall sits between two or more networks. An antivirus is a different kind of software, and a session cookie is a small file kept by a website.
Q10. Which statement about cookies is correct?
▸ Show answer & explanation
Answer: B
Cookies are small files or data packets that a website stores on the client's computer, and only the website that created a cookie edits it. Normally they do not infect the computer, so they are not viruses.
Q11. A company hires a security expert who is permitted to test its network and report weaknesses so that they can be fixed. This expert is a
▸ Show answer & explanation
Answer: A
A hacker who uses skill to find and help fix flaws, with the owner's permission, is a white hat or ethical hacker. Black hats, also called crackers, break the law, and grey hats hack for fun without the owner's approval.
Q12. An attacker installs bots on thousands of compromised computers across the world and uses this botnet to flood a website with requests. This attack is
▸ Show answer & explanation
Answer: B
Flooding a target from many compromised computers (zombies) controlled through bots is a DDoS attack. Snooping and eavesdropping are about listening to traffic, and a simple DoS comes from one source that can be blocked.
Q13. A hacker secretly intercepts a private VoIP call between two people while the conversation is happening. This is
▸ Show answer & explanation
Answer: B
Unauthorised real time interception of private communication is eavesdropping. Snooping captures traffic that can be analysed later. Buffer overflow and traffic flooding are intrusion attacks and not ways of listening to a call.
Q14. Assertion (A): A Trojan spreads by copying itself into other files. Reason (R): A Trojan looks like a legitimate program.
▸ Show answer & explanation
Answer: D
A Trojan does not self replicate or infect other files. It spreads when users install it, for example by opening an attachment, so A is false. It does disguise itself as legitimate software, so R is true.
Q15. An attacker floods the network intrusion detection system with packets so that it can no longer monitor the traffic properly, and then slips into the network. This attack is called
▸ Show answer & explanation
Answer: D
Overloading the intrusion detection system with packets so that it cannot monitor properly is traffic flooding. Asymmetric routing sends packets along several paths to avoid sensors. A buffer overflow overwrites memory with code, and eavesdropping is listening to communication.
📊 Previous-Year Questions
Practise with real CUET Computer Science previous-year papers — every question solved, with the correct answer and a step-by-step explanation.
View solved CUET PYQ papers →Ready to drill Computer Science?
Unlock all MCQs, chapter tests, mocks & PYQs for ₹199/year.
Get UniDrill Pro