7 Malicious Logic

Cryptography · Unit 7 · 3 hrs

Malicious Logic

Exam-focused notes for Malicious Logic (Cryptography, CSC327): what the TU syllabus asks and how it has actually been tested, with 7 solved past questions from this unit.

Malicious Logic in short

The final unit turns from protecting data in transit to protecting the systems that store and process it, covering the software threats that try to subvert a system from within and the intruders and detection systems that try to catch them.

Malicious Logic: notes

Malicious Logic and Types of Malicious Logic

Malicious logic (malware) is a set of instructions inserted into a system specifically to violate its security policy, exploiting vulnerabilities to damage, disable, or misuse it; it is generally the most sophisticated class of threat a computer system faces, precisely because it runs with whatever privileges the software it infects already has. Malware splits into two categories by how it runs: independent malware is a self-contained program that the operating system can schedule and run on its own (worms, zombies), while malware that needs a host program consists of code fragments that cannot exist or execute apart from some other legitimate application, utility, or system program (viruses, Trojan horses, logic bombs, backdoors).

A virus is a program that inserts a copy of itself into one or more other files and then carries out some further action, potentially damaging hardware, software, or data. A virus's life cycle has four phases: the dormant phase, where it sits idle waiting for a triggering event; the propagation phase, where it inserts identical copies of itself into other programs or areas of disk; the triggering phase, where a specific condition activates it; and the execution phase, where it actually carries out its payload, from a harmless on-screen message to destructive damage to programs and data. Viruses are further classified by how they spread or hide: a parasitic virus attaches to executable files and activates when the infected program runs; a memory-resident virus stays resident in main memory and infects every program that subsequently executes; a boot sector virus infects a disk's boot record and spreads whenever the system boots from that infected disk; a stealth virus is explicitly built to hide its presence from antivirus software; and a polymorphic virus mutates its own code on every infection, so no two copies look identical, making signature-based detection far harder.

What this unit covers

  • Malicious Logic
  • Types of Malicious Logic: Virus, Worm, Trojan Horse, Zombies, Denial of Service Attacks
  • Intrusion
  • Intruders and their types
  • Intrusion Detection System

Types of Malicious Logic

2082 · 5 marks

Describe any three types of malicious logic. [5]

Show solved answer

Malicious Logic


Malicious Logic (Malicious Code / Rogue Programs)

Malicious logic refers to a set of instructions or programs that are intentionally designed to cause harm, unauthorized access, or disruption to a computer system or network.


1. Trojan Horse

A Trojan Horse is a program that appears to perform a legitimate or useful function but secretly contains hidden code that performs unauthorized or harmful actions when executed.

  • It does not replicate itself (unlike a virus).
  • It tricks the user into running it by disguising itself as a legitimate program.
  • Example: A user downloads what appears to be a free game, but the program secretly installs a backdoor, allowing an attacker to gain remote access to the system.
  • Damage: Data theft, unauthorized access, system damage.

2. Virus

A virus is a piece of malicious code that attaches itself to a legitimate program or file and replicates when that program is executed. It requires a host program to spread.

  • It can spread from one computer to another through infected files, email attachments, or removable media.
  • A virus typically has two phases:
    • Infection phase: It attaches itself to other programs.
    • Attack phase: It performs its malicious activity (deleting files, corrupting data, etc.).
  • Example: A virus attached to a .exe file that corrupts system files when executed.
  • Damage: File corruption, system crashes, data loss.

3. Worm

A worm is a self-contained, self-replicating program that spreads across networks without needing to attach itself to a host program. Unlike a virus, it does not require user interaction to propagate.

  • It exploits vulnerabilities in operating systems or network services to spread automatically.
  • Worms consume network bandwidth and system resources, causing slowdowns or crashes.
  • Example: The Morris Worm (1988) spread across the Internet by exploiting UNIX vulnerabilities, causing widespread system slowdowns.
  • Damage: Network congestion, system resource exhaustion, data theft.

Summary Table

TypeReplicates?Needs Host?Spreads Via
Trojan HorseNoYes (disguise)User deception
VirusYesYes (host file)Infected files/media
WormYesNoNetwork/vulnerabilities

Other types of malicious logic include Logic Bombs (code that triggers under specific conditions) and Trapdoors/Backdoors (hidden entry points left by developers for unauthorized access).

