Skip to content

Nazgulbunny/Cyber-Security-Portfolio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 

Repository files navigation

Cyber-Security-Portfolio

A Portfolio with all the projects related to cyber-security I have worked on

Google Cybersecurity Professional Certificate On Coursera

Portfolio Activity: Draft a professional statement

A professional statement is an introduction to employers that briefly describes who you are and what you care about. It lets you showcase your cybersecurity interest, work experience, knowledge, skills, and achievements.

Amidst the ever-expanding universe of tech, my presence is a beacon of dedication, knowledge, and passion. With over a decade of hands-on experience, I'm not just another face in the crowd. I'm a seasoned leader, a Group Product Manager, an Enterprise Coach, and a fervent advocate for growth in both personal and professional dimensions. My professional roles transcend mere titles; they resonate with a calling, an unwavering commitment to the evolution of the tech domain.

My expertise is a unique amalgamation of roles in product management, project management, agile practices, and enterprise coaching, Techncal skills like SQL, Linux and programming languages substantiated with a plethora of certifications like PMP, Certified Scrum Product Owner, Certified Scrum Professional, Agile Coach, Certified Scrum Master, and certification in Cybersecurity, among others. And if that wasn’t eclectic enough, I’m also an accredited insurance and reinsurance broker for the Italian market.

Having spearheaded numerous projects, my experience stretches across the video game and casino landscape, e-commerce, delivery services, AI, machine learning, and the realms of finance, encompassing insurance and banking. While leading foundational technical teams, I've emphasised app performance & reliability and release, frontend infrastructure, developer experience, customer identity and security and the intricacies of automation.

Throughout these ventures, collaboration has been my compass. I've had the privilege to synergize with analysts, designers, engineers, data scientists, fellow product and project managers, and the echelons of executive leadership.

A metrics lover at heart, I'm laser-focused on Data and OKRs, developing them to gauge efficacy, success, and vital KPIs. Tracking critical KPIs like DAU, MAU, ARPU, and LTV, product specifications, and mapping out project milestones have all been in a day's work. The foundation of all these endeavours? My unparalleled management and leadership skills. The trust, open communication, and shared knowledge I instil within my teams have always yielded productivity and innovation.

Beyond the world of tech, my quill has often been my voice. I am a published author of two insightful books and an avid writer on Medium. My writings traverse through the intricacies of product management, project management, leadership, coaching, mentoring, and more.

Investment is another arena where I exercise both my analytical prowess and risk-taking appetite. Sharing insights via my eToro portfolio, I relish the thrill of strategic investment. But it doesn't end there. I wear the hat of an advisor, sometimes a consultant, and when the stars align, even a co-founder, fervently supporting startups and young entrepreneurs even as an investor.

Now, stepping aside from the professional spectrum, my heart finds joy in the fantastical realms of role-playing games, board games, and fantasy literature. These passions not only serve as my creative escape but also fuel my professional creativity, adding a unique flavour to all that I do.

Last but not least I enjoy spending time in nature hiking with my dog and doing sport.

At the core of my multifaceted journey, the essence remains consistent: fostering collaboration, nurturing growth, and promoting innovation. Imbued with a spirit of trust, open communication, and shared knowledge, I'm here to make waves, driven by my guiding principle: Listen, learn, innovate, and never give

My core values are deeply rooted in honesty, integrity, and collaboration, principles that guide my professional endeavours and personal interactions. I am committed to ensuring that in every project we undertake, our team diligently works towards achieving the highest standards of excellence for our clients, stakeholders, and the world at large. This commitment extends beyond mere words; it is a steadfast pledge to act with transparency, uphold ethical practices in all circumstances, and foster a collaborative environment where collective effort and shared knowledge lead to innovative solutions. In doing so, I aim to contribute positively to our community and society, making a meaningful difference by setting a benchmark for how businesses can operate responsibly and with a purpose that transcends profit—striving to create a better, safer, and more equitable world for everyone.

My journey across various roles and industries has culminated in a profound realization: cybersecurity is where my passion, skills, and values align, presenting the definitive arena for my next professional venture. In a world increasingly digitized, cybersecurity emerges as the critical battleground against the 'bad boys' of the digital age. My resolve to confront these challenges head-on stems from a deep-seated commitment to safeguarding individuals and organizations from harm, embodying the principles of integrity, collaboration, and vigilance.

My diverse background, while eclectic, has never fully satisfied my quest for an environment that could harness my entire skill set, stimulate my intellectual curiosity to its fullest, and offer a clear, impactful purpose—until now. Discovering cybersecurity has been a revelation, unveiling a field that not only demands a comprehensive application of my abilities but also resonates with my core values of ensuring safety and upholding justice in the digital realm.

I firmly believe that my multifaceted skills can significantly contribute to making cybersecurity teams more efficient, cohesive, and driven by a unified vision. My keen attention to detail and analytical prowess are tailored for identifying and mitigating potential threats, ensuring that organizations and governments can operate within a secure digital landscape. Furthermore, my expertise in project management, risk assessment, and a thorough understanding of process frameworks and data legislation positions me as a valuable asset in crafting strategies that preempt regulatory pitfalls and fines.

In essence, my transition into cybersecurity is not merely a career shift but a commitment to a cause greater than myself. It's about leveraging my accumulated knowledge and skills to foster a secure, trustworthy digital environment for all. As I embark on this new chapter, I am eager to contribute to and grow within this dynamic field, confronting cybersecurity challenges head-on with diligence, innovation, and a relentless pursuit of excellence.

Portfolio Activity: Conduct a security audit

As part of this activity, I will conduct an internal security audit for a possible fictional company. We will go through some audits to ensure that security checks are made, to monitor for threats, risks, or vulnerabilities that can affect an organization’s business continuity and critical assets. Below you will find the scenario in which we will operate and the information available that we will use to do the audit.

Scenario

This scenario is based on a fictional company:

Botium Toys is a small U.S. business that develops and sells toys. The business has a single physical location, which serves as its main office, a storefront, and a warehouse for its products. However, Botium Toy’s online presence has grown, attracting customers in the U.S. and abroad. As a result, their information technology (IT) department is under increasing pressure to support their online market worldwide. 

The manager of the IT department has decided that an internal IT audit needs to be conducted. She expresses concerns about not having a solidified plan of action to ensure business continuity and compliance, as the business grows. She believes an internal audit can help better secure the company’s infrastructure and help them identify and mitigate potential risks, threats, or vulnerabilities to critical assets. The manager is also interested in ensuring that they comply with regulations related to internally processing and accepting online payments and conducting business in the European Union (E.U.).   

The IT manager starts by implementing the National Institute of Standards and Technology Cybersecurity Framework (NIST CSF), establishing an audit scope and goals, listing assets currently managed by the IT department, and completing a risk assessment. The goal of the audit is to provide an overview of the risks and/or fines that the company might experience due to the current state of its security posture.

Your task is to review the IT manager’s scope, goals, and risk assessment report. Then, perform an internal audit by completing a controls and compliance checklist.
Links

How we will conduct the Audit

First of all, we will conduct the next step of the security audit by completing the controls and compliance checklist.

Then we will review the scope, goals, and risk assessment report details, with a focus on:

  • The assets currently managed by the IT department

  • The bullet points under “Additional comments” in the Risk Assessment section

We will consider information provided in the scenario, the scope, goals, and risk assessment report, as well as details provided in other documents linked within the checklist.

Then, we will review the questions in the controls and compliance sections of the checklist and select “yes” or “no” to answer the question in each section (note: the recommendations section is optional).*

Below you will find a general plan of how we want to proceed with setting up a step-by-step approach:

  1. Define the Scope of the Audit Identify which systems, networks, and data are critical to the organization. Determine the audit's boundaries within the organization's infrastructure, including cloud services, on-premises systems, and third-party services.
  2. Review Current Security Policies and Procedures Examine existing security policies, procedures, and standards to assess their adequacy and compliance with industry best practices and regulations. Evaluate the alignment of security policies with the organization's business objectives and risk management strategy.
  3. Assess Risk Management Practices Perform a risk assessment to identify potential threats and vulnerabilities. Prioritize risks based on their potential impact on the organization and the likelihood of occurrence.
  4. Examine Technical Controls Evaluate the implementation and effectiveness of technical controls such as firewalls, intrusion detection systems, encryption, and access controls. Check for security updates, patches, and configuration management practices.
  5. Evaluate Physical Security Measures Assess physical access controls to sensitive areas, data centres, and other critical infrastructure. Review security measures for preventing unauthorized access, such as surveillance systems, locks, and security personnel.
  6. Analyze Incident Response and Recovery Plans Review the organization's incident response plan for completeness and effectiveness. Examine the disaster recovery and business continuity plans to ensure they are up-to-date and actionable.
  7. Conduct Security Awareness and Training Review Assess the effectiveness of the security awareness and training programs. Determine if employees are aware of their security responsibilities and the procedures for reporting security incidents.
  8. Perform Vulnerability Scans and Penetration Tests Use vulnerability scanning tools to identify weaknesses in the network and systems. Consider conducting a penetration test to simulate an attack on the network and evaluate the effectiveness of security measures.
  9. Review Access Controls and User Privileges Assess the process for granting, reviewing, and revoking access to systems and data. Ensure that the principle of least privilege is being followed, with users having only the access necessary to perform their job functions.
  10. Compile Audit Findings and Recommend Improvements Document all findings, including any vulnerabilities, gaps in policies, or areas of non-compliance. Provide recommendations for addressing identified issues and improving the organization's overall security posture.
  11. Present Findings to Management Prepare a detailed report or presentation for senior management. Highlight critical vulnerabilities and risks, and recommend strategic actions to mitigate these threats.

Audit Checklist

Administrative/Managerial Controls

  • Least Privilege & Separation of Duties

  • Verify if access controls are implemented to enforce least privilege.

  • Check for separation of duties to minimize risk from insider threats.

  • Disaster Recovery Plans

  • Assess the existence and completeness of disaster recovery plans.

  • Password & Access Control Policies

  • Review password policies for adherence to minimum complexity requirements.

  • Examine access control policies for proper authorization mechanisms.

  • Account Management Policies

  • Evaluate procedures for account creation, modification, and termination.

