Ethical hacking interview questions and answers for security candidates

Ethical hacking interview questions test whether you understand how attacks work well enough to find weaknesses with permission and explain how to fix them. Expect questions on the phases of a test (reconnaissance, scanning, enumeration, exploitation, reporting), port scan types, password attacks and salting, network and wireless attacks, web flaws such as SQL injection, social engineering and malware. Every good answer also shows the frame around the technique: written authorization, scope, and what a defender would see.

By Published 9 min read

Where ethical hacking questions are asked

Ethical hacking questions appear in interviews for junior security analysts, SOC analysts moving toward offensive work, application security engineers, and graduates who list security courses or certifications such as CEH, OSCP or CompTIA PenTest+ on a résumé. They also come up for developers at companies that take security seriously. The questions are mostly conceptual: interviewers want the mechanism behind each attack and the fix, not tool trivia. Engagement-level topics such as rules of engagement, lab exams and report writing are covered on the penetration tester interview questions page.

  1. FoundationsSecurity concepts, the legal frame, and the phases of an authorized test.
  2. Technique questionsHow a scan, a password attack or an injection works, and what stops it.
  3. ScenarioYou are given a target description or a finding and asked how you would proceed, step by step, inside scope.
  4. Defense and communicationWhat logs would show your activity, how to rate severity, and how to explain a finding to a developer or a manager.

Ethical hacking fundamentals questions

First-round questions for freshers and career changers
QuestionWhat it testsWhat a strong answer shows
What makes hacking "ethical"?Legal frameWritten permission from someone with authority over the systems, an agreed scope and time window, care not to cause harm, and confidential reporting of what you find. Without authorization the same actions are a crime in most countries.
White hat, black hat, grey hat?VocabularyAuthorized testers, criminal attackers, and people who probe without permission even if they later disclose. Interviewers want to hear that grey hat activity is still unauthorized.
What is the CIA triad?Security goalsConfidentiality, integrity and availability. Each finding should say which one it threatens.
Vulnerability, threat, exploit and risk?DefinitionsA vulnerability is a weakness, a threat is something that could use it, an exploit is the method, and risk combines likelihood and impact for this business.
What are the phases of an ethical hack?MethodologyPlanning and scope, reconnaissance, scanning, enumeration, gaining access, escalating privileges, and reporting with remediation and cleanup. Frameworks such as PTES and NIST SP 800-115 describe similar stages.
What are CVE and CVSS?Shared languageA CVE id names a publicly known vulnerability. CVSS scores its severity from factors like attack vector and impact; teams then adjust priority for their own context.
Black box, grey box, white box?Test typesNo knowledge, partial knowledge such as a user account, or full access to code and design. More knowledge usually finds more in the same time.
What is a zero-day?Threat landscapeA flaw unknown to the vendor or without a fix when it is exploited. Defense relies on layered controls and detection rather than patching alone.
Vulnerability scan versus penetration test?Scope of workA scan is automated and lists possible issues. A test verifies them, removes false positives, chains them and shows real impact.
What is responsible disclosure?EthicsReporting a flaw privately to the owner, giving reasonable time to fix it, and following a published disclosure or bug bounty policy where one exists.
First-round questions for freshers and career changers. Scroll sideways on a small screen.

Reconnaissance, scanning and enumeration

  • Passive versus active reconnaissance? Passive recon gathers information without touching the target: public DNS records, certificate transparency logs, job postings, code repositories and social media. Active recon sends traffic to the target, such as pings and port scans, and can be logged.
  • What is OSINT and what would you look for first? Open-source intelligence: employee names and email formats, subdomains, exposed documents and leaked credentials in public breach data. It shapes phishing tests and finds forgotten hosts.
  • How does a SYN scan differ from a TCP connect scan? A SYN scan sends SYN, reads SYN-ACK (open) or RST (closed), and resets without completing the handshake. A connect scan completes the handshake through the operating system, which is slower and more likely to be logged by the application.
  • Why are UDP scans slow and unreliable? UDP has no handshake. An open port often sends nothing back, so the scanner waits for timeouts and has to infer state from ICMP errors.
  • Open, closed and filtered? Open means a service answered. Closed means the host replied with a reset. Filtered means no answer or an ICMP block, usually a firewall.
  • What is enumeration? Pulling detail from discovered services: user and share lists over SMB, directory data over LDAP, device data over SNMP with default community strings, and version banners that map to known CVEs.
  • How do you avoid harming production while scanning? Agree on timing and rate limits, skip fragile systems listed in scope, start with light scans, and keep a contact who can stop the test.
  • How would a defender notice your scan? Firewall and IDS logs showing one source touching many ports or hosts in a short time. Knowing this helps you write the detection section of a report.
Common tools named in interviews, and the concept behind each
ToolUsed forWhat to explain instead of flags
NmapHost discovery, port and service scanningScan types, timing, version detection and why results need verification.
WiresharkPacket capture and analysisReading a TCP handshake, spotting cleartext credentials, filtering by protocol.
Burp SuiteIntercepting and modifying web trafficProxying requests, replaying them with changed parameters, testing access control.
MetasploitAn exploitation frameworkModules, payloads and why exploitation in a client test needs explicit approval.
Hashcat or John the RipperOffline password hash crackingDictionary, rule and brute-force modes, and why salts and slow hashes matter.
Common tools named in interviews, and the concept behind each. Scroll sideways on a small screen.

