TutorChase logo
Login
AQA A-Level Computer Science

18.3.12 Prevention and Mitigation

Understanding how to prevent and mitigate threats is vital to maintaining a secure networked environment. This topic explores methods that reduce vulnerabilities and detect malicious activity.

Secure coding practices

Writing software securely is one of the most effective ways to reduce vulnerabilities that malicious users could exploit. Secure coding practices involve following certain principles and avoiding common mistakes when developing software.

Importance of secure coding

Software vulnerabilities often arise due to poor coding practices. Attackers exploit these flaws to gain unauthorised access, execute malicious commands, or cause system failures. By writing secure code, developers proactively reduce the attack surface of an application.

Secure coding helps prevent:

  • Injection attacks (e.g. SQL injection, command injection)

  • Buffer overflows

  • Data leaks

  • Unauthorised access to memory or files

Key secure coding principles

  • Input validation: Always check and sanitise input data. Unvalidated input can lead to injection attacks. For example, a form asking for a user's name should reject inputs that contain special characters or scripts.

  • Output encoding: Escape any output that is displayed to users or sent to a browser to avoid cross-site scripting (XSS).

  • Avoid hardcoded secrets: Storing usernames, passwords, or encryption keys in source code makes them vulnerable if the code is leaked.

  • Use parameterised queries: When interacting with a database, use queries that separate the command from the data, making it difficult for attackers to inject SQL commands.

Take your grades to the next level!

UPGRADING TO PREMIUM UNLOCKS
AI Tutor
AI-powered study assistant
instant feedback and guidance
Predicted Papers
Examiner-style predicted papers
based on recent exam trends
Practice Questions
All exam practice questions
by topic for each subject
Study Notes
All detailed revision notes
written by expert teachers
Cheat Sheets
Quick revision summaries
perfect for last-minute review
Past Papers
Complete collection
of practice and past exam papers
Email
Password
Confirm Password
Already have an account?

Practice Questions

FAQ

Proactive cyber security measures are designed to prevent security incidents before they happen. These include secure coding practices, code reviews, vulnerability assessments, employee training, and regular software patching. They focus on reducing the likelihood of a successful attack by addressing potential weaknesses in systems and user behaviour. Reactive measures, on the other hand, are employed after a threat has been detected or an attack has occurred. These include intrusion detection systems (IDS), antivirus software, incident response plans, and forensic analysis. Reactive tools help contain the threat, assess damage, and recover systems. In a well-structured security strategy, both approaches are used in tandem. Proactive measures reduce the risk and surface area for attacks, while reactive tools ensure quick identification and mitigation of breaches. This layered defence strategy—often referred to as defence in depth—ensures that if one layer fails, others can detect or limit the impact of an incident, maintaining overall system resilience.

Zero-day vulnerabilities are previously unknown software flaws that attackers exploit before the developer becomes aware and can release a fix. These flaws are particularly dangerous because no patches exist at the time of exploitation, and traditional antivirus tools, which rely on known signatures, often cannot detect them. Prevention strategies like secure coding aim to reduce the likelihood of such vulnerabilities being introduced in the first place. However, since some flaws are subtle or complex, zero-day vulnerabilities can still occur despite best efforts. Mitigation relies heavily on anomaly-based intrusion detection systems, which can flag unusual behaviour patterns, and sandboxing, which allows the safe execution and observation of potentially malicious files. These tools help limit the impact of a zero-day exploit by detecting signs of compromise or isolating harmful processes. Organisations also implement rapid response protocols and threat intelligence sharing to quickly react to and contain such attacks once discovered, minimising long-term damage.

Logging is crucial in cyber security because it provides a detailed record of system and network activity, which can be used to detect, investigate, and respond to incidents. Logs help identify unauthorised access attempts, suspicious behaviour, policy violations, and system changes. In the event of a breach, logs enable forensic analysis to determine how an attacker gained access, what actions were taken, and whether data was compromised. Effective logging should include login attempts (successful and failed), file and configuration changes, application errors, network traffic, firewall events, and access to sensitive data. Logs from antivirus tools, IDS, and servers are particularly valuable. It’s also important to ensure logs are securely stored, time-stamped, and protected from tampering. Centralised log management systems and SIEM (Security Information and Event Management) platforms help correlate events across systems and automate alerting, enabling quicker responses to potential threats. Without proper logging, attackers may go undetected, and response efforts are hindered.

Configuration management ensures that systems are consistently and securely set up across an organisation’s infrastructure. It involves maintaining a known and approved configuration for hardware, software, and network devices, reducing the risk of misconfigurations that attackers could exploit. System hardening, a related concept, focuses on reducing vulnerabilities by disabling unnecessary services, removing default accounts, restricting user permissions, and enforcing strict security settings. For example, disabling unused ports, uninstalling redundant applications, and applying secure configuration templates are common hardening techniques. Both practices help enforce uniform security controls and minimise attack surfaces. Tools such as configuration management databases (CMDBs), automated deployment scripts, and compliance scanners ensure that systems remain in a secure state. If deviations are detected, alerts can be triggered, or corrections can be made automatically. By maintaining consistent, secure configurations and hardening systems, organisations significantly reduce the risk of both automated and targeted attacks exploiting poorly secured or misconfigured systems.

Network segmentation divides a network into separate segments or zones, each isolated from others using firewalls, VLANs, or routing rules. This structure limits communication between parts of the network, so if malware or an attacker compromises one segment, they cannot easily access others. For example, user workstations can be placed in one segment, while servers and critical infrastructure are kept in another. Segmentation prevents lateral movement—where an attacker moves across systems once inside the network—which is a common tactic in advanced persistent threats (APTs) and ransomware attacks. It also allows for tailored security policies per segment, such as stricter controls on sensitive data areas. When combined with monitoring tools, segmentation makes it easier to detect anomalies within each zone and respond quickly. For instance, unusual access from a user network to a server segment can trigger an alert. Overall, segmentation strengthens internal defences, reducing the impact of breaches and improving containment.

Hire a tutor

Please fill out the form and we'll find a tutor for you.

1/2
Your details
Alternatively contact us via
WhatsApp, Phone Call, or Email