Technical Controls

  • Firewall & IDS/IPS

  • Confirm the firewall is configured to block unwanted traffic effectively.

  • Determine if an IDS/IPS is installed and functioning to detect/prevent threats.

  • Encryption & Backups

  • Check if encryption is used to protect sensitive data, especially customer information.

  • Verify the existence of backups for critical data and their regular testing.

  • Password Management & Antivirus Software

  • Assess the password management system for enforcing policy compliance.

  • Ensure antivirus software is up-to-date and actively monitored.

  • Manual Monitoring & Maintenance

  • Review schedules and procedures for monitoring and maintaining legacy systems.

Physical/Operational Controls

  • Physical Security Measures

  • Inspect physical access controls to sensitive areas and data storage locations.

  • Evaluate the effectiveness of CCTV, locks, and fire detection/prevention systems.

Compliance Checklist

  • Data Protection Regulations

  • Verify compliance with U.S. and E.U. data protection regulations, focusing on customer PII/SPII and cardholder data.

  • Check for mechanisms to notify E.U. customers within 72 hours of a security breach.

  • Online Payment Standards

  • Assess compliance with standards for processing and storing online payments.

Now to be even more specific I will review the questions in the controls and compliance sections of the checklist and I will select “yes” or “no” to answer the question in each section and to have a better visual report for the stakeholders.

Administrative/Managerial Controls

  • Least Privilege & Separation of Duties

    • [No] Adequate implementation of least privilege and separation of duties is not confirmed, as all employees have access to sensitive data.
  • Disaster Recovery Plans

    • [No] No disaster recovery plans are currently in place, indicating a significant gap in business continuity planning.
  • Password & Access Control Policies -[No] The existing password policy does not meet current minimum complexity requirements, indicating a need for improvement.

  • Account Management Policies -[No] Without a centralized password management system and clear procedures for account lifecycle management, it's likely that account management policies are not fully effective.

Technical Controls

  • Firewall & IDS/IPS -[Yes] A firewall is in place with defined security rules. -[No] An intrusion detection system (IDS) has not been installed.

  • Encryption & Backups -[No] Encryption is not currently used for customer credit card information, posing a significant risk to data confidentiality. -[No] There are no backups of critical data, which is crucial for recovery efforts.

-Password Management & Antivirus Software -[No] The absence of a centralized password management system suggests inadequate password management. -[Yes] Antivirus software is installed and regularly monitored.

  • Manual Monitoring & Maintenance -[No] There is no regular schedule for monitoring and maintaining legacy systems, increasing the risk of vulnerabilities.

Physical/Operational Controls

  • Physical Security Measures -[Yes] Adequate physical security measures are in place, including locks, CCTV, and fire detection/prevention systems.

Compliance Checklist

  • Data Protection Regulations -[No] Compliance with U.S. and E.U. data protection regulations is not fully assured, especially regarding customer PII/SPII and encryption of credit card information.

  • Online Payment Standards -[No] The lack of encryption for credit card information indicates non-compliance with standards for processing and storing online payments.

Recommendations (Optional) Based on the checklist outcomes, I am recommending a few points to cover the gaps identified:

  • Implement an IDS/IPS to enhance network security and threat detection.
  • Develop and test disaster recovery plans to ensure business continuity.
  • Strengthen password policies and implement a centralized password management system.
  • Encrypt sensitive customer data, including credit card information, to comply with data protection regulations.
  • Establish regular backups of critical data to facilitate recovery efforts.
  • Schedule regular maintenance for legacy systems to mitigate risks associated with outdated technology.

Portfolio Activity Analyze network layer communication

_In this activity, you will analyze DNS and ICMP traffic in transit using data from a network protocol analyzer tool. You will identify which network protocol was utilized in assessment of the cybersecurity incident.

In the internet layer of the TCP/IP model, the IP formats data packets into IP datagrams. The information provided in the datagram of an IP packet can provide security analysts with insight into suspicious data packets in transit.

Knowing how to identify potentially malicious traffic on a network can help cybersecurity analysts assess security risks on a network and reinforce network security._

Scenario

You are a cybersecurity analyst working at a company that specializes in providing IT services for clients. Several customers of clients reported that they were not able to access the client company website www.yummyrecipesforme.com, and saw the error “destination port unreachable” after waiting for the page to load.

You are tasked with analyzing the situation and determining which network protocol was affected during this incident. To start, you attempt to visit the website and you also receive the error “destination port unreachable.” To troubleshoot the issue, you load your network analyzer tool, tcpdump, and attempt to load the webpage again. To load the webpage, your browser sends a query to a DNS server via the UDP protocol to retrieve the IP address for the website's domain name; this is part of the DNS protocol. Your browser then uses this IP address as the destination IP for sending an HTTPS request to the web server to display the webpage The analyzer shows that when you send UDP packets to the DNS server, you receive ICMP packets containing the error message: “udp port 53 unreachable.”

log from tcpdump packet data In the tcpdum log, you find the following information:

image

The first two lines of the log file show the initial outgoing request from your computer to the DNS server requesting the IP address of yummyrecipesforme.com. This request is sent in a UDP packet.

The third and fourth lines of the log show the response to your UDP packet. In this case, the ICMP 203.0.113.2 line is the start of the error message indicating that the UDP packet was undeliverable to port 53 of the DNS server.

In front of each request and response, you find timestamps that indicate when the incident happened. In the log, this is the first sequence of numbers displayed: 13:24:32.192571. This means the time is 1:24 p.m., 32.192571 seconds.

After the timestamps, you will find the source and destination IP addresses. In the first line, where the UDP packet travels from your browser to the DNS server, this information is displayed as: 192.51.100.15.52444 > 203.0.113.2.domain. The IP address to the left of the greater than (>) symbol is the source address, which in this example is your computer’s IP address. The IP address to the right of the greater than (>) symbol is the destination IP address. In this case, it is the IP address for the DNS server: 203.0.113.2.domain. For the ICMP error response, the source address is 203.0.113.2 and the destination is your computers IP address 192.51.100.15.52444.

After the source and destination IP addresses, there can be a number of additional details like the protocol, port number of the source, and flags. In the first line of the error log, the query identification number appears as: 35084. The plus sign after the query identification number indicates there are flags associated with the UDP message. The "A?" indicates a flag associated with the DNS request for an A record, where an A record maps a domain name to an IP address. The third line displays the protocol of he response message to the browser: "ICMP," which is followed by an ICMP error message

The error message, "udp port 53 unreachable" is mentioned in the last line. Port 53 is a port for DNS service. The word "unreachable" in the message indicates the UDP message requesting an IP address for the domain "www.yummyrecipesforme.com" did not go through to the DNS server because no service was listening on the receiving DNS port.

The remaining lines in the log indicate that ICMP packets were sent two more times, but the same delivery error was received both times.

Now that you have captured data packets using a network analyzer tool, it is your job to identify which network protocol and service were impacted by this incident. Then, you will need to write a follow-up report.

As an analyst, you can inspect network traffic and network data to determine what is causing network-related issues during cybersecurity incidents. Later in this course, you will demonstrate how to manage and resolve incidents. For now, you only need to analyze the situation.

This event, in the meantime, is being handled by security engineers after you and other analysts have reported the issue to your direct supervisor.

Provide a summary of the problem found in the tcpdump log and Explain your analysis of the data and provide one solution to implement

Cybersecurity Incident Report: Network Traffic Analysis

Part 1: Summary of the Problem Found in the DNS and ICMP Traffic Log

Summary of Tcpdump Log Analysis:

  • The tcpdump log analysis reveals that there was a problem with DNS queries sent from the user's computer to the DNS server. The user's attempts to access the website www.yummyrecipesforme.com resulted in the error message "destination port unreachable." This error was specifically related to UDP port 53, which is used for DNS services. The log shows outgoing UDP packets from the user's computer to the DNS server requesting the IP address for the website's domain. However, the response was an ICMP packet indicating that UDP port 53 was unreachable on the DNS server.

Protocols Used:

  • UDP (User Datagram Protocol): Used for sending the DNS query from the browser to the DNS server.
  • ICMP (Internet Control Message Protocol): Used to return error messages to the sender, in this case, indicating that the destination port (53) was unreachable.

Indications in the Log:

  • Initial requests for the domain's IP address were made via UDP to port 53 of the DNS server.
  • ICMP error messages were received in response, indicating the port was unreachable.

Issues Found:

  • The "udp port 53 unreachable" error indicates a failure in DNS resolution, as the DNS server did not respond to the query on the expected port. This could imply several issues, such as network configuration errors, DNS server problems, or network security devices (like firewalls) blocking the traffic.

Part 2: Analysis and Cause of the Incident

Time Incident Occurred:

  • The problem was first reported based on the timestamp in the tcpdump log at 1:24 p.m.

Awareness of the Incident:

  • The IT team became aware of the incident after several customers and internal attempts to access the client's website resulted in the "destination port unreachable" error message.

Investigation Actions:

  • To investigate, the IT department utilized network analyzer tools like tcpdump to capture and analyze the network traffic while attempting to access the website.

Key Findings:

  • The affected port was UDP port 53, crucial for DNS queries.
  • ICMP packets indicated that the port was unreachable, which suggests a communication issue between the user's computer and the DNS server.
  • The DNS server's IP address was identified in the log, but there was no successful communication.

Likely Cause of the Incident:

  • The most likely cause of the incident is a configuration issue or a fault at the DNS server preventing it from responding to queries on port 53. Another possibility could be network security measures (like a firewall) mistakenly blocking UDP traffic to port 53.

Summary of Problem:

  • The problem involves the inability of DNS queries to reach the intended DNS server on the expected port (UDP port 53), resulting in an error message indicating that the destination port is unreachable. This failure in DNS resolution prevented access to the website www.yummyrecipesforme.com. The issue was highlighted by ICMP error responses to the DNS query attempts, pointing towards a disruption in normal DNS operation, potentially due to server issues or network configuration/firewall settings blocking the required port.

Cybersecurity Incident Report: Detailed Analysis and Solution Implementation

When the Problem Was First Reported:

  • The issue was first observed and reported at 1:24 p.m., as indicated by the timestamp in the tcpdump log during the attempt to access the website www.yummyrecipesforme.com.

