Skip to content
Tutorials Center
My learning

Topics

Lesson 30 of 31 ยท Practice, Interviews and Cheat Sheet

Security Interview Questions

Prepare for entry-level security interviews with 21 concise answers on networking, hashing, vulnerabilities and ethics, plus small runnable Python demos.

Entry-level security interviews, whether for a SOC analyst, a junior penetration tester or a security-minded developer, circle around the same core ideas: how networks talk, how passwords and hashes work, how vulnerabilities are described and ranked, and how a professional behaves when something sensitive turns up. Interviewers care less about memorized tool flags and more about whether you can explain a mechanism clearly and say where it can go wrong.

This page collects 21 questions in the order they usually come up, each with a short answer you could say out loud. A strong answer has three parts: a one-sentence definition, the mechanism (why it works), and a pitfall or example. The Python demos are stand-ins that run in your browser: the real tools (Wireshark, Nmap, scanners, password managers) cannot run here, so the demos show the underlying idea on sample data. Nothing on this page touches a real network or system.

Four areas to cover

Networking TCP, ports, DNS, subnets.
Hashing and passwords Salts, slow hashes, MFA.
Vulnerabilities CVE, CVSS, injection, patching.
Ethics Authorization and disclosure.

Give a definition, the mechanism and a pitfall.

1 / 2

Networking

1. What is the difference between TCP and UDP?

TCP is connection-oriented: it sets up a connection, numbers the data, acknowledges it and retransmits losses, so data arrives complete and in order. UDP just sends datagrams with no handshake and no delivery promise, which makes it lighter and faster for things like DNS queries and streaming. For security it matters because scanners and firewalls treat the two differently. See TCP/IP Essentials for Security.

2. Explain the TCP three-way handshake.

The client sends a segment with the SYN flag, the server answers with SYN and ACK, and the client replies with ACK. Only then do both sides consider the connection open. A closed port answers a SYN with RST instead. Scanners read exactly those replies to decide whether a port is open or closed.

Python Decode TCP flags and infer port state

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

3. What do open, closed and filtered mean in a port scan?

Open means a service answered. Closed means the host replied that nothing listens there. Filtered means no usable reply came back, usually because a firewall dropped the probe, so the scanner cannot tell. A filtered port is not proof that nothing is running behind it. More in How Port Scanning Works.

4. What is NAT and does it count as a security control?

Network address translation lets many private hosts share one public address by rewriting addresses and ports. It hides internal addresses from simple inspection, but it was designed for address conservation, not security. Real protection comes from a stateful firewall, patching and segmentation.

5. How many usable addresses does a /24 contain, and how do you split it?

A /24 has 256 addresses; two are reserved (network and broadcast), leaving 254 usable hosts. Splitting into four /26 networks gives 64 addresses (62 usable) each. Segmenting a network this way limits how far an intruder can move.

Python Subnets with the ipaddress module

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

6. Why does DNS matter to security?

DNS maps names to addresses, so almost every connection starts with it. Defenders watch it for suspicious domains, and attackers abuse it for phishing lookalikes and data tunneling. Public DNS records and certificate transparency logs also reveal which subdomains a company exposes. See DNS, WHOIS and Certificate Intelligence.

Hashing and passwords

7. What is the difference between hashing, encryption and encoding?

Hashing is one-way: you cannot get the input back from the digest. Encryption is two-way with a key: ciphertext can be decrypted by someone who has the key. Encoding, such as Base64, is a reversible format change with no secret at all, so it is not protection.

Python Hash, encode and the avalanche effect

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

8. Why do we salt password hashes?

A salt is a random, per-user value mixed in before hashing. It makes identical passwords produce different hashes and makes precomputed lookup tables useless. The salt is not secret and is stored next to the hash.

9. Why use bcrypt, scrypt or Argon2 instead of plain SHA-256?

SHA-256 is designed to be fast, which helps anyone testing billions of guesses. Password hashes are deliberately slow and, for scrypt and Argon2, memory-hungry, so each guess costs the attacker real resources. The cost parameter can be raised as hardware improves. Details: Password Storage and Hashing.

10. What is the difference between symmetric and asymmetric encryption?

Symmetric encryption uses one shared key and is fast, so it protects bulk data. Asymmetric encryption uses a public/private key pair, which solves key distribution and enables signatures but is slower. TLS combines them: asymmetric methods agree a session key, then symmetric encryption protects the traffic.

