Fun with Learning Technology
LearnCoursesQuestionsTracksToolsNewsExplorePractice
Fun with Learning Technology

A new problem, explained clearly, every day.

Subscribe
Learn
  • Lessons
  • Topics
  • News
  • Tools
  • Courses
  • Career tracks
  • Everything
Site
  • About
  • Contact
  • Support
  • Privacy
  • Terms
Get the daily one

One email per new problem. No spam.

Request a tutorial

Requests shape what gets made next.

© 2026 Fun with Learning TechnologyRSS
Home›Courses›cyber security›What are the OWASP Top 10 vulnerabilities, and how can they be mitigated?

Interview Prep

What are the OWASP Top 10 vulnerabilities, and how can they be mitigated?

The OWASP Top 10 is a prioritized, awareness-focused document representing the most critical security risks to web applications based on industry consensus. It matters because it provides a standardized framework for developers and security professionals to identify, rank, and remediate high-impact vulnerabilities. You reach for it during the design, coding, and testing phases of the software development lifecycle to ensure robust security posture against common attack vectors.

Broken Access Control

Broken Access Control occurs when a system fails to enforce restrictions on what authenticated users are allowed to do. At its core, the vulnerability exists because the application relies on client-side requests—like URL parameters or hidden form fields—to determine the authorization level of a user rather than verifying permissions server-side for every single request. If a developer assumes that a user cannot see a hidden administrative button and fails to check the user's role on the backend during the data fetch, an attacker can simply manually trigger the API endpoint to gain unauthorized access. Mitigation involves enforcing a centralized access control mechanism where every request is evaluated against an explicit allow-list. By implementing a strict policy that denies all access by default and only grants specific permissions based on the session's verified identity, you ensure that even if an attacker manipulates the request, the server will reject the operation.

# Example of secure server-side check
function deleteUser(request, targetUserId) {
    // Always verify the authenticated user's role before processing the action
    if (request.user.role !== 'ADMIN') {
        throw new Error('Unauthorized'); // Deny by default
    }
    // Proceed with deletion only after authorization is verified
    database.execute('DELETE FROM users WHERE id = ?', [targetUserId]);
}

Injection Attacks

Injection vulnerabilities manifest when untrusted data is sent to an interpreter as part of a command or query. The fundamental flaw is the lack of separation between the control logic of the command and the user-supplied data, allowing the data to alter the meaning of the command itself. When an application concatenates user input directly into a database query string, the interpreter cannot distinguish between the intended logic and the injected malicious syntax. By treating everything in the string as part of the execution plan, the system inadvertently grants the user command-level authority. To mitigate this, you must always use parameterized queries or prepared statements. This technique ensures that the database driver treats input strictly as data, never as executable code, effectively neutralizing any attempt to alter the query structure regardless of what characters the user inputs into the form fields.

# Secure way to query the database using prepared statements
const userId = "'1' OR '1'='1'"; // Malicious input
// The query engine treats the input as a single literal string value, not executable code
database.execute('SELECT * FROM users WHERE id = ?', [userId]);

Cryptographic Failures

Cryptographic failures occur when sensitive data is exposed due to weak encryption algorithms, poor key management, or the absence of encryption during transit and at rest. These vulnerabilities happen because developers often prioritize convenience over secrecy, storing passwords in plaintext or using outdated hashing methods that are susceptible to collision attacks or brute force. When sensitive information travels over insecure channels or resides in storage without adequate protection, it becomes trivial for an attacker to intercept or dump the data. Effective mitigation requires implementing strong, modern encryption standards like AES-256 for data at rest and ensuring all traffic is encrypted via Transport Layer Security. Furthermore, you must never store passwords in plaintext; instead, use memory-hard, salt-based hashing algorithms that slow down password cracking attempts, rendering stolen data useless even if the underlying database is compromised.

# Use strong hashing with a unique salt for password storage
const bcrypt = require('bcrypt');
const saltRounds = 12;
// Hash password before saving to storage
const hash = bcrypt.hashSync(userPassword, saltRounds);
database.execute('INSERT INTO users (password) VALUES (?)', [hash]);

Insecure Design

Insecure Design refers to risks related to a lack of security-focused processes during the architectural planning of an application. Unlike implementation bugs, these flaws are rooted in the logical flow and feature specifications. If an application is designed without threat modeling, it may inadvertently contain logic that allows users to bypass security checkpoints or access sensitive business operations without verification. This category highlights that you cannot 'code' your way out of a fundamentally broken design. To mitigate this, security must be integrated into the design phase by performing regular threat modeling sessions. By proactively imagining how an attacker might attempt to manipulate business workflows, architects can design systems that enforce security invariants throughout the application logic. This approach ensures that security is a functional requirement rather than a post-development patch applied to a flawed foundation.