Scenario, Events, and Symptoms:

  • Customers and internal users attempting to access the client company's website were met with the error message “destination port unreachable” after a significant delay. This prompted an investigation using network analysis tools, which revealed ICMP error messages related to DNS queries.

Current Status of the Issue:

  • As of the last update, the website remains inaccessible to users, with DNS resolution being the identified bottleneck due to UDP port 53 being unreachable. Engeneering team is working on the issue to recover the service.

Information Discovered:

  • The DNS queries from the user’s browser to the DNS server were made using UDP protocol, specifically targeting port 53, which is standard for DNS requests. ICMP packets were returned with error messages stating "udp port 53 unreachable," indicating that the queries could not be processed by the DNS server. Repeated attempts to query the DNS server resulted in the same ICMP error response, confirming the issue's persistence.

Next Steps in Troubleshooting and Resolving the Issue:

  • Verify Network Configuration: Ensure that the network settings, including firewalls and router configurations, are correctly set to allow UDP traffic on port 53.
  • Contact DNS Server Administrator: If the network configuration is not at fault, the problem may lie with the DNS server itself. The server administrator should be contacted to check for any issues or misconfigurations preventing it from responding to queries on port 53.
  • DNS Server Logs: Review the logs of the DNS server to identify any internal errors or blocks that might be causing the issue.
  • Alternative DNS Server: Temporarily use an alternative DNS server for resolving domain names to verify if the issue is isolated to the specific DNS server in question.
  • Firewall and IDS/IPS Check: Inspect firewall and Intrusion Detection/Prevention Systems (IDS/IPS) logs to identify any rules that may inadvertently block DNS queries or responses.

Suspected Root Cause:

  • The primary suspected cause for the ICMP error messages and the subsequent failure in DNS resolution is a disruption in the DNS server’s ability to receive or process queries on UDP port 53. This disruption could be due to misconfiguration, server failure, or network security appliances (such as firewalls) improperly blocking the necessary traffic. The specificity of the error to port 53, used for DNS, and the nature of the ICMP messages points towards these areas as the focal points for resolution efforts.

Proposed Solution:

  • To address the identified issues, the immediate step should involve verifying and adjusting firewall settings to ensure UDP traffic on port 53 is allowed. Concurrently, engaging with the DNS server administrators to ensure the server is operational and correctly configured to handle queries is crucial. If the server is found to be at fault, necessary repairs or configuration adjustments should be implemented. In the longer term, establishing monitoring and alerting for similar incidents can facilitate quicker detection and resolution of DNS-related issues.

Porfolio Activity: Analyze network attacks

_In this activity, you will consider a scenario involving a customer of the company that you work for who experiences a security issue when accessing the company’s website. You will identify the likely cause of the service interruption. Then, you will explain how the attack occurred and the negative impact it had on the website.

In this course, you have learned about several common network attacks. You have learned their names, how they are carried out, and the characteristics of each attack from the perspective of the target. Understanding how attacks impact a network will help you troubleshoot issues on your organization’s network. It will also help you take steps to mitigate damage and protect a network from future attacks_

Scenario

You work as a security analyst for a travel agency that advertises sales and promotions on the company’s website. The employees of the company regularly access the company’s sales webpage to search for vacation packages their customers might like.

One afternoon, you receive an automated alert from your monitoring system indicating a problem with the web server. You attempt to visit the company’s website, but you receive a connection timeout error message in your browser.

You use a packet sniffer to capture data packets in transit to and from the web server. You notice a large number of TCP SYN requests coming from an unfamiliar IP address. The web server appears to be overwhelmed by the volume of incoming traffic and is losing its ability to respond to the abnormally large number of SYN requests. You suspect the server is under attack by a malicious actor.

You take the server offline temporarily so that the machine can recover and return to a normal operating status. You also configure the company’s firewall to block the IP address that was sending the abnormal number of SYN requests. You know that your IP blocking solution won’t last long, as an attacker can spoof other IP addresses to get around this block. You need to alert your manager about this problem quickly and discuss the next steps to stop this attacker and prevent this problem from happening again. You will need to be prepared to tell your boss about the type of attack you discovered and how it was affecting the web server and employees.

Cybersecurity Incident Report

Section 1: Identify the type of attack that may have caused this network interruption

  • One potential explanation for the website's connection timeout error message is a SYN flood attack. This type of Denial-of-Service (DoS) attack involves sending a large volume of TCP SYN requests to a target server from one or more sources. It is designed to exploit the normal TCP three-way handshake process, overwhelming the server's resources and preventing it from responding to legitimate traffic.

Section 2: Explain how the attack is causing the website to malfunction

  • The client sends a SYN (synchronize) packet to the server to initiate a connection.
  • The server responds with a SYN-ACK (synchronize-acknowledge) packet to acknowledge the connection request.
  • The client sends an ACK (acknowledge) packet back to the server to complete the connection, establishing a TCP session.
  • When a malicious actor sends a large number of SYN packets all at once without completing the handshake with ACKs, the server allocates resources for each SYN received, waiting for the final ACK. As these ACKs never arrive, the server's resources get exhausted, preventing it from handling legitimate requests. The logs indicate an abnormal amount of incomplete TCP connections, suggesting a SYN flood attack, leading to the server's inability to process genuine user requests, resulting in timeouts and service disruption.

Identify the type of Attack causing this network interruption

  • Reflect on the types of network intrusion attacks that you have learned about in this course so far. As a security analyst, identifying the type of network attack based on the incident is the first step to managing the attack and preventing similar attacks in the future._

Here are some questions to consider when determining what type of attack occurred:

  • What do you currently understand about network attacks?

  • Which type of attack would likely result in the symptoms described in the scenario?

  • What is the difference between a denial of service (DoS) and distributed denial of service (DDoS)?

  • Why is the website taking a long time to load and reporting a connection timeout error?

Review the Wireshark logs provided and try to identify patterns in the logged network traffic. Analyze the patterns to determine which type of network attack occurred. Write your analysis in section one of the Cybersecurity incident report template provided

In the context of network attacks, my understanding encompasses the various tactics and methodologies attackers use to compromise, disrupt, or gain unauthorized access to network resources. The scenario described points to a Denial-of-Service (DoS) attack, specifically a SYN flood attack, which involves overwhelming a server with TCP SYN requests to exhaust its resources, preventing legitimate requests from being processed.

The difference between a DoS and a Distributed Denial of Service (DDoS) attack lies in the source of the attack; a DoS attack originates from a single source, while a DDoS attack involves multiple compromised sources (or bots) targeting a single system, making it more difficult to mitigate.

The website is taking a long time to load and reporting a connection timeout error because the server is overwhelmed with illegitimate SYN requests, consuming all its available resources to handle genuine traffic, leading to service unavailability for legitimate users.

Explain how the attack is causing the website to malfunction

Review the Wireshark logs, then write your analysis in section two of the Cybersecurity incident report template provided.

When writing your report, discuss the network devices and activities that are involved in the interruption. Include the following information in your explanation:

  • Describe the attack. What are the main symptoms or characteristics of this specific type of attack?

  • Explain how it affected the organization’s network. How does this specific network attack affect the website and how it functions?

  • Describe the potential consequences of this attack and how it negatively affects the organization.

  • Optional: Suggest potential ways to secure the network so this attack can be prevented in the future.

The attack is a SYN flood, a type of DoS attack characterized by an excessive number of SYN requests sent to a target server. Main symptoms include an unusually high volume of incoming SYN packets, server resources being quickly exhausted, and a significant reduction in the server's ability to process legitimate requests, leading to service disruption.

The SYN flood attack overwhelmed the organization's web server, consuming its resources and preventing it from responding to legitimate traffic. This resulted in the website taking a long time to load or becoming completely inaccessible to users, directly impacting the website's functionality and availability.

Consequences of the attack include operational disruptions, loss of customer trust, potential revenue loss, and damage to the organization's reputation. It may also lead to increased operational costs due to the need for emergency response measures and long-term security enhancements.

To prevent future SYN flood attacks, the organization can implement rate limiting, SYN cookies, and IP filtering. Employing a robust firewall and intrusion detection system (IDS) that specifically looks for patterns associated with SYN flood attacks can also help. Additionally, investing in DDoS mitigation services can provide another layer of protection by identifying and neutralizing such attacks before they reach the server.

Activity: Apply OS hardening techniques

In this activity, you will take on the role of a cybersecurity analyst working for a company that hosts the cooking website, yummyrecipesforme.com. Visitors to the website experience a security issue when loading the main webpage. Your job is to investigate, identify, document, and recommend a solution to the security problem.

_When investigating the security event, you will review a tcpdump log. You will need to identify the network protocols used to establish the connection between the user and the website. Network protocols are the communication rules and standards networked devices use to transmit data. Unfortunately, malicious actors can also use network protocols to invade and attack private networks. Knowing how to identify the protocols commonly used in attacks will help you protect your organization’s network against these types of security events.

To complete the assignment, you will also need to document what occurred during the security incident. Then, you will recommend one security measure to implement to prevent similar security problems in the future._

Scenario

You are a cybersecurity analyst for yummyrecipesforme.com, a website that sells recipes and cookbooks. A disgruntled baker has decided to publish the website’s best-selling recipes for the public to access for free.

The baker executed a brute force attack to gain access to the web host. They repeatedly entered several known default passwords for the administrative account until they correctly guessed the right one. After they obtained the login credentials, they were able to access the admin panel and change the website’s source code. They embedded a javascript function in the source code that prompted visitors to download and run a file upon visiting the website. After running the downloaded file, the customers are redirected to a fake version of the website where the seller’s recipes are now available for free.

Several hours after the attack, multiple customers emailed yummyrecipesforme’s helpdesk. They complained that the company’s website had prompted them to download a file to update their browsers. The customers claimed that, after running the file, the address of the website changed and their personal computers began running more slowly.

In response to this incident, the website owner tries to log in to the admin panel but is unable to, so they reach out to the website hosting provider. You and other cybersecurity analysts are tasked with investigating this security event.