Attack technique questions, with the defense

Intermediate questions: the mechanism and the fix
QuestionWhat it testsWhat a strong answer shows
Brute force, dictionary and credential stuffing?Password attacksTrying every combination, trying likely words, or replaying username and password pairs leaked from other sites. Defenses: rate limits, lockout or delays, MFA, and checking passwords against breach lists.
Why does salting defeat rainbow tables?Hash storageA unique random salt per password means one precomputed table cannot match many accounts. Pair it with a slow password hash, covered in cryptography interview questions.
How does ARP spoofing enable a man-in-the-middle attack?Network attacksARP has no authentication, so an attacker on the local network can claim the gateway's IP, receive traffic and forward it. Defenses: dynamic ARP inspection, port security, and encryption so intercepted traffic is useless.
DoS versus DDoS?AvailabilityOne source exhausting a resource versus many sources at once, often a botnet. Mitigation is upstream filtering, rate limiting and scalable providers; testers normally exclude it from scope.
How is a WPA2 personal network attacked?WirelessBy capturing the four-way handshake and guessing the passphrase offline, so strength depends on the passphrase. WPA3 personal uses SAE, which resists that offline guessing.
What is an evil twin?WirelessA fake access point with a trusted network name that lures clients to connect and exposes their traffic or credentials.
Explain SQL injection and its fix.Web flawsInput changes the structure of a query because it is pasted into the SQL text. Parameterized queries keep data separate from code. Wider web coverage is in OWASP interview questions.
Stored, reflected and DOM XSS?Web flawsScript saved and served to others, script echoed from a request, or script injected by client-side code. Output encoding, safe templating and a content security policy reduce it.
What is privilege escalation?Post-accessGoing from a low-privilege foothold to admin or root, vertically, or to another user's data, horizontally. Typical causes: misconfigured services, weak file permissions, unpatched kernels, stored credentials.
What is lateral movement?Post-accessUsing one compromised machine to reach others, often with reused credentials. Network segmentation and unique local admin passwords limit it.
Intermediate questions: the mechanism and the fix. Scroll sideways on a small screen.
import sqlite3

db = sqlite3.connect(":memory:")
db.execute("CREATE TABLE users (name TEXT, role TEXT)")
db.executemany("INSERT INTO users VALUES (?, ?)", [("alice", "admin"), ("bob", "user")])

user_input = "nobody' OR '1'='1"

# Vulnerable: input is pasted into the SQL text, so the quote ends the string.
unsafe = f"SELECT name FROM users WHERE name = '{user_input}'"
print("concatenated:", db.execute(unsafe).fetchall())

# Fixed: the driver sends the value separately as a parameter.
safe = "SELECT name FROM users WHERE name = ?"
print("parameterized:", db.execute(safe, (user_input,)).fetchall())
SQL injection in miniature, against an in-memory SQLite table. Run with Python 3.13: the concatenated query returns [('alice',), ('bob',)]; the parameterized one returns [].

Social engineering, malware and physical security

  • Phishing, spear phishing and whaling? Mass emails, emails tailored to one person or team, and attacks aimed at executives. Tests measure clicks and reports, and the goal is training, not blame.
  • Pretexting, baiting and tailgating? A made-up story to extract information, a lure such as a dropped USB drive, and following someone through a secured door. Physical tests need especially clear written permission.
  • Virus, worm and trojan? A virus attaches to files and needs a user action; a worm spreads by itself across networks; a trojan pretends to be useful software.
  • What do ransomware and rootkits do? Ransomware encrypts or steals data for extortion. A rootkit hides an attacker's presence deep in the system, sometimes in the kernel or firmware.
  • What is a reverse shell, conceptually? The compromised host connects out to the tester, which often passes firewalls that block inbound connections. Egress filtering and monitoring of unusual outbound connections are the defenses.
  • Why do ethical hackers not "cover their tracks" the way attackers do? Deleting logs destroys the client's evidence and the chance to tune detection. Testers record what they did and clean up only their own artifacts, as agreed.

Senior and scenario questions

  • You find a critical flaw on day one of a two-week test. What do you do? Check the rules of engagement for critical findings, which usually means notifying the client contact right away rather than waiting for the report, then continue the test.
  • You realize a host you scanned was out of scope. What now? Stop, record exactly what was sent and when, tell your lead and the client contact, and exclude any results. Honesty here matters more than the finding.
  • How do you chain low findings into a high one? For example, an information leak that reveals usernames, a missing lockout that allows guessing, and a reused password that opens an admin panel. Report the chain and the single fix that breaks it.
  • How do you rate severity for a business audience? Start from CVSS, then adjust for exposure, data sensitivity and compensating controls, and explain the result in terms of what an attacker could actually do.
  • What would the logs show from your test? Map each step to the log source that should have caught it (firewall, web server, authentication logs, endpoint detection) and note which ones stayed silent. That gap list is often the most useful part of the report.
  • How do you keep current? Advisories and CVE feeds, write-ups from conference talks, and legal practice platforms and capture-the-flag events. Name sources you actually use.
