Project Documentation Preparation
Project Documentation Preparation
Malware Analysis
Cyber Security Incident Response Analyst Track
Malware Analysis
1. Introduction
2. Overview of Malware Types
2.1 viruses
2.2. Worms
2.3. Tojan Horses
2.4. Ransomware
2.5. Spyware
2.6. Adware
2.7. Rootkits
2.8. Backdoors
3. Detection Methods
3.1. Signature-based Detection
3.2. Behavior-based Detection (Anomaly Detection)
3.3. Static Analysis
3.4. Dynamic Analysis
3.5. Reputation-based Detection
3.6. Hybrid Detection
4. Impact Analysis
4.1. System-Level Impact
4.2. Network-Level Impact
4.3. Data Impact
4.4. User Impact
5. Case Studies
5.1. Case Study 1 "DarkComet"
5.2. Case Study 2 "CryptoLocker"
6. Conclusion
SIEM Configuration and Monitoring
Network Overview ......................................................................................
Intro To Elastic Security SIEM .........................................................................
Install and Set Up Elastic Stack ........................................................................
Install and Set Up Elasticsearch................................................................
Install and Setup Kibana ........................................................................
Agent Enrollment ................................................................................
Agentless Devices ................................................................................
Monitoring and Alerting ................................................................................
Integrations: ......................................................................................
Rules and Alerts:..................................................................................
Table of Figures
Figure 1:Netwok Overview ............................................................................................................................................................................................
Figure 2: Firewall Logs ...................................................................................................................................................................................................
Figure 3: Simple Firewall Policy .....................................................................................................................................................................................
Figure 4: Malware Prevention .......................................................................................................................................................................................
Figure 5: Elastic Stack ....................................................................................................................................................................................................
Figure 6: Import PGP Key ..............................................................................................................................................................................................
Figure 7: apt-transport-http package ..........................................................................................................................................................................
Figure 8: Elasticsearch Installation...............................................................................................................................................................................
Figure 9: Elasticsearch Configuration File....................................................................................................................................................................
Figure 10: Elasticsearch.................................................................................................................................................................................................
Figure 11: Kibana Configuration File ............................................................................................................................................................................
Figure 12: Kibana ...........................................................................................................................................................................................................
Figure 13: Agent Enrollment .........................................................................................................................................................................................
Figure 14: API Key Creation...........................................................................................................................................................................................
Figure 15:Agent's Configuration File ............................................................................................................................................................................
Figure 16: Logstash Server............................................................................................................................................................................................
Figure 17: Fleet Agent Logs ...........................................................................................................................................................................................
Figure 18: Agent Logs ....................................................................................................................................................................................................
Figure 19: Logstash........................................................................................................................................................................................................
Figure 20: Output of firewall Conf file...........................................................................................................................................................................
Figure 21: firewall configuration file .............................................................................................................................................................................
Figure 22:Pushing logs ..................................................................................................................................................................................................
Figure 23: Debugging firewall.conf ..............................................................................................................................................................................
Figure 24: Firewall logs ..................................................................................................................................................................................................
Figure 25: Agents and policy .........................................................................................................................................................................................
Figure 26: Rules Installed ..............................................................................................................................................................................................
Figure 27: ATT&CK Coverage........................................................................................................................................................................................
Figure 28: Malware.........................................................................................................................................................................................................
Figure 29: Malware Prevention .....................................................................................................................................................................................
Figure 30: SIEM Alerts ...................................................................................................................................................................................................
Figure 31: Alert Details ..................................................................................................................................................................................................
Prevention Strategy and Training
Introduction
Key Pillars of the Strategy
1. Patch Management and Vulnerability
2. Endpoint Protection
3. Network Segmentation
4. Perimeter Defense (Firewall Intrusion Prevention
5. Secure Email Gateway
6. User Awareness ant Training
7. Access Control and Privilege Management
8. Data Backup and Recovery _
9. Security Information and Event Management (SIEM) _
10. Incident Response Plan _
1. Introducti
Malware is short for "malicious software", it is any software that one intends and
develops to cause damage to the computer, server, client, or network. Some
cybercriminals use malware in attempting to steal sensitive information, gain access
to systems, or disrupt operations.
From simple worms to the complex malware of today, cybersecurity has always been
an evolving area. It is the leading cyber threat after ransomware.
Basically, protection against malware-both for individual users and within whole
organizations-relies on awareness and the sense of responsibility to take proper
security measures regarding systems, platforms, and data in use. Accordingly,
everybody must take proactive steps in this respect, as without such engagement,
one can hardly achieve proper protection.
The following detailed report looks at the analysis of different types of malwares,
their impact on systems and networks, and the methods to detect and avoid them.
3. Detection Methods
Detection methods are crucial for identifying and mitigating malware threats.
Tools:
o ClamAV: Open-source antivirus engine.
o Kaspersky, Norton: Commercial antivirus solutions with extensive signature
databases.
o Virustotal: An online platform that checks files and URLs against multiple
antivirus engines.
How It Works: When a file enters the system, the antivirus scans its code and
compares it against an internal signature database. If the code matches a known
signature, the system flags it as malware and typically isolates or removes the file.
Pros:
o Efficiency: Fast and accurate for identifying well-known malware.
o Low resource usage: Because it simply matches patterns, it requires minimal
system resources.
Cons:
o Inability to detect zero-day threats: Signature-based systems cannot identify
new or unknown malware that doesn’t have a known signature.
o Frequent updates needed: The database must constantly be updated with new
malware signatures, making it reactive rather than proactive.
Tools:
o CrowdStrike Falcon: Monitors real-time behavior and can quickly detect
anomalous activities.
o CylancePROTECT: Focuses on detecting malicious behavior without
needing a signature database.
Pros:
o Effective against zero-day and file-less malware: It can detect unknown
malware based on its actions rather than its code.
o Real-time threat detection: Provides immediate responses to potentially
malicious activities.
Cons:
o False positives: Legitimate software may be flagged as suspicious if it behaves
in an unusual way, leading to unnecessary alerts.
o Resource-intensive: Monitoring the system in real-time can use significant
system resources and impact performance.
Tools:
o IDA Pro: A powerful disassembler that provides deep insights into malware
binaries.
o Radare2: An open-source framework for reverse engineering and analyzing
binary files.
o PEiD: A tool that identifies packers and cryptors used to hide malware.
Pros:
o No risk of execution: Since the file is never run, there’s no risk of infecting
the system during analysis.
o Detailed code inspection: Allows for deep inspection of a file’s code, helping
identify potential threats.
Cons:
o Cannot detect runtime behavior: Some sophisticated malware alters its
behavior during execution (e.g., polymorphic malware), which static analysis
cannot detect.
o Requires expertise: It can be time-consuming and complex, requiring skilled
analysts to perform effectively.
Tools:
o Cuckoo Sandbox: A popular open-source sandbox environment used to
execute and analyze malware in isolation.
o Process Monitor (Sysinternals): A tool for real-time system monitoring of
file, registry, and process activities.
Pros:
o Detects runtime behavior: Can uncover malicious activities that static
analysis might miss, such as dynamic code execution or network attacks.
o Effective against obfuscated malware: Many malware families attempt to
disguise their code, but dynamic analysis can detect their actual behavior
during execution.
Cons:
o Time and resource-intensive: Running files in a sandbox or dynamic
analysis environment requires more system resources and time.
o Evasion techniques: Some malware can detect when it’s being run in a
sandbox and modify its behavior to avoid detection.
Tools:
o Symantec Insight: A reputation-based security tool that assesses files based
on their prevalence and origin.
o Norton Safe Web: Checks URLs for safety by assessing their reputation
against known bad sites.
Pros:
o Quick and lightweight: It doesn’t require in-depth analysis of the file’s
behavior or code and is fast at detecting previously flagged threats.
o Effective against known threats: Ideal for environments that require fast
detection of well-known threats or phishing sites.
Cons:
o Ineffective against brand-new malware: If a file has no history or
reputation, it may not be flagged despite being dangerous.
o Relies on external sources: Requires an up-to-date and reliable reputation
database, often from external sources.
Tools:
o Palo Alto WildFire: Combines static and dynamic analysis, as well as
behavioral detection, to uncover sophisticated threats.
o Bitdefender GravityZone: Employs hybrid techniques like signature-based
scanning, heuristic analysis, and behavior monitoring.
How It Works: A hybrid system first attempts to identify malware using quick
methods, such as signature-based detection. If the file is unknown or shows
suspicious behavior, it will trigger further in-depth analysis using behavioral or
dynamic analysis. The system dynamically switches between methods to maximize
detection rates and minimize system load.
Pros:
o High detection accuracy: Combining multiple techniques allows for both
quick detection of known threats and deep analysis of unknown ones.
o Flexible and adaptive: It can
Flexible and adaptive: It can adapt its detection method based on the nature of the
threat, using different techniques for different malware types.
Cons:
o Resource-intensive: Since it may use multiple methods in tandem, hybrid
detection can be more demanding in terms of processing power and memory.
o Complex to implement: Creating a balanced hybrid detection system
requires expertise to ensure the right combination of techniques and minimize
false positives or system slowdowns.
4. Impact Analysis
Malware impacts the organizations and individuals regarding system performance,
network integrity, data confidentiality, and user experience. Understanding the
impact is essential in developing effective means for prevention and response.
5. Case Studies
5.1. Case Study 1: “DarkComet”
Type: Remote Access Trojan (RAT).
Impact: Enabled attackers to gain
complete control over the victim's
system, allowing for keystroke logging,
screenshot capture, and webcam access.
Static Analysis:
✓ Using tools like "Strings," we can extract hardcoded URLs or suspicious IP
addresses intended for command-and-control (C2).
✓ Disassembling with IDA Pro reveals functions used for process manipulation
and methods for maintaining persistence through registry changes.
Dynamic Analysis:
✓ In a sandbox environment, "DarkComet" connects to its C2 server, transmits
system data, and attempts to disable security measures.
✓ Analyzing network traffic shows encrypted communication over specific
ports.
Consequences: Infected systems were often repurposed into botnets, utilized for
launching distributed denial-of-service (DDoS) attacks or spying on users.
In configuring the firewall, I set up Port 1 to function as the WAN interface and Port 2
as the LAN interface, establishing Port 2 as the gateway for devices within the
network. To enhance security, I created a straightforward profile designed to block
access to the well-known website, https://www.wicar.org/test-
malware.html, effectively preventing the download of malicious files. The alerts and
logs generated from this configuration will be presented in the report, accompanied
by corresponding screenshots for visual reference.
Technically, Elastic SIEM uses a different component to perform its job correctly,
These components are as follows:
• Elasticsearch: The heart of Elastic Stack, Elasticsearch is a distributed,
RESTful search and analytics engine, scalable data store, and vector database
capable of addressing a growing number of use cases. As the heart of the
Elastic Stack, it centrally stores your data for lightning-fast search.
• Kibana: Kibana is a user interface that lets you visualize your
Elasticsearch data and navigate the Elastic Stack.
• Integrations: Like Elastic Agent which is a single, unified way to add
monitoring for logs, metrics, and other types of data to a host.
Logstash, which is a server-side data processing pipeline that ingests
data from a multitude of sources, transforms it, and then sends it to your
favorite "stash."
Beats data shippers that you install as agents on your servers to send
operational data to Elasticsearch.
In this section we will setup and configure each component of Elastic Stack to run
our SIEM.
Then install apt-transport-http package before installation and save the repo
definition to /etc/apt/sources.list.d/elastic-8.x.list and Update.
Now we know that Elasticsearch and Kibana are working well. Next step will be the
installation of the Fleet server and Agents on each machine for logging and
controlling other Endpoints.
Agent Enrollment
The Agent is installed to collect logs from endpoints, while Fleet acts as a
centralized management interface that controls and oversees multiple agents.
This is particularly beneficial for large environments, allowing for streamlined
management rather than manual oversight of each agent.
The commands executed included the necessary configurations for the Fleet,
detailing the Elasticsearch server for communication, the required token for
authentication, and the standard port for the Fleet Server.
Figure 13: Agent Enrollment
Installing the Fleet Agent alone is insufficient for sending logs to Elasticsearch; we
need to verify the configuration file to identify any issues. Upon review, we
discovered that the Fleet Server requires an API Key, along with the username and
password for Elasticsearch.
We proceeded to add the necessary username and password. For the API Key, we
generated it through Kibana by navigating to Management > Stack Management
> API Keys, where we created an API key named fleet-server.
Like how we enrolled the fleet, we will also enroll the other agents on PC-2 and PC-
3. For the desktops that require management, we will select Add Agent, followed by
Enrollment in Fleet. Next, we will download the necessary packages, extract them,
and run the service using the following command:
.\elastic-agent.exe install --url=https://192.168.188.156:8220 --enrollment-
token=SzZEclhaSUJxU3dkNnpyQkFEaF86U0dpSTZIb2lRa1dvQnpZSWF0UDQzUQ== --insecure
Checking each agent and ensure that it sends the logs appropriately from choosing
the agent and then Logs section:
Agentless Devices:
We cannot install agents on certain devices, such as network equipment
including routers, switches, and firewalls.
To ensure effective monitoring of our firewall, we need to collect the logs it
generates and transmit them to Elasticsearch for comprehensive
investigation. To achieve this, we utilized the syslog protocol to push the logs
directly to our Logstash server, which filters, parses, and forwards the logs to
Elasticsearch for further analysis.
The index we created previously (forti-logs*) to store the logs coming from Logstash:
Integrations:
We incorporated several integrations into Agent Policy 1 to enhance our log
collection capabilities.
and shortly after, the EDR detected the threat, removing the file and generating an
alert from Elastic Defender.
By selecting one of the alerts, we can access detailed information about the
incident, including the operating system, host name, malicious process, file path,
and other relevant details.
Overall, this project has successfully laid the groundwork for an effective monitoring
and alerting system, ensuring that we can proactively safeguard our environment
against emerging threats and vulnerabilities.
19 | P a g e
Comprehensive Malware Prevention Strategy
Introduction:
Malware prevention is an essential aspect of cybersecurity, aiming to stop malicious software from
infiltrating and compromising networks, systems, and data. This strategy provides a layered
approach, ensuring security across endpoints, networks, user behavior, and systems. By
addressing prevention at multiple levels, this plan minimizes risk and enhances the ability to detect
and mitigate threats effectively.
Key Pillars of the Strategy:
• Endpoint Protection
• Network Segmentation
Objective:
To ensure that systems are up-to-date and vulnerabilities are identified and addressed proactively.
Detailed Plan:
1. Asset Inventory:
Create an accurate and up-to-date inventory of all systems and software within the network.
This includes:
o Operating Systems (Windows, Linux, macOS)
o Software Applications (Enterprise software, custom applications, etc.)
o Firmware (Routers, switches, and other network appliances)
o Third-party libraries or open-source components
2. Patch Management Schedule:
Establish a patching cadence:
Best Practices:
Objective:
Best Practices:
• Perform daily health checks on endpoint protection solutions to ensure they are
running smoothly.
• Create a centralized dashboard for real-time monitoring of all endpoint
protection activities.
3. Network Segmentation
Objective:
To limit the spread of malware and enhance security by isolating critical network zones
and implementing strict traffic controls between them.
Detailed Plan:
1. Network Segmentation Design:
o Isolate each zone using firewalls or VLANs to prevent lateral movement in the
event of malware infection.
2. Access Control Implementation:
o Network Access Control (NAC): Ensure that only authorized devices are
allowed to access specific network segments.
o ACLs (Access Control Lists): Create rules to restrict communication
between different segments. For example:
▪ Only allow workstations to access the file server on specific ports.
Best Practices:
• Regularly review segmentation policies and firewall rules to ensure they are still
relevant and secure.
• Perform internal penetration tests to validate the effectiveness of network
segmentation and access controls.
Objective:
To monitor and control inbound and outbound traffic, protecting the network perimeter
from malware threats and other intrusions.
Detailed Plan:
Best Practices:
• Conduct regular firewall audits to ensure that all rules and configurations
adhere to security policies.
Objective:
To prevent malware and phishing threats from entering the organization through email channels.
Detailed Plan:
1. Email Filtering:
Deploy a secure email gateway to scan all inbound and outbound emails for malware
and phishing:
o Block attachments with executable content (.exe, .js).
o Use heuristic scanning to identify malicious attachments and links.
o Enable advanced threat protection (ATP) to detect zero-day malware.
2. URL and Link Analysis:
Automatically scan email URLs and rewrite them to pass through a secure web proxy:
o Block known phishing sites and prevent users from clicking on malicious links.
o Use real-time scanning to identify new, previously unknown malicious URLs.
3. Attachment Sandboxing:
o Use this data to refine email filtering rules and improve employee awareness.
Recommended Tools:
Best Practices:
• Regularly review email filtering logs and adjust policies to block newly identified threats.
• Train users on how to recognize phishing and malicious emails (discussed in the
training section below).
Objective:
To educate users on how to identify and avoid malware, phishing attacks, and other threats.
Detailed Plan:
1. Phishing Simulations:
Conduct regular phishing simulations to test users’ ability to recognize malicious emails:
o Track metrics on who falls for phishing attempts and provide them with
targeted training.
o Run at least quarterly phishing tests and increase complexity over time (e.g.,
using spear-phishing scenarios).
2. Regular Security Training:
Organize mandatory security awareness sessions to educate employees on the following:
Best Practices:
• Use metrics from phishing simulations to measure improvement in user behavior over time.
Objective:
To prevent unauthorized users from accessing critical systems and data, minimizing the
risk of malware spread due to compromised accounts.
Detailed Plan:
o Ensure that all users, processes, and systems are granted the minimum
access necessary to perform their tasks.
o Regularly review and adjust user privileges to ensure no excessive access is granted.
o Implement MFA for all critical systems, especially for administrators and
privileged users.
o Use MFA for remote access systems, VPNs, and email to prevent
unauthorized access due to stolen credentials.
3. Privileged Access Management (PAM):
Best Practices:
• Conduct regular audits of user privileges to identify and remove any excess permissions.
• Monitor all privileged account activities using a centralized dashboard for tracking.
Objective:
To ensure that data is securely backed up and can be restored quickly in the event of a
ransomware or malware attack.
Detailed Plan:
1. Backup Strategy:
Best Practices:
• Follow the 3-2-1 backup rule: 3 copies of data, 2 different storage types, 1 offsite backup.
(SIEM) Objective:
To provide centralized monitoring and alerting for all security events across the network,
allowing for real-time detection of potential malware threats.
Detailed Plan:
1. SIEM Deployment:
Best Practices:
• Regularly review and update SIEM detection rules to account for emerging threats.
Plan Objective:
To provide a structured approach for handling malware incidents quickly and effectively to
minimize damage and recover systems.
Detailed Plan:
o Contain the spread: Isolate infected systems from the network to prevent
further malware propagation.
o Remove malware: Use endpoint protection and specialized tools to clean
the malware from infected systems.
3. Recovery:
Best Practices:
• Update incident response playbooks regularly to reflect new malware tactics and
attack vectors.
• Train the incident response team on how to handle various types of malware
threats (ransomware, Trojans, worms).
User Awareness Materials:
1. Videos:
2. Infographics:
✓ Malware at a Glance:
https://infograph.venngage.com/pl/qITivENl1CE
3. Awareness Game:
4. Presentation:
✓ Presentation Link:
https://app.presentations.ai/view/8GmwjI