To address the incident, you create a sandbox environment to observe the suspicious website behavior. You run the network protocol analyzer tcpdump, then type in the URL for the website, yummyrecipesforme.com. As soon as the website loads, you are prompted to download an executable file to update your browser. You accept the download and allow the file to run. You then observe that your browser redirects you to a different URL, greatrecipesforme.com, which is designed to look like the original site. However, the recipes your company sells are now posted for free on the new website.

The logs show the following process:

The browser requests a DNS resolution of the yummyrecipesforme.com URL.

The DNS replies with the correct IP address.

The browser initiates an HTTP request for the webpage.

The browser initiates the download of the malware.

The browser requests another DNS resolution for greatrecipesforme.com.

The DNS server responds with the new IP address.

The browser initiates an HTTP request to the new IP address.

A senior analyst confirms that the website was compromised. The analyst checks the source code for the website. They notice that javascript code had been added to prompt website visitors to download an executable file. Analysis of the downloaded file found a script that redirects the visitors’ browsers from yummyrecipesforme.com to greatrecipesforme.com.

The cybersecurity team reports that the web server was impacted by a brute force attack. The disgruntled baker was able to guess the password easily because the admin password was still set to the default password. Additionally, there were no controls in place to prevent a brute force attack.

Your job is to document the incident in detail, including identifying the network protocols used to establish the connection between the user and the website. You should also recommend a security action to take to prevent brute force attacks in the future.

tpcdump logs

14:18:32.192571 IP your.machine.52444 > dns.google.domain: 35084+ A? yummyrecipesforme.com. (24) 14:18:32.204388 IP dns.google.domain > your.machine.52444: 35084 1/0/0 A 203.0.113.22 (40)

14:18:36.786501 IP your.machine.36086 > yummyrecipesforme.com.http: Flags [S], seq 2873951608, win 65495, options [mss 65495,sackOK,TS val 3302576859 ecr 0,nop,wscale 7], length 0 14:18:36.786517 IP yummyrecipesforme.com.http > your.machine.36086: Flags [S.], seq 3984334959, ack 2873951609, win 65483, options [mss 65495,sackOK,TS val 3302576859 ecr 3302576859,nop,wscale 7], length 0 14:18:36.786529 IP your.machine.36086 > yummyrecipesforme.com.http: Flags [.], ack 1, win 512, options [nop,nop,TS val 3302576859 ecr 3302576859], length 0 14:18:36.786589 IP your.machine.36086 > yummyrecipesforme.com.http: Flags [P.], seq 1:74, ack 1, win 512, options [nop,nop,TS val 3302576859 ecr 3302576859], length 73: HTTP: GET / HTTP/1.1 14:18:36.786595 IP yummyrecipesforme.com.http > your.machine.36086: Flags [.], ack 74, win 512, options [nop,nop,TS val 3302576859 ecr 3302576859], length 0 …<a lot of traffic on the port 80>...

14:20:32.192571 IP your.machine.52444 > dns.google.domain: 21899+ A? greatrecipesforme.com. (24) 14:20:32.204388 IP dns.google.domain > your.machine.52444: 21899 1/0/0 A 192.0.2.17 (40)

14:25:29.576493 IP your.machine.56378 > greatrecipesforme.com.http: Flags [S], seq 1020702883, win 65495, options [mss 65495,sackOK,TS val 3302989649 ecr 0,nop,wscale 7], length 0 14:25:29.576510 IP greatrecipesforme.com.http > your.machine.56378: Flags [S.], seq 1993648018, ack 1020702884, win 65483, options [mss 65495,sackOK,TS val 3302989649 ecr 3302989649,nop,wscale 7], length 0 14:25:29.576524 IP your.machine.56378 > greatrecipesforme.com.http: Flags [.], ack 1, win 512, options [nop,nop,TS val 3302989649 ecr 3302989649], length 0 14:25:29.576590 IP your.machine.56378 > greatrecipesforme.com.http: Flags [P.], seq 1:74, ack 1, win 512, options [nop,nop,TS val 3302989649 ecr 3302989649], length 73: HTTP: GET / HTTP/1.1 14:25:29.576597 IP greatrecipesforme.com.http > your.machine.56378: Flags [.], ack 74, win 512, options [nop,nop,TS val 3302989649 ecr 3302989649], length 0 …<a lot of traffic on the port 80>...

Incident Report

Security Incident Report

  1. Network Protocol Involved: The incident investigation identified two primary network protocols: DNS (Domain Name System) and HTTP (Hypertext Transfer Protocol). DNS was used for resolving the domain names 'yummyrecipesforme.com' and 'greatrecipesforme.com' into their respective IP addresses. HTTP was utilized for web page requests, including the malicious file download that led to the unauthorized redirection of users to a fraudulent website. We might assume that the injected malicious javascript piece of code is the HTTP: GET / HTTP/1.1

  2. Incident Summary: A disgruntled baker executed a brute force attack on yummyrecipesforme.com, successfully guessing the admin's default password. Upon gaining access, they embedded malicious JavaScript in the website's source code, causing visitors to download a file that redirected them to a counterfeit website, greatrecipesforme.com, where the company's recipes were posted for free. This compromise was discovered following customer complaints about being prompted to download an updated file, leading to slower computer performance and unauthorized website redirection. The incident was confirmed through DNS and HTTP log analysis, revealing the malicious activities and the security lapse due to the use of a default password without brute force attack mitigation measures.

  3. Remediation for Brute Force Attacks: To prevent future brute force attacks, it is recommended to enforce strong password policies. This includes requirements for complex passwords that combine letters, numbers, and special characters, and mandate regular password changes. Strong passwords significantly reduce the risk of unauthorized access through brute force attacks by increasing the time and computational resources required to guess them. Implementing a policy that requires passwords to be of a certain length and complexity can deter attackers and protect sensitive information from unauthorized access. Another suggestion would be to implement multifactor authentication to add a layer of security for non-authorized admin users

Activity: Analysis of network hardening

In this activity, you will be presented with a scenario about a social media organization that recently experienced a major data breach caused by undetected vulnerabilities. To address the breach, you will identify some common network hardening tools that can be implemented to protect the organization’s overall security. Then, you will select a specific vulnerability that the company has and propose different network hardening methods. Finally, you will explain how the methods and tools you chose will be effective for managing the vulnerability and how they will prevent potential breaches in the future.

Scenario

You are a security analyst working for a social media organization. The organization recently experienced a major data breach, which compromised the safety of their customers’ personal information, such as names and addresses. Your organization wants to implement strong network hardening practices that can be performed consistently to prevent attacks and breaches in the future.

After inspecting the organization’s network, you discover four major vulnerabilities. The four vulnerabilities are as follows:

The organization’s employees' share passwords.

The admin password for the database is set to the default.

The firewalls do not have rules in place to filter traffic coming in and out of the network.

Multifactor authentication (MFA) is not used.

If no action is taken to address these vulnerabilities, the organization is at risk of experiencing another data breach or other attacks in the future.

In this activity, you will write a security risk assessment to analyze the incident and explain what methods can be used to further secure the network.

Risk Assessment

Part 1: Select up to three hardening tools and methods to implement

Based on the vulnerabilities identified in your organization's network, the most effective network-hardening tools and methods to implement that I would suggest implementing are

  • Baseline Configurations: This method should be reviewed and updated regularly, at least quarterly, or whenever significant changes to the network or its threat environment occur.
  • Disabling Unused Ports: The review and disabling of unused ports should be conducted regularly, as part of routine network maintenance, to ensure new vulnerabilities are not introduced.
  • Firewall Maintenance: Firewall maintenance should be a continuous process, with reviews and updates at least monthly or whenever significant network changes occur, to ensure the firewall effectively protects against the latest threats.

Part 2: Explain your recommendations

  • Baseline configurations serve as a critical foundation for network security by ensuring that all systems conform to a recognized secure standard. This practice is especially effective in preventing unauthorized changes that could introduce vulnerabilities. Regular updates and reviews of the baseline configurations are essential to adapt to new threats and changes within the network environment. This method is effective as it establishes a secure, standard configuration for all systems and devices. By having a known secure baseline, any deviations or unauthorized changes can be quickly identified and rectified, helping to prevent security breaches related to improper configurations.

  • Disabling unused ports directly mitigates the risk posed by insufficient firewall configurations. By eliminating unnecessary access points, the organization can significantly lower the chances of unauthorized access and potential breaches. This task requires ongoing vigilance to ensure that as new services are added or removed, the network's exposure to potential attacks remains minimized. This method significantly reduces the risk of unauthorized access and data breaches by limiting the number of entry points into the network that can be exploited. It directly addresses the vulnerability related to insufficient firewall rules.

  • Firewall Maintenance is crucial for continuously adapting the organization's defences to the evolving threat landscape. Regularly updating firewall rules ensures that the network's protective measures remain effective against new types of attacks and unauthorized access attempts. This proactive approach is essential for maintaining the integrity and confidentiality of the network and customer data. Regular maintenance of firewalls directly addresses the vulnerability associated with the lack of rules to filter traffic. By continuously updating and auditing firewall rules, the organization can ensure that only legitimate traffic is allowed, significantly reducing the risk of malicious access and data breaches.

    Portfolio Activity: Use the NIST Cybersecurity Framework to respond to a security incident

    In this activity, you will use the knowledge you’ve gained about networks throughout this course to analyze a network incident. You will analyze the situation using the National Institute of Standards and Technology's Cybersecurity Framework (NIST CSF) and create an incident report that you can include as part of your cybersecurity portfolio documentation. The CSF is a voluntary framework that consists of standards, guidelines, and best practices to manage cybersecurity risk.Creating a quality cybersecurity incident report and applying the CSF can help you build trust and improve security practices within your organization

    Scenario

    You are a cybersecurity analyst working for a multimedia company that offers web design services, graphic design, and social media marketing solutions to small businesses. Your organization recently experienced a DDoS attack, which compromised the internal network for two hours until it was resolved.

During the attack, your organization’s network services suddenly stopped responding due to an incoming flood of ICMP packets. Normal internal network traffic could not access any network resources. The incident management team responded by blocking incoming ICMP packets, stopping all non-critical network services offline, and restoring critical network services.