from collections import defaultdict, deque
from datetime import datetime, timedelta

LOG = """\
2026-11-20T10:00:01 FAIL user=admin ip=203.0.113.9
2026-11-20T10:00:03 FAIL user=root ip=203.0.113.9
2026-11-20T10:00:04 FAIL user=test ip=203.0.113.9
2026-11-20T10:00:06 FAIL user=admin ip=203.0.113.9
2026-11-20T10:00:07 FAIL user=guest ip=203.0.113.9
2026-11-20T10:02:00 FAIL user=maria ip=198.51.100.4
2026-11-20T10:02:30 OK user=maria ip=198.51.100.4"""

WINDOW, THRESHOLD = timedelta(minutes=1), 5
recent = defaultdict(deque)
alerted = set()

for line in LOG.splitlines():
    ts, result, user, ip = line.split()
    when, ip = datetime.fromisoformat(ts), ip.removeprefix("ip=")
    if result != "FAIL":
        continue
    q = recent[ip]
    q.append(when)
    while q and when - q[0] > WINDOW:
        q.popleft()
    if len(q) >= THRESHOLD and ip not in alerted:
        alerted.add(ip)
        print(f"ALERT {ip}: {len(q)} failed logins within {WINDOW.seconds}s, last at {ts}")
What a defender sees: flag an IP with five failed logins inside one minute. Run with Python 3.13, it prints one alert for 203.0.113.9 and none for the user who mistyped once.

Fictional example

Answering "Walk me through how you would test a small company's external network"
Interviewer
A 50-person company asks you to test what is exposed to the internet. You have their domain name and a signed scope. How do you go about it?
Candidate
First I confirm the scope lists the IP ranges and domains I may touch, the testing hours and an emergency contact. Then passive recon: DNS records, certificate transparency for subdomains, and public breach data for their email domain, checking every host I find against the scope before going further. Next a light port scan of the in-scope addresses, then service and version detection on what is open. I would look for exposed admin panels, remote access services, outdated software with known CVEs and default credentials, verifying each issue by hand instead of trusting the scanner. If I found something critical, such as an exposed database, I would call the contact the same day. The report would rank findings by real business risk, give a concrete fix for each, and list which of my actions their monitoring did or did not notice.

Ethical hacking practice plan

  • Week 1: concepts. Write one-paragraph answers for every fundamentals question above, including the legal frame, and say them aloud.
  • Week 2: networking. Capture your own traffic with Wireshark, read a handshake, and scan your own lab machines to see open, closed and filtered states.
  • Week 3: web and passwords. Work through intentionally vulnerable apps on a legal platform or in a local lab, and for each flaw write the fix in code.
  • Week 4: communication. Turn two lab findings into short reports with severity, evidence and remediation, then explain one to a non-technical friend.

Security interviews often continue into cybersecurity analyst interview questions for the defensive side and security engineer interview questions for building controls.

Scenario answers in security interviews are judged on order and restraint as much as on knowledge: did you check scope before scanning, did you call the client before writing the report. Natively, an AI interview assistant for Mac and Windows, turns a mock security interview into a transcript on your computer, so you can see whether scope came first or got mentioned at the end. While practicing, it can read a log excerpt or a vulnerable snippet from a screenshot and quiz you on the fix, and with Pro or the free trial it can work from your résumé and the job description you add. Notes from each run are kept for later.

Questions people ask

What questions are asked in an ethical hacking interview?

What makes hacking ethical, the phases of a test, passive versus active recon, SYN versus connect scans, enumeration, CVE and CVSS, password attacks and salting, ARP spoofing, wireless handshakes, SQL injection and XSS, privilege escalation, social engineering and how to handle out-of-scope mistakes.

What are the five phases of ethical hacking?

A common teaching model lists reconnaissance, scanning, gaining access, maintaining access and covering tracks. In real authorized work the last step becomes documenting and cleaning up your own artifacts, and planning and reporting bracket the whole test.

Do I need a certification for an ethical hacking job?

Many postings list certifications such as CEH, OSCP or CompTIA PenTest+, but interviewers still test the concepts and hands-on skill directly. Requirements vary by employer, so read each posting.

Is ethical hacking legal?

Only with written authorization from someone who has the right to grant it, inside an agreed scope and time window. The same actions without permission break computer misuse laws in most countries.

Where to go next

Practice with the same assistant you would use on a call: it listens, transcribes and suggests answers from your own resume and the job description.

Facts on this page were last checked on . Product details come from the Natively app itself; if something here is out of date, tell us at hello@heynatively.com.

Keep reading

Put it on your own machine.

A live-conversation assistant that runs locally. Your conversations stay on your machine.

macOS 12+ · Windows 10/11

© 2026 Natively AI Private Limited

Source-available under the Natively Personal Use Source License v1.0 · IP geolocation by DB-IP