// Logic ensuring secure multi-step business process
function completeTransaction(transaction) {
    // Ensure the state cannot be jumped over
    if (transaction.status !== 'VERIFIED') {
        throw new Error('Invalid state transition');
    }
    // Process payment only after status verification
    processPayment(transaction);
}

Security Misconfiguration

Security Misconfiguration happens when security controls are incorrectly set up, are left in a default state, or are overly permissive. This is a common point of failure because complex systems often ship with diagnostic features, default credentials, or verbose error messages enabled to simplify setup. If these settings remain in a production environment, they provide attackers with a roadmap of the application's internal structure and versioning. Misconfigurations also include headers that are not set, such as missing Cross-Origin Resource Sharing policies, which expose the system to unauthorized interactions. Mitigation involves adopting an automated 'infrastructure as code' approach to ensure consistent, hardened deployments. By disabling unnecessary features, removing default accounts, and strictly configuring headers to limit browser access to resources, you reduce the attack surface and ensure the system behaves predictably under adversarial scrutiny.

// Configure strict HTTP headers to prevent resource misuse
response.setHeader('Content-Security-Policy', "default-src 'self'");
response.setHeader('X-Content-Type-Options', 'nosniff');
response.setHeader('Strict-Transport-Security', 'max-age=31536000; includeSubDomains');

Key points

  • Broken access control is mitigated by enforcing strict server-side authorization checks on every request.
  • Injection vulnerabilities are prevented by using parameterized queries to separate data from command logic.
  • Cryptographic failures are addressed by using modern encryption standards and strong, salted password hashing.
  • Insecure design necessitates proactive threat modeling during the initial architecture phase of development.
  • Security misconfiguration often stems from leaving default settings or verbose error reporting enabled in production.
  • The OWASP Top 10 acts as a critical baseline for identifying the most impactful risks in modern web applications.
  • Automation in deployment helps ensure that security configurations remain consistent and hardened across environments.
  • A deny-by-default posture is the most effective way to secure application resources against unauthorized access.

Common mistakes

  • Mistake: Relying solely on WAFs for security. Why it's wrong: WAFs are perimeter defenses and cannot fix logic flaws or injection vulnerabilities within the code. Fix: Implement defense-in-depth, prioritizing secure coding practices at the application level.
  • Mistake: Trusting data sent by the client. Why it's wrong: Users can easily manipulate HTTP requests, headers, and cookies to bypass front-end validation. Fix: Perform all security-sensitive validation on the server side using allow-lists.
  • Mistake: Using blacklisting for input sanitization. Why it's wrong: Attackers constantly find new bypasses for blocked characters that developers failed to anticipate. Fix: Use strict allow-listing to define exactly what input is permitted.
  • Mistake: Failing to update libraries and frameworks. Why it's wrong: Software supply chain attacks exploit known vulnerabilities in outdated components that already have patches. Fix: Integrate automated dependency scanning into the CI/CD pipeline.
  • Mistake: Misconfiguring security headers or leaving default settings. Why it's wrong: Default configurations are often insecure and reveal version information or expose administrative interfaces. Fix: Follow hardening guides to disable unnecessary features and strictly define security headers.

Interview questions

Can you define the OWASP Top 10 and explain why it is essential for modern software development?

The OWASP Top 10 is a regularly updated, consensus-driven awareness document that represents the most critical web application security risks. It serves as a benchmark for developers and security professionals to understand the current threat landscape. By prioritizing these vulnerabilities—such as broken access control or injection—teams can build secure-by-design applications. It is essential because it shifts security from an afterthought to a foundational requirement, helping to prevent costly data breaches and protecting user privacy by mitigating risks before they reach production environments.

What is Broken Access Control, and what is the best strategy to prevent it?

Broken Access Control occurs when restrictions on what authenticated users are allowed to do are not properly enforced, allowing attackers to access unauthorized functionality or data. To mitigate this, implement a 'deny by default' policy. Developers should use centralized access control mechanisms rather than scattering logic across different pages. For example, instead of relying on URL hidden links, verify the user's role and permissions on the server-side for every single request. Ensure that object references are not predictable, effectively preventing attackers from manipulating IDs to access other users' private information.

How does Injection differ from Cross-Site Scripting (XSS), and how should you remediate both?

Injection, such as SQL injection, involves sending malicious data to an interpreter, often targeting the backend database, whereas XSS involves injecting malicious scripts into content served to other users. For Injection, the primary defense is using parameterized queries or prepared statements, which separate the query logic from the data. For XSS, the solution is context-aware output encoding and implementing a strong Content Security Policy. Both vulnerabilities stem from the fundamental failure to treat user-supplied input as untrusted data, so implementing strict input validation and sanitization is critical for both.

Compare the use of blacklisting versus whitelisting for input validation. Which is more secure?