The company’s cybersecurity team then investigated the security event. They found that a malicious actor had sent a flood of ICMP pings into the company’s network through an unconfigured firewall. This vulnerability allowed the malicious attacker to overwhelm the company’s network through a distributed denial of service (DDoS) attack.

To address this security event, the network security team implemented:

A new firewall rule to limit the rate of incoming ICMP packets

Source IP address verification on the firewall to check for spoofed IP addresses on incoming ICMP packets

Network monitoring software to detect abnormal traffic patterns

An IDS/IPS system to filter out some ICMP traffic based on suspicious characteristics

As a cybersecurity analyst, you are tasked with using this security event to create a plan to improve your company’s network security, following the National Institute of Standards and Technology (NIST) Cybersecurity Framework (CSF). You will use the CSF to help you navigate through the different steps of analyzing this cybersecurity incident and integrate your analysis into a general security strategy:

Identify security risks through regular audits of internal networks, systems, devices, and access privileges to identify potential gaps in security.

Protect internal assets through the implementation of policies, procedures, training and tools that help mitigate cybersecurity threats.

Detect potential security incidents and improve monitoring capabilities to increase the speed and efficiency of detections.

Respond to contain, neutralize, and analyze security incidents; implement improvements to the security process.

Recover affected systems to normal operation and restore systems data and/or assets that have been affected by an incident.

Incident Report Using Nist Framework

Summary

The incident involved a DDoS attack on a multimedia company's network via an influx of ICMP packets, causing service disruption. The cybersecurity team responded by blocking ICMP packets and restoring critical services. Investigation revealed the attack was facilitated by a misconfigured firewall. Measures such as rate-limiting ICMP packets, verifying source IP addresses, and enhancing network monitoring and IDS/IPS systems were implemented. The response strategy included disabling compromised accounts, training staff on security practices, informing management and customers, and legal compliance. Recovery efforts focused on data restoration from backups, with a notification to staff regarding data re-entry requirements

Nist Framework Incident Report

Identify: Conduct regular audits to identify vulnerabilities within the network, systems, and firewall configurations. This includes inventorying assets and assessing access controls to uncover any security gaps that could be exploited in future attacks.

  • Technology/Asset Management: Identify all hardware devices (servers, routers, switches), operating systems (Windows, Linux, etc.), and software applications (email, CRM, website services) impacted by the DDoS attack. Map the internal network to understand the attack's flow, pinpointing where the ICMP flood began and how it propagated through the network.

  • Process/Business Environment: Determine which business operations were most affected by the network downtime. This could include email communications, client-facing web services, access to internal databases, or use of design software. Assess the impact on service delivery to clients, especially those reliant on timely updates or project completions.

  • People: Identify the roles within the organization that require access to the compromised systems for their daily operations. This includes IT staff, web designers, graphic artists, and social media managers. Consider the level of access each role requires and whether current permissions are appropriate or need adjustments to minimize risk.

Protect: Strengthen firewall configurations to limit ICMP traffic and enforce source IP address verification to deter IP spoofing. Implement comprehensive policies and training programs to mitigate cybersecurity threats. Upgrade tools and processes to safeguard against unauthorized access and potential attacks.

  • Access Control: Implement strict access controls to ensure only authorized personnel have access to sensitive systems and data. Utilize role-based access control (RBAC) to ensure that access rights are aligned with the user's job responsibilities. Employ methods to block non-trusted sources, such as firewall rules, secure VPNs for remote access, and multi-factor authentication (MFA) for system logins.

  • Awareness/Training: Develop a comprehensive cybersecurity awareness program for all employees, focusing on recognizing and responding to potential threats like phishing, which could lead to DDoS attacks. Specialized training for IT staff on incident response and the latest cybersecurity practices should also be conducted.

  • Data Security: Evaluate the security of data affected by the attack, applying encryption for data at rest and in transit. Implement regular data backups and ensure that they are stored securely off-site or in a cloud environment with proper security controls.

  • Information Protection Procedures: Review and update current information protection policies and procedures. This could involve updating incident response plans, data handling protocols, and security policies to incorporate lessons learned from the attack.

  • Maintenance: Conduct a thorough review of affected hardware and software to identify any required updates or patches. Regularly schedule maintenance windows to apply updates and patches to prevent vulnerabilities.

  • Protective Technology: Enhance protective technologies by deploying advanced firewall configurations, intrusion prevention systems (IPS), and other cybersecurity tools designed to detect and block malicious traffic. Consider technologies like DDoS mitigation services that can protect against large-scale attacks

Detect: Utilize network monitoring software to observe traffic patterns and detect anomalies indicative of a DDoS attack or other malicious activities. Enhance the capabilities of IDS/IPS systems for more effective identification of suspicious ICMP traffic.

  • To enhance detection capabilities, the team will integrate advanced firewall logging tools and an intrusion detection system (IDS). These technologies will monitor all inbound and outbound network traffic, enabling the identification of unusual patterns or potential threats. The firewall's logging capabilities will allow for the analysis of traffic flow, identifying any abnormal spikes that could indicate a DDoS attack. Simultaneously, the IDS will analyze packet signatures against known threat patterns to detect unauthorized access attempts, ensuring swift identification of potential security breaches.

Respond: Develop and refine incident response protocols to ensure timely and effective action in containing and neutralizing threats. This includes isolating affected systems, analyzing the attack's nature and source, and communicating with relevant stakeholders throughout the incident.

  • The response to the incident included immediate action to disable the compromised network account to prevent further unauthorized access. Comprehensive training was provided to both interns and employees, emphasizing the importance of safeguarding login credentials and recognizing phishing attempts. Upper management was promptly informed of the breach, initiating a process to communicate with customers about the incident through mail, in line with transparency and customer trust maintenance. Additionally, management prepared to engage with law enforcement and comply with local regulatory requirements, ensuring a thorough and lawful response to the cybersecurity event.

Recover: Implement procedures for the rapid restoration of affected systems to normal operations, including data recovery strategies. Post-incident, conduct a thorough review to understand the attack's impact fully and take corrective measures to prevent recurrence.

  • The team's recovery strategy involves restoring the affected database from the last full backup conducted the previous night. Staff were informed that any customer data entered or modified in the database on the morning of the attack would not be included in the backup and would need to be re-entered manually. This step ensures the restoration of lost data while acknowledging the gap in data recorded due to the timing of the backup and the incident.

Portfolio Activity: Use Linux commands to manage file permissions

In this activity, you will create a new portfolio document to demonstrate your experience using Linux commands to manage file permissions.

Scenario

Review the scenario below.

You are a security professional at a large organization. You mainly work with their research team. Part of your job is to ensure users on this team are authorized with the appropriate permissions. This helps keep the system secure.

Your task is to examine existing permissions on the file system. You’ll need to determine if the permissions match the authorization that should be given. If they do not match, you’ll need to modify the permissions to authorize the appropriate users and remove any unauthorized access.

Note: This scenario involves investigating and updating the same file permissions as the ones in the Manage authorization lab. You can revisit the lab to get screenshots to include in your portfolio document. If you choose, it's also possible to complete this activity without revisiting the lab by typing your commands in the template.

File permissions in Linux

Project description

In this project, we navigate the critical task of managing file and directory permissions within a Linux environment, specifically within the /home/researcher2/projects directory of a large organization. Our objective is to ensure that file permissions align with the organization's security protocols, thereby granting appropriate access to the research team while eliminating any unauthorized access. Through the use of Linux commands, we meticulously review and adjust the permissions of files and directories to safeguard sensitive information and maintain system security.

Check file and directory details

To check the permissions of files and directories, I'll use the ls -l command. This command lists the contents of a directory in a long format, showing detailed information including the permissions. ls -l /home/researcher2/projects The permissions would be represented in the 10-character string format for each file and directory in the way described below:

  • project_k.txt would be -rw-rw-rw-
  • project_m.txt would be -rw-r-----
  • project_r.txt would be -rw-rw-r--
  • project_t.txt would be -rw-rw-r--
  • .project_x.txt would be -rw-w-----
  • drafts/ directory would be drwx--x---

Describe the permissions string#### Describe the permissions string

Taking the project_k.txt file as an example, its permissions string -rw-rw-rw- can be described as follows:

The first character - indicates it is a regular file. The next three characters rw- show the user (owner) has read and write permissions, but not execute permission. The following three characters rw- indicate the group has read and write permissions. The final three characters rw- reveal that others also have read and write permissions.

Change file permissions

Since the organization does not allow "other" to have write access, project_k.txt needs its permissions modified to remove write access for "other". chmod o-w /home/researcher2/projects/project_k.txt

Change file permissions on a hidden file

For the .project_x.txt file, since it should only have read permissions for the user and group, and no write permissions for anyone, the following command assigns the appropriate authorization: chmod /home/researcher2/projects/.project_x.txt

Change directory permissions

To ensure only the researcher2 user can access the drafts directory and its contents, I'll modify the permissions so that only the user has read, write, and execute permissions. chmod /home/researcher2/projects/drafts This command removes all access for the group and others, ensuring exclusive access for the owner, researcher2.

Summary

Throughout this project, I successfully identified and modified file permissions that did not comply with the organization's security policies, specifically addressing concerns related to write access for unauthorized users. We employed Linux commands to adjust permissions on both regular and hidden files, ensuring that only authorized users have the appropriate levels of access. Additionally, we refined the access controls on a critical directory to restrict access solely to the intended user. These actions enhanced the security posture of the organization's file system.

Portfolio Activity: Apply filters to SQL queries

In this activity, you will create a new portfolio document to demonstrate your experience using SQL

Scenario

You are a security professional at a large organization. Part of your job is to investigate security issues to help keep the system secure. You recently discovered some potential security issues that involve login attempts and employee machines.Your task is to examine the organization’s data in their employees and log_in_attempts tables. You’ll need to use SQL filters to retrieve records from different datasets and investigate the potential security issues.

Project Description

In this project, I tackled various security-related challenges within a large organization by leveraging SQL queries to filter through employee and login attempt data. The objective was to identify potential security vulnerabilities and ensure the integrity of the organization's IT infrastructure. Through a series of targeted SQL queries, I was able to investigate suspicious login activities, pinpoint employees for necessary security updates based on their department and office location, and ensure that all non-IT department employees received critical updates. This comprehensive approach allowed for a detailed analysis of security posture and the implementation of measures to safeguard sensitive information.