Open this answer on its own page →

2079 · 5 marks

Differentiate between Trojan horse and virus. Describe any two types of intruders. [5]

--- Basis Trojan Horse Virus --------- Definition A program with a known (legitimate) look but an unwanted/hidden effect. It performs a desired task but also performs unexpected functions. A self-replicating malicious program that attaches itself to files and spreads when executed. Self-Replicati...

Open this answer on its own page →

2076 · 5 marks

How does the nature of worms differ from viruses? Define PKI with its architecture model. [5]

--- Feature Virus Worm --------- Replication Attaches itself to executable files or boot sectors; needs a host program Self-replicating; does not need a host program Propagation Spreads when an infected program is executed by a user Spreads automatically over a network without any user interventi...

Open this answer on its own page →

Intrusion Detection System

2081 · 5 marks

What is intrusion? Explain any two types of intrusion detection system. [5]

Show solved answer

Intrusion and Intrusion Detection Systems

What is Intrusion?

Intrusion detection is the process of identifying and responding to malicious activity targeted at a resource. An intrusion refers to any unauthorized attempt to access, manipulate, or compromise a system's resources, data, or services.

An Intrusion Detection System (IDS) is a system designed to test/analyze network system traffic/events against a given set of parameters and alert/capture data when these thresholds are met. IDS uses collected information and pre-defined knowledge-based systems to reason about the possibility of an intrusion. It also provides services to cope with intrusion such as giving alarms and activating programs to deal with intrusion.


Two Types (Approaches) of Intrusion Detection System

1. Statistical Anomaly Detection

Statistical anomaly detection involves the collection of data relating to the behaviours of legitimate users over a period of time. Then statistical tests are applied to observed behaviour to determine with a high level of confidence whether the behaviour is that of a legitimate user or not.

It falls into two broad categories:

  • Threshold Detection:

    • Involves counting the number of occurrences of a specified event type over an interval of time.
    • If the count exceeds a reasonable number, an intrusion is assumed.
    • Example: Too many failed login attempts within a short time.
  • Profile-Based Anomaly Detection:

    • Focuses on characterizing the past behaviour of individual users or related groups of users.
    • Significant deviations from the established profile are flagged as potential intrusions.

2. Rule-Based Detection

Rule-based detection involves an attempt to define a set of rules that can be used to decide whether a given behaviour is that of an intruder.

It falls into two broad categories:

  • Rule-Based Anomaly Detection:

    • Historical audit records are analyzed to identify usage patterns.
    • Rules are generated automatically to describe those patterns.
    • Any behaviour that deviates from these rules is flagged as suspicious.
  • Rule-Based Penetration Identification:

    • Uses rules for identifying known penetrations or penetrations that would exploit known weaknesses.
    • Rules are typically defined by security experts based on known attack signatures.
    • Example: A rule that detects a specific sequence of commands known to exploit a vulnerability.

Summary Table:

ApproachBasisMethod
Statistical Anomaly DetectionBehaviour deviation from normalThreshold / Profile-based
Rule-Based DetectionPredefined rulesAnomaly rules / Penetration rules
Open this answer on its own page →

2078 · 5 marks

What does intrusion mean? How the system detect intrusion? List any four types of firewall. [5]

Intrusion refers to any unauthorized attempt to access, manipulate, or compromise a computer system, network, or data. It involves a set of actions that attempt to bypass the security mechanisms of a system to gain unauthorized access, steal information, disrupt services, or cause damage. --- An ...

Open this answer on its own page →

Malicious Logic

2080 · 5 marks

What is malicious logic? How zombies are different from trojan horses? [5]

Malicious logic (also called malicious code or malware) refers to any hardware, software, or firmware that is intentionally included or inserted into a system for a harmful or unauthorized purpose. It is a set of instructions that causes a system to perform functions that compromise the security,...

Open this answer on its own page →

Intruders and their types

2076 · 5 marks

Write short notes on: a. Classes of Intruder b. SSL c. DoS Attack [5]

--- An intruder is a person who attempts to gain unauthorized access to a system, to damage that system, or to disturb data on that system. Three classes of intruders are: 1. Masquerader A masquerader is an individual who is not authorized to use the computer and who penetrates a system's access ...

Open this answer on its own page →