11. Why is multi-factor authentication valuable even with strong passwords?

Passwords leak through phishing, reuse and breaches. A second factor, such as a hardware key or an authenticator app, means a stolen password alone is not enough. Phishing-resistant factors like FIDO2 keys are strongest, while SMS codes are weaker but still better than nothing.

Vulnerabilities and defense

12. What is the difference between a vulnerability, a threat and a risk?

A vulnerability is a weakness, a threat is something that could exploit it, and risk is the likelihood and impact of that happening. A flaw on an isolated test machine is the same vulnerability but a lower risk than on an internet-facing server.

13. What is the difference between CVE and CVSS?

A CVE is an identifier for one publicly known vulnerability, such as CVE-2021-44228 (the year and a number). CVSS is a scoring system from 0 to 10 that describes how severe a flaw is in the abstract. CVE names it, CVSS rates it. See Vulnerability Assessment Workflow.

14. What is a false positive and why do they matter?

A false positive is a finding reported by a tool that is not actually a problem, for example a version banner that looks old although the vendor back-ported the fix. They waste time and teach people to ignore reports, so findings should be validated before they are reported.

15. How do you prevent SQL injection?

Never build a query by pasting user input into SQL text. Use parameterized queries (prepared statements), so the database treats input strictly as data. Add least-privilege database accounts and input validation as extra layers. Escaping by hand is fragile.

Python Unsafe versus parameterized query

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

16. What is cross-site scripting (XSS) and how is it stopped?

XSS happens when an application puts untrusted input into a page without encoding it, so the browser runs it as script in the victim's session. The main defense is output encoding for the right context, backed by a Content Security Policy and HttpOnly cookies to limit the damage. Read Injection and Input Validation: Defense.

17. What is least privilege, and what is defense in depth?

Least privilege gives every user and program only the access it needs, so a compromise reaches less. Defense in depth stacks independent controls (firewall, patching, monitoring, backups) so that one failure does not mean total failure.

18. How would you prioritize patches when you cannot fix everything at once?

Combine the severity score with context: is the system internet-facing, how valuable is the data, is the flaw being actively exploited, and is there a compensating control. Fix known-exploited flaws on exposed, important systems first, and record the reasoning. Compare Project: Vulnerability Risk Register.

Ethics and professional conduct

19. What must you have before testing a system?

Written authorization from someone who has the authority to grant it, with a defined scope (which systems), rules of engagement (what is allowed, when) and contact points for emergencies. Without it, the same actions can be a crime even if your intentions are good. See Law, Ethics and Authorization.

20. What is responsible disclosure?

Reporting a vulnerability privately to the owner and giving them reasonable time to fix it before any public details appear. Follow the program's policy, avoid accessing more data than needed to demonstrate the issue, and never sell or leak the information.

21. During an authorized test you stumble on customer personal data. What do you do?

Stop, do not copy or keep the data, record only the minimum evidence needed (for example the path and the fact that it is exposed), and tell your contact right away according to the engagement rules. Handling sensitive data carelessly can turn a successful test into a legal problem.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. A SYN scanner sends a probe and receives no reply at all. Which state does it report?

    A closed port answers with a reset and an open port answers with SYN and ACK. Silence is ambiguous and is reported as filtered.
  2. 2. Why is Base64 not a way to protect a password?

    Encoding changes the representation, not the secrecy. Only hashing (for storage) or encryption (with a protected key) hides the content.
  3. 3. What makes a parameterized query safe against SQL injection?

    The query text and the values travel separately, so input like ' OR '1'='1 is just an odd string to compare against.
  4. 4. What should you do first if you discover an exposed document of personal data during an authorized test?

    Minimize handling, document just enough to describe the problem, and report it through the agreed channel immediately.

Summary

  • Explain every concept as definition, mechanism and pitfall; give an example when you can.
  • Networking basics: the TCP handshake, port states, subnets, NAT and DNS underlie most security tooling.
  • Hashing is one-way, encryption needs a key, encoding is neither; store passwords with salted, slow hashes.
  • CVE names a flaw, CVSS rates it in the abstract, and risk adds context.
  • Prevent injection with parameterized queries and XSS with output encoding, and layer defenses.
  • Authorization, scope and careful data handling define professional behavior.

Finish the track with the Kali and Security Tools Cheat Sheet.