Retrieve after hours failed login attempts

SELECT * FROM log_in_attempts WHERE login_time > '18:00:00' AND success = FALSE;

How It Works

SELECT * FROM log_in_attempts: This part of the query selects all columns from the log_in_attempts table. This allows you to review all details of each login attempt that meets your criteria.

WHERE login_time > '18:00:00': This filter condition specifies that you only want to see records where the login_time is later than 18:00:00 (6 PM). This focuses the query on after-hours login attempts, as any login time after 18:00:00 is considered to be outside of regular business hours.

AND success = FALSE: This condition further filters the results to only include unsuccessful login attempts. The success column uses a Boolean value to indicate whether the login attempt was successful. In some databases, you might use 0 instead of FALSE if the column is stored as an integer type that represents Boolean values (with 0 for false and 1 for true). This condition ensures you're only looking at failed login attempts.

Combining these conditions with the AND operator means that a record must meet both criteria to be included in the results: it must be a failed login attempt (success = FALSE) that occurred after 18:00:00.

When you execute this query it will return all records from the log_in_attempts table that match these conditions, allowing you to investigate each after-hours failed login attempt in detail.

Retrieve login attempts on specific dates

SELECT * FROM log_in_attempts WHERE login_date = '2022-05-09' OR login_date = '2022-05-08';

How it works

SELECT * FROM log_in_attempts: This selects all columns from the log_in_attempts table, allowing you to review every detail of each login attempt that meets the criteria outlined in the WHERE clause.

WHERE login_date = '2022-05-09' OR login_date = '2022-05-08': This condition filters the records to include only those where the login_date matches either 2022-05-09 or 2022-05-08. The OR operator is used to ensure that the query returns login attempts from both days, not just one or the other.

This query effectively narrows down the dataset to the login attempts of interest, specifically focusing on the days surrounding the suspicious event.

Retrieve login attempts outside of Mexico

SELECT * FROM log_in_attempts WHERE country NOT LIKE 'MEX%' AND country NOT LIKE 'MEXICO%';

How it works

SELECT * FROM log_in_attempts: This command selects all columns from the log_in_attempts table to review every detail of each login attempt.

WHERE country NOT LIKE 'MEX%' AND country NOT LIKE 'MEXICO%': This condition filters the records to exclude those where the country column matches any value starting with 'MEX' or 'MEXICO'. The LIKE keyword allows for pattern matching, where '%' is a wildcard character that matches any sequence of characters. The NOT operator is used to invert the condition, so the query selects records where country does not match the specified patterns.

NOT LIKE 'MEX%' ensures that variations starting with 'MEX' (such as 'MEXICO', 'MEXICAN', etc.) are excluded. AND ensures that both conditions must be true for a record to be included in the results. However, since 'MEXICO%' is a subset of 'MEX%', the second condition is technically redundant in this specific context but included here for clarity on how to use LIKE with variations. This query will return all login attempts where the attempt did not originate from Mexico, helping you to focus on the suspicious activity that occurred from outside the country.

Retrieve employees in Marketing

SELECT * FROM employees WHERE department = 'Marketing' AND office LIKE 'East-%';

How it works

SELECT * FROM employees: This command selects all columns from the employees table. This allows you to review all details of each employee that meets the criteria specified in the WHERE clause.

WHERE department = 'Marketing': This condition filters the records to include only those employees who are in the Marketing department. It ensures that the query returns only the relevant employees based on their departmental affiliation.

AND office LIKE 'East-%': This condition further narrows down the selection to those employees whose office location starts with "East-". The LIKE keyword is used for pattern matching, where 'East-%' specifies that the office column value must start with "East-" followed by any sequence of characters. This effectively filters the results to include only those employees located in offices within the East building.

By combining these conditions with the AND operator, the query specifically targets employees who are both in the Marketing department and located in the East building. This allows you to efficiently identify the specific machines that need security updates within that group.

Retrieve employees in Finance or Sales

SELECT * FROM employees WHERE department = 'Sales' OR department = 'Finance';

How it works

SELECT * FROM employees: This part of the query selects all columns from the employees table, which allows you to review comprehensive details about each employee that meets the subsequent criteria.

WHERE department = 'Sales' OR department = 'Finance': This filter condition specifies that you want to include records where the department exactly matches either 'Sales' or 'Finance'. The OR operator is used here to ensure that the query captures employees from both departments, not just one.

This query effectively targets employees belonging to the two specified departments.

Retrieve all employees not in IT

SELECT * FROM employees WHERE NOT (department = 'Information Technology');

How it works

SELECT * FROM employees: This command selects all columns from the employees table, allowing you to review every detail of each employee that meets the criteria specified in the WHERE clause.

WHERE department != 'Information Technology': This filter condition excludes records where the department exactly matches 'Information Technology'. The != operator (or <> in some SQL dialects) is used to select records where the department value is not equal to 'Information Technology'.

Alternatively, WHERE NOT (department = 'Information Technology'): This approach achieves the same outcome by explicitly stating the exclusion of the Information Technology department using the NOT operator around the condition. This query will return all employees who are not part of the IT department, enabling your team to identify which machines need the specified update.

Summary

Throughout this project, I demonstrated the practical application of SQL filters to address a range of security concerns within an organizational setting. Initially, I focused on identifying failed login attempts outside of standard business hours and from locations outside of Mexico to pinpoint potential unauthorized access attempts. Subsequently, I used SQL queries to select specific employee groups based on departmental affiliation for targeted security updates, excluding those in the IT department who had already received these updates. This systematic use of SQL queries not only enhanced the organization's security measures but also showcased the versatility and power of SQL in managing and securing enterprise data. Through this project, I illustrated the critical role of data analysis in maintaining and improving organizational security.

Portfolio Activity: Analyze a vulnerable system for a small business

In this activity, I will conduct a vulnerability assessment for a small business. A vulnerability assessment is the internal review process of an organization’s security systems. I will evaluate the risks of a vulnerable information system and outline a remediation plan.

Scenario

You are a newly hired cybersecurity analyst for an e-commerce company. The company stores information on a remote database server, since many of the employees work remotely from locations all around the world. Employees of the company regularly query, or request, data from the server to find potential customers. The database has been open to the public since the company's launch three years ago. As a cybersecurity professional, you recognize that keeping the database server open to the public is a serious vulnerability.

You are tasked with completing a vulnerability assessment of the situation to communicate the potential risks to decision makers at the company. You must create a written report that explains how the vulnerable server is a risk to business operations and how it can be secured.

Vulnerability Assessment Report

13th March 2024

System Description

The server hardware consists of a powerful CPU processor and 128GB of memory. It runs on the latest version of Linux operating system and hosts a MySQL database management system. It is configured with a stable network connection using IPv4 addresses and interacts with other servers on the network. Security measures include SSL/TLS encrypted connections.

Scope

The scope of this vulnerability assessment relates to the current access controls of the system. The assessment will cover a period of three months, from March 2024 to August 2024. NIST SP 800-30 Rev. 1 is used to guide the risk analysis of the information system

Purpose Statement

The purpose of this vulnerability assessment is to protect and maintain the operational integrity, confidentiality, and availability of our business's database server. By securing the data stored on this server, we aim to prevent unauthorized access, and data breaches, and ensure compliance with relevant regulations, thus safeguarding our competitive position and customer trust. Recognizing the critical role this server plays in our daily operations and strategic decision-making, this analysis is crucial in preventing disruptions that could result in significant financial losses and reputational damage, thereby supporting our organization's goals of resilience and continuous service delivery.

Identify potential Threat sources based on the system description, scope, purpose, and insights from NIST SP 800-30 Rev. 1

Privileged User Threat

Description: Privileged users, such as system administrators, have extensive access rights to the database server and its configurations. While necessary for maintenance and management, this access also poses a risk. Malicious actions or inadvertent errors by privileged users could lead to significant data breaches, unauthorized data alteration, or system downtime. For example, a disgruntled employee with administrative access might intentionally compromise the system's integrity or inadvertently misconfigure security settings, leading to vulnerabilities.

Outsider Threat

Description: Outsiders, including hackers, hacktivists, and Advanced Persistent Threats (APTs), represent a significant risk to the database server. These actors, motivated by financial gain, political agendas, or the challenge of breaching defences, can exploit vulnerabilities to gain unauthorized access, steal sensitive data, or disrupt business operations. For instance, an APT could launch sophisticated, targeted attacks to siphon off critical business intelligence or personal data of customers, resulting in financial loss and reputational damage.

Software Threat

Description: The server's operating system and database management software are fundamental to its operation but can also be sources of vulnerability. Software threats include unpatched security vulnerabilities, zero-day exploits, and malicious software (malware) that can be used to gain unauthorized access, escalate privileges, or execute malicious actions. For example, an unpatched vulnerability in the database software could allow an attacker to inject SQL commands and manipulate or extract data, compromising the confidentiality and integrity of stored information.

Identify Potential threats event

Unauthorized Access by Privileged Users

Threat Event Description: A privileged user might exploit their access rights to gain unauthorized access to sensitive areas of the database server not required for their role. This could be either intentional, as in the case of a disgruntled employee seeking to extract or sabotage data, or accidental, due to negligence or lack of awareness regarding security protocols. The event may involve accessing, copying, or transmitting sensitive data without authorization, leading to a breach of confidentiality and potential data loss.

External Breach Through Software Vulnerabilities

Threat Event Description: Attackers exploit unpatched vulnerabilities or inherent flaws in the software running on the database server. This event can lead to unauthorized access, data exfiltration, or the deployment of malware. Hackers, APTs, or other external parties might use these vulnerabilities to bypass security mechanisms, elevate privileges, or execute malicious code, aiming to steal sensitive data, disrupt operations, or establish a persistent presence on the network.

Denial of Service (DoS) Attack

Threat Event Description: An external party, such as a competitor, hacker, or hacktivist, could launch a DoS attack against the database server. By overwhelming the server with a flood of traffic or exploiting a vulnerability to crash the system, attackers can render the database service unavailable to legitimate users. This event primarily aims to disrupt business operations, causing operational delays, financial loss, and damage to the organization's reputation. Such an attack could be motivated by a desire to harm the company's competitive standing or as a form of protest by hacktivists.