Whitelisting is significantly more secure than blacklisting. A blacklist attempts to block known malicious characters or patterns, which is inherently flawed because attackers constantly discover new bypass techniques. Conversely, whitelisting defines a strict set of 'known-good' characters or formats that input must adhere to, such as expecting only alphanumeric characters in a username field. By rejecting everything that does not explicitly match the approved pattern, whitelisting eliminates the possibility of unforeseen attack vectors, whereas blacklisting provides only a false sense of security that is easily circumvented by creative attackers.

What are Cryptographic Failures, and how do they compromise application security?

Cryptographic Failures, formerly known as Sensitive Data Exposure, occur when applications fail to adequately protect data at rest or in transit. This happens when using weak or outdated algorithms like MD5 or DES, or failing to enforce encryption for data in motion using TLS. To mitigate these, developers must encrypt all sensitive data at rest using strong, modern algorithms like AES-256 and mandate TLS for all network traffic. Furthermore, one must ensure that passwords are hashed using adaptive, salted functions like Argon2 or bcrypt, preventing attackers from performing rapid offline dictionary attacks if the database is ever exfiltrated.

How do you handle Insecure Design vulnerabilities during the software development lifecycle?

Insecure Design refers to risks related to design flaws rather than implementation bugs. Mitigating this requires integrating security early in the lifecycle through threat modeling. Before writing code, teams should brainstorm potential abuse cases, such as how an attacker might exploit the application's business logic. A concrete example is implementing multi-factor authentication and rate limiting to prevent credential stuffing. By documenting design choices and utilizing security architecture reviews, organizations can identify architectural weaknesses early, ensuring that security is baked into the application's core functionality rather than being patched on as an unreliable, after-the-fact component.

All cyber security interview questions →

Check yourself

1. An application is vulnerable to SQL injection. Which implementation is the most effective defense?

  • A.Escaping all single quotes in user input strings
  • B.Using parameterized queries with prepared statements
  • C.Implementing a regex filter to remove SQL keywords
  • D.Configuring the database with read-only permissions
Show answer

B. Using parameterized queries with prepared statements
Parameterized queries separate the query structure from the data, preventing the database from executing user input as code. Escaping and regex filtering are error-prone and can be bypassed, while read-only permissions do not stop data exfiltration.

2. A developer stores session tokens in local storage and sends them over unencrypted HTTP. Which category does this represent?

  • A.Broken Access Control
  • B.Injection
  • C.Cryptographic Failures
  • D.Security Misconfiguration
Show answer

C. Cryptographic Failures
Cryptographic Failures involve the mishandling of sensitive data, including insecure storage and transport. While it could relate to configuration, it is primarily a failure to protect data via encryption. Access control and injection relate to authorization and input processing respectively.

3. Why is 'Broken Access Control' considered the top risk in the OWASP Top 10?

  • A.It is the easiest vulnerability to automate via scanners
  • B.It involves flaws in enforcing user permissions and leads to unauthorized data access
  • C.It causes the application server to crash immediately upon exploitation
  • D.It is only found in legacy web applications
Show answer

B. It involves flaws in enforcing user permissions and leads to unauthorized data access
Broken access control occurs when users can perform actions outside of their intended permissions. It is severe because it directly leads to data breaches. Automated scanners struggle with this because access logic is application-specific, and it is a common issue in modern, not just legacy, apps.

4. If an application displays a user's uploaded image with a name derived from the user input without validation, what is the primary risk?

  • A.Insecure Design
  • B.Cross-Site Scripting (XSS)
  • C.Server-Side Request Forgery
  • D.Broken Access Control
Show answer

B. Cross-Site Scripting (XSS)
Reflected or stored XSS occurs when user-supplied input is rendered in the browser without proper encoding. If the input contains a script tag instead of a filename, the browser will execute it. The other options refer to logic, network, or permission issues, not script execution.

5. When addressing 'Insecure Design', what is the most effective strategy for an organization?

  • A.Performing penetration testing only after the code is finished
  • B.Integrating threat modeling and security requirements during the initial design phase
  • C.Purchasing advanced firewall hardware to protect the application
  • D.Outsourcing all application security to a third-party vendor
Show answer

B. Integrating threat modeling and security requirements during the initial design phase
Insecure Design addresses flaws in the architecture, not just the code. Threat modeling during the design phase ensures security is built-in rather than patched later. Testing after development or relying on hardware and vendors does not resolve inherent design-level flaws.

Take the full cyber security quiz →

← PreviousHow would you respond to a ransomware attack on a corporate network?Next →Walk through the steps you would take to perform a penetration test.

cyber security

34 lessons, free to read.

All lessons →

Track your progress

Sign in to mark lessons done, score quizzes and keep notes.

Open in the app