Security interview questions

37 questions, easy to hard. Read one, then answer it out loud: an AI interviewer follows up, hints when you're stuck and grades your answer.

Security interviews check you can spot and prevent real attacks: web vulnerabilities, identity and access, cryptography, transport security and secure development.

Web Vulnerabilities

  1. Your manager asks what the OWASP Top Ten is and why the team should care. Explain what it is, describe a few of the risk categories it covers in your own words, and say how a team could use it day to day.

  2. Your profile update endpoint copies every field from the request body straight onto the user record. A tester adds a field setting their role to admin and it works. Explain this vulnerability and how to prevent it.

  3. A security report lists three cross-site scripting findings: one in product reviews, one in a search results page, and one in a script that reads the page address fragment. Explain the difference between stored, reflected and DOM-based cross-site scripting, and which finding is which.

  4. After a cross-site scripting scare, a colleague suggests adding a Content Security Policy. Explain what a Content Security Policy is, how it limits the damage of injected scripts, and how you'd roll one out without breaking the site.

  5. Your session cookie has no SameSite attribute set and a colleague asks whether that matters. Explain what the SameSite attribute does, the difference between strict, lax and none, and which you'd pick for a session cookie.

  6. Your app has a download endpoint that takes a file name and returns that file from an uploads folder. Explain how an attacker could use it to read files outside that folder, and how you'd make it safe.

  7. A tool on your server lets users enter a host name, and the code builds a shell command to ping it by joining strings together. Explain how this can be abused and how you'd rewrite it safely.

  8. Your app has a feature that fetches a preview of any web address a user pastes in. Explain how an attacker could abuse this with server-side request forgery, what they could reach in a cloud environment, and how you'd defend against it.

Identity and Access

  1. Your company wants to add a second step to sign-in. Explain what multi-factor authentication is, compare text-message codes, authenticator apps and passkeys or security keys, and say which you'd recommend.

  2. A user has lost the phone holding their second factor and calls support to get back into their account. Explain why account recovery is a favourite target for attackers and how you'd design it safely.

  3. Your login endpoint is being hit with millions of attempts using email and password pairs leaked from other websites. Explain what credential stuffing is and how you'd defend against it without locking out real users.

  4. You're building a public API that lets third-party apps act on behalf of your users, and a partner asks for full access to everything. Explain how OAuth scopes and consent screens should work, and the risks of granting too much.

  5. A penetration tester forged valid-looking JSON Web Tokens against your API. Explain the classic attacks on how these tokens are signed and verified, and how to configure verification so they fail.

  6. Explain how to manage server-side sessions securely across their whole life: creating the session at login, keeping it alive, and ending it at logout or after inactivity.

  7. Your app started with admin and user roles, but now managers should only edit documents in their own department during working hours. Compare role-based and attribute-based access control, and explain how you'd structure authorisation as rules grow.

Cryptography Essentials

  1. A junior developer says they will encrypt user passwords and hash credit card numbers. Explain the difference between hashing and encryption, and which one fits each case.

  2. Explain the difference between symmetric and asymmetric encryption, give an everyday example where each is used, and explain why real systems often use both together.

  3. Your password reset tokens are generated with the language's ordinary random number function seeded with the current time. Explain why this is dangerous and what you should use instead.

  4. Your app downloads update files from a server and you want to be sure nobody has tampered with them. Explain how digital signatures work and how you'd use them here.

  5. Your app emails download links that include the file ID and an expiry time, and users have learnt to edit the address to get other files or extend the expiry. Explain how a message authentication code lets you detect tampering, and how you'd use one here.

  6. An auditor asks whether your customer data is encrypted at rest. Explain what encryption at rest means, the different levels it can be applied at, and what it does and doesn't protect against.

  7. Rotate Keys
    • medium
    • Pro

    Your app encrypts customer documents with a single key that has never changed in five years. Explain why keys should be rotated, and how you'd rotate this one without losing access to old documents.

  8. A colleague has written their own encryption by combining a block cipher in a basic mode with no integrity check. Explain why encryption alone doesn't stop tampering, what authenticated encryption adds, and why you shouldn't build your own scheme.

Transport and Network Security

  1. A friend says their small blog doesn't need HTTPS because it has no logins or payments. Explain what HTTPS protects against and why it matters even for a simple public site.

  2. Walk through, in plain language, what happens in a TLS handshake when a browser connects to a website over HTTPS, up to the point where encrypted data starts flowing.

  3. A user reports a browser warning saying your site's certificate isn't trusted. Explain how certificate authorities and the chain of trust work, and the common reasons for this warning.

  4. Your site redirects plain HTTP to HTTPS, but a security reviewer says that's not enough and recommends HSTS. Explain the attack the redirect leaves open and how HSTS closes it.

  5. All of your company's servers, including the database, sit on one flat network with public addresses. Explain how you'd segment the network and what firewall rules you'd put in place.

  6. Your internal services call each other over plain HTTP inside the data centre, trusting anything on the network. Explain zero-trust networking and how mutual TLS would let services verify each other.

Secure Development

  1. A colleague argues that because the app sits behind a firewall and requires a login, the team doesn't need to worry about anything else. Explain defence in depth and why one strong layer of security isn't enough.

  2. A scanner reports that one of your project's third-party packages has a known critical vulnerability. Explain how you'd assess and respond to it, and how you'd keep dependencies healthy in general.

  3. An attacker's page loads your bank transfer page in an invisible frame and tricks users into clicking the confirm button. Explain what clickjacking is and how you'd stop it.

  4. After an incident, nobody could tell which admin changed a customer's bank details. Explain what an audit log is, which events it should record, and how to make it trustworthy.

  5. Your team wants to catch security issues earlier. Compare static analysis, dynamic scanning, dependency scanning and penetration testing, and explain where each fits in the development process.

  6. You're reviewing a pull request that adds an endpoint to export a team's data as a spreadsheet. Explain what you'd look for from a security point of view.

  7. A popular open-source package your app depends on was hijacked and a malicious version was published. Explain how software supply chain attacks happen and what you'd put in place to reduce the risk.

  8. At two in the morning you discover an attacker has been using a leaked admin key to read customer data. Walk through how you'd respond in the first hours and days.

Questions about practising

How should I prepare for security interview questions?
Practise answering them out loud, not just reading them. Explaining an answer under follow-up questions is what interviews test. Work through the 37 questions here from easy to hard, and revisit the ones you struggle with.
Can I practise security interview questions with an AI?
Yes. Open any question and start a voice session: an AI interviewer asks it, follows up on your answer, gives hints when you're stuck and grades your answer with written feedback when the call ends.
Are these security interview questions free?
5 of the 37 questions are free to practise. Sign in with Google, no card needed. Pro unlocks the rest, plus practice calls to your phone.