Calculate the Risk of Potential Threats

Let's assess each identified threat event based on the questions and score them according to the Likelihood and Severity, followed by calculating the overall Risk score. The scores range from 1 (Low) to 3 (High).

1. Unauthorized Access by Privileged Users

How frequently could this happen? Given that privileged users have constant access to the system, the risk of unauthorized access, whether intentional or accidental, is moderate. Would critical business functions be impacted? Yes, unauthorized access could lead to critical data being compromised, affecting business operations and customer trust. How might this affect the business and its customers? The business could face legal, financial, and reputational damage, while customers could suffer from privacy breaches and potential financial loss. Likelihood Score: 2 (Moderate) Severity Score: 3 (High) Risk Score: 2 x 3 = 6

2. External Breach Through Software Vulnerabilities How frequently could this happen? The frequency depends on the public knowledge of the vulnerability and the speed of the response by the IT team. However, with constant scanning by attackers, the likelihood is moderate to high. Would critical business functions be impacted? Yes, an external breach could severely impact critical business functions by compromising data integrity and availability. How might this affect the business and its customers? Such a breach could lead to significant financial losses, damage to reputation, and erosion of customer trust, especially if sensitive customer data is exposed. Likelihood Score: 3 (High) Severity Score: 3 (High) Risk Score: 3 x 3 = 9

3. Denial of Service (DoS) Attack How frequently could this happen? DoS attacks are increasingly common, especially for businesses with significant online presences. The likelihood is moderate to high, depending on the visibility of the business and its perceived value as a target. Would critical business functions be impacted? Yes, a successful DoS attack would directly impact the availability of the database server, hindering critical business operations and customer transactions. How might this affect the business and its customers? The immediate impact would be operational disruption and potential loss of revenue. Customers may experience service unavailability, which could lead to dissatisfaction and loss of trust. Likelihood Score: 3 (High) Severity Score: 2 (Moderate) Risk Score: 3 x 2 = 6

Proposed Reccomandations

In conducting this qualitative vulnerability assessment, the selection of the three specific threat sources/events—Unauthorized Access by Privileged Users, External Breach Through Software Vulnerabilities, and Denial of Service (DoS) Attack—was guided by an analysis of the database server's critical role within the organization and its exposure to both internal and external threat actors. These events were identified as significant business risks due to their potential to compromise the confidentiality, integrity, and availability of critical data, which could result in substantial financial losses, reputational damage, and erosion of customer trust. The evaluation leverages subjective judgment, rooted in security knowledge and understanding of the organization's operational context, to estimate the likelihood and severity of these threats. This approach prioritizes identifying high-level risks that necessitate immediate attention for mitigation and informs strategic decisions on resource allocation and security measures to protect the organization's digital assets and business operations.

Proposed Remediation Strategy

To remediate or mitigate the risks identified in the vulnerability assessment, several strategic security controls can be implemented. For the risk of Unauthorized Access by Privileged Users, enforcing the Principle of Least Privilege through rigorous access control policies ensures that users have only the access necessary to perform their duties, minimizing potential abuse. To address External Breach Through Software Vulnerabilities, a Defense in Depth strategy incorporating regular software updates, vulnerability scanning, and intrusion detection systems can provide layered security against various attack vectors. For mitigating Denial of Service (DoS) Attacks, implementing Multi-factor Authentication (MFA) alongside an Authentication, Authorization, and Accounting (AAA) framework strengthens user verification processes and limits the impact of compromised credentials, while network resilience measures, such as redundant network paths and DDoS protection services, help maintain availability during an attack. These controls, tailored to the specific risks, enhance the security posture by not only preventing incidents but also minimizing their impact, thereby protecting critical business functions and data integrity.

#Document an incident with an incident handler's journal In this activity, you will review the details of a security incident and document the incident using your incident handler's journal.

Scenario

A small U.S. health care clinic specializing in delivering primary-care services experienced a security incident on a Tuesday morning, at approximately 9:00 a.m. Several employees reported that they were unable to use their computers to access files like medical records. Business operations shut down because employees were unable to access the files and software needed to do their job.

Additionally, employees also reported that a ransom note was displayed on their computers. The ransom note stated that all the company's files were encrypted by an organized group of unethical hackers who are known to target organizations in healthcare and transportation industries. In exchange for restoring access to the encrypted files, the ransom note demanded a large sum of money in exchange for the decryption key.

The attackers were able to gain access into the company's network by using targeted phishing emails, which were sent to several employees of the company. The phishing emails contained a malicious attachment that installed malware on the employee's computer once it was downloaded.

Once the attackers gained access, they deployed their ransomware, which encrypted critical files. The company was unable to access critical patient data, causing major disruptions in their business operations. The company was forced to shut down their computer systems and contact several organizations to report the incident and receive technical assistance.

Incident handler's journal

Date: 14.03.2024

Entry: #1

Description: Today, we are examining an incident that occurred on a Tuesday morning around 9:00 AM. Employees of a small healthcare clinic in the US were targeted by a group of unethical activists. Through a phishing attack, the activists tricked the employees into installing malware that encrypted files and demanded a large sum of money for decryption. As a result, the clinic had to shut down its operations because they were unable to access critical patient data. Additionally, they were forced to shut down their computers and report the incident to obtain technical assistance.

Tool(s) used: None known at the moment

The 5 W's:

  • Who caused the incident? The Incident was caused by a group of unethical hacktivists

  • What happened? The unethical hacktivist group targeted the company's employees with a mass phishing attack, tricking them into installing malware on their computers. Once the hacktivists gained access to the company's network, they deployed ransomware to encrypt critical patient data. They then demanded a large sum of money in exchange for the decryption key.

  • When did the incident occur? The incident occurred on a Tuesday morning around 9:00 AM

  • Where did the incident happen? The incident occurred at a small healthcare clinic in the US, specialized in delivering primary care services. It initially affected many employees' computers before spreading to the company's network.

  • Why did the incident happen? It appears that the employees were not adequately trained in recognizing phishing emails, which led to them being tricked by a fraudulent email into installing malware on their computers

    Additional notes: We are yet to determine how the hacktivists gained access to the company's email system, and we cannot rule out the possibility of an insider's involvement. Furthermore, our ongoing efforts include devising a strategy for recovery to restore the company's operations. It is also crucial to ascertain whether the company has backups of the affected files and to identify the specific information compromised in the attack. Date: 14.03.2024

Entry: #2

Date: 15.03.2024

*Description:*In this analysis, I delved into a packet capture file using Wireshark, a network protocol analyzer.

Tool(s) used: Wiresharks

The 5 W's:

  • Who caused the incident? No info

  • What happened? No Info

  • When did the incident occur? No info

  • Where did the incident happen? No info

  • Why did the incident happen? No info

    Additional notes: Before this exercise, I had no experience with Wireshark, sparking a sense of excitement at the prospect of analyzing a packet capture file. Initially, the complexity of Wireshark's interface was daunting, presenting an array of options and data that seemed impenetrable at first. This experience quickly shed light on the tool's esteemed reputation for dissecting network traffic. Its comprehensive capabilities for capturing and analyzing data packets make it evident why Wireshark is considered an indispensable asset in network analysis and cybersecurity.

Entry: #3

Date: 16.03.2024

Description: TCPdump Capturing Packages.In this activity, I utilized tcpdump to capture and scrutinize network traffic. Tcpdump stands as a network protocol analyzer that operates via the command-line interface. It empowers security analysts with the ability to capture, sift through, and interpret network traffic. This command-line tool is essential for delving into the intricacies of network communications, aiding analysts in identifying and mitigating potential security threats.

*Tool(s) used:*TCPdump on linux

The 5 W's:

  • Who caused the incident? no info

  • What happened? no info

  • When did the incident occur? no info

  • Where did the incident happen? no info

  • Why did the incident happen? no info

    Additional notes: It was nice to see that my Linux skills are not rusty and that I could use well the commands. I found the sue of TCPdump usefull and straightforward.

Entry: #4

Date: 16.03.2024

Description: I needed to investigate a suspicious file hash. With this Scenario, I leveraged VirusTotal, a comprehensive tool designed for the detection of malicious content, including viruses, worms, trojans, and other threats. VirusTotal proves invaluable for swift examinations of potential indicators of compromise, such as files or websites, by checking if they have been flagged as malicious by the cybersecurity community. For this particular task, I used VirusTotal to scrutinize a file hash, which was indeed identified as malicious. This activity unfolded during the Detection and Analysis phase, positioning me in the role of a security analyst within a Security Operations Center (SOC). Faced with a suspicious file hash flagged by our security infrastructure, it became imperative to conduct a thorough investigation to ascertain the legitimacy of the threat. This deeper analysis was crucial in determining whether the alert was indicative of an actual security risk, underscoring the critical nature of accurate threat detection and analysis in maintaining organizational security.

Tool(s) used: Virus total

The 5 W's:

  • Who caused the incident? An unknown malicious actor targeted a financial services company, orchestrating a cybersecurity incident through a deceptive email.

  • What happened? This email, sent to an unsuspecting employee, harboured a malicious file attachment. The nefarious nature of this file was underscored by its SHA-256 hash value, 54e6ea47eb04634d3e87fd7787e2136ccfbcc80ade34f246a12cf93bab527f6b, marking it as a significant security threat.

  • When did the incident occur? The security breach was promptly identified at 1:20 p.m., when the organization's intrusion detection system flagged the suspicious file, triggering an immediate alert to the company's Security Operations Center (SOC).

  • Where did the incident happen? The incident unfolded within the digital confines of an employee's computer at the company.

  • Why did the incident happen? The root cause of this security lapse was traced back to the employee's action of downloading and executing the email attachment, a lapse in vigilance that facilitated the entry of the malicious file into the company's network. This event highlights the critical importance of cybersecurity awareness and the need for robust security measures to preempt such threats.

    Additional notes: It is mandatory to reflect and understand how we can avoid this issue in the future. Probably a retrospective about the cause and lessons learned needs to be done to understand the next steps for us.

    Reflections /Notes

Challenges Encountered:

The use of splunk presented a significant learning curve for me, particularly as someone new to use their user interface. Grappling with the syntax required for Splunk was a steep learning curve that initially led to frustration due to incorrect outputs. However, upon revisiting the activity and meticulously reviewing the instructions, I identified and rectified my errors. This experience taught me the value of patience and the importance of thoroughly understanding the instructions before proceeding.

Evolving Understanding of Incident Detection and Response: My comprehension of incident detection and response has markedly improved after completing this course. Initially, my grasp of the subject was rudimentary, knowing only the basic contours of what detection and response involved without appreciating its intricacies. The course provided deep insights into the incident lifecycle, underscored the criticality of having robust plans, processes, and teams in place, and introduced a variety of tools integral to this domain. I emerge from this course with a richer understanding and a solid foundation in incident detection and response. I really like to understand what threat hunters do and it has increased my interest on being in blue or purple team

Favorite Tool/Concept: The aspect of the course I found most engaging was the segment on network traffic analysis. Being my first foray into this area, I was equally challenged and intrigued. The ability to capture and analyze network traffic in real time using network protocol analyzers was captivating. This introduction has sparked a keen interest in delving deeper into network traffic analysis, and I am eager to further develop my skills in this area, with the goal of achieving proficiency in the use of network protocol analyzers.

Portfolio Activity: Update a file through a Python algorithm

In this activity, you will create a new portfolio document to demonstrate your experience using Python to develop algorithms that involve opening files and parsing their contents

Scenario

You are a security professional working at a health care company. As part of your job, you're required to regularly update a file that identifies the employees who can access restricted content. The contents of the file are based on who is working with personal patient records. Employees are restricted access based on their IP address. There is an allow list for IP addresses permitted to sign into the restricted subnetwork. There's also a remove list that identifies which employees you must remove from this allow list.

Your task is to create an algorithm that uses Python code to check whether the allow list contains any IP addresses identified on the remove list. If so, you should remove those IP addresses from the file containing the allow list.

Algorithm for file updates in Python

Project description

A hospital or healthcare company needs to keep patient records. Due to this, we need to ensure that only certain employees can look at these private records online. Each employee uses a computer with a unique "address" (called an IP address) to access these records. Via a list, known as the "allow list," which names all the computer addresses that can access these sensitive records, we are going to make sure that only the IP addresses in that list are allow to see the records and we will remove the IP addresses that are not allowed to see the records.

Sometimes, an employee's access needs to be taken away for various reasons. Their computer addresses are then put on a "remove list." So we need to check the allow list and ensure none of the addresses on the remove list can still get into the restricted records.

Open the file that contains the allowed list

#Assign import_file to the name of the file

import_file = "allow_list.txt"

#Assign remove_list to a list of IP addresses that are no longer allowed to access restricted information.

remove_list = ["192.168.97.225", "192.168.158.170", "192.168.201.40", "192.168.58.57"]

#First line of with statement

with open(import_file,"r")as file: print(file.read())

Read the file contents

In this section of the algorithm, we aim to read the contents of a file named "allow_list.txt" and store these contents as a string in a variable for further processing. The steps involve opening the file, reading its contents, and then storing these contents.

Reading the File:

ip_addresses = file.read(): Inside the with block, we call the .read() method on our file object. This method reads the entire content of the file and returns it as a single string. We assign this string to the variable ip_addresses, which now contains all the data from "allow_list.txt".

Displaying the Contents:

print(ip_addresses): Finally, we print the contents of ip_addresses to verify that we have successfully read the file. This step is useful for debugging and ensuring that the data is loaded as expected.

#Assign import_file to the name of the file

import_file = "allow_list.txt"

#Assign remove_list to a list of IP addresses that are no longer allowed to access restricted information.

remove_list = ["192.168.97.225", "192.168.158.170", "192.168.201.40", "192.168.58.57"]

#Build with statement to read in the initial contents of the file

with open(import_file, "r") as file:

#Use .read() to read the imported file and store it in a variable named ip_addresses

ip_addresses = file.read()

#Display ip_addresses

print(ip_addresses)

Convert the string into a list

To accomplish the task of converting the ip_addresses string into a list we are using the .split() method.

Convert the String into a List After successfully reading the contents of "allow_list.txt" into a string variable named ip_addresses, the next step involves transforming this string into a list of individual IP addresses. This conversion is necessary for easier manipulation of the data, particularly for the task of removing specific IP addresses identified in the remove_list.

Using the .split() Method:

ip_addresses = ip_addresses.split(): This line of code applies the .split() method to the ip_addresses string. By default, .split() divides a string into a list based on whitespace, including spaces, tabs, and newlines. Since our IP addresses are expected to be separated by spaces or newlines, this method will effectively create a list where each element is an individual IP address from the original string.

Variable Reassignment:

By reassigning ip_addresses = ip_addresses.split(), we overwrite the original string with a list of substrings, each representing an IP address that was separated by whitespace in the original string.

Displaying the Result:

print(ip_addresses): To verify the successful conversion of the string to a list, we print ip_addresses. This will display the list of IP addresses, now each as a separate element within the list, making it clear that the conversion was successful.

#Assign import_file to the name of the file

import_file = "allow_list.txt"

#Assign remove_list to a list of IP addresses that are no longer allowed to access restricted information.

remove_list = ["192.168.97.225", "192.168.158.170", "192.168.201.40", "192.168.58.57"]

#Build with statement to read in the initial contents of the file

with open(import_file, "r") as file:

#Use .read() to read the imported file and store it in a variable named ip_addresses

ip_addresses = file.read()

#Use .split() to convert ip_addresses from a string to a list

ip_addresses = ip_addresses.split()

#Display ip_addresses

print(ip_addresses)

Iterate through the remove list

To iterate through the remove_list and use element as the loop variable, we need to set up a for loop that goes through each IP address in remove_list. Once we have a list of IP addresses (ip_addresses) from the "allow_list.txt" file and a remove_list containing IP addresses to be removed, we need to iterate through remove_list to identify and remove the specified addresses from ip_addresses. The for loop in Python iterates over each item in a sequence (in this case, the remove_list) one at a time. For each iteration, the item is temporarily assigned to a loop variable (here, element), which can then be used within the loop body. #Assign import_file to the name of the file

import_file = "allow_list.txt"

#Assign remove_list to a list of IP addresses that are no longer allowed to access restricted information.

remove_list = ["192.168.97.225", "192.168.158.170", "192.168.201.40", "192.168.58.57"]

#Build with statement to read in the initial contents of the file

with open(import_file, "r") as file:

#Use .read() to read the imported file and store it in a variable named ip_addresses

ip_addresses = file.read()

#Use .split() to convert ip_addresses from a string to a list

ip_addresses = ip_addresses.split()

#Build iterative statement #Name loop variable element #Loop through ip_addresses

for element in ip_addresses:

#Display element in every iteration

print(element)

Remove IP addresses that are on the remove list

Once we have both the allow list (ip_addresses list) and the remove list (remove_list) prepared, we must ensure that any IP address on the remove list is eliminated from the allow list. This process involves iterating through the list of IP addresses to be removed and checking if they are present in the allowed list. We do that with an iterative Statement (For Loop):Iterate through each element in the remove_list to check if it's present in the ip_addresses list. If so, it should be removed. After we add a conditional Statement (If): The if statement checks whether the current element from remove_list is in the ip_addresses list. The last thing we need to do is to remove an Element: The .remove() method is used to remove the first matching value (which in this case is element) from the ip_addresses list.

#Assign import_file to the name of the file

import_file = "allow_list.txt"

#Assign remove_list to a list of IP addresses that are no longer allowed to access restricted information.

remove_list = ["192.168.97.225", "192.168.158.170", "192.168.201.40", "192.168.58.57"]

#Build with statement to read in the initial contents of the file

with open(import_file, "r") as file:

#Use .read() to read the imported file and store it in a variable named ip_addresses

ip_addresses = file.read()

#Use .split() to convert ip_addresses from a string to a list

ip_addresses = ip_addresses.split()

#Build iterative statement #Name loop variable element #Loop through ip_addresses

for element in ip_addresses:

#Build conditional statement #If current element is in remove_list,

if element in remove_list:

#then current element should be removed from ip_addresses

ip_addresses.remove(element)

#Display ip_addresses

print(ip_addresses)

Update the file with the revised list of IP addresses

After filtering the ip_addresses list to remove the entries found in remove_list, the final step in our algorithm involves updating the original file with this revised list. To accomplish this, we must first convert the list back into a string, using the .join() method for formatting. Then, we use the .write() method to overwrite the original file with the updated contents.

Converting the List to a String Using .join() Method: The .join() method is used to concatenate the elements of a list into a single string, with each element separated by a specified delimiter. In this case, we use "\n" (newline character) as the delimiter to ensure each IP address appears on a new line in the file.

ip_addresses_str = "\n".join(ip_addresses)

This line creates a string ip_addresses_str where each IP address from the ip_addresses list is separated by a newline character, preparing it for writing to the file in a properly formatted manner. Writing the Updated List to the File Opening the File for Writing: To update the file, we open it again, this time in write mode ("w"). This mode allows us to write new content to the file, replacing its existing contents.

with open(import_file, "w") as file:

Within this with statement, the file variable now refers to the opened file in write mode.

Using .write() Method: The .write() method writes a string to the file. Here, we use it to write the ip_addresses_str string to the file, effectively updating it with the revised list of IP addresses.

file.write(ip_addresses_str)

This operation replaces the content of import_file with the updated, newline-separated string of IP addresses.

Summary

The algorithm begins by reading the current "allow list" from a file, converting its contents into a manipulatable list of IP addresses. It then cross-references these addresses with a predefined "remove list" to identify which IPs need to be excluded. Through careful iteration and condition checking, any matching addresses are removed from the allow list, ensuring it reflects only currently authorized access. Finally, the updated list is converted back into a string, formatted for readability with each IP address on a new line, and written back to the original file. This process not only automates a critical security function but also demonstrates the power of Python for handling and manipulating file-based data efficiently.

About

A Portfolio with all the project related to cyber-security I have worked on

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published