VAPT Hands-On Interview Questions with an Offline Exercise

Hands-on VAPT interviews ask you to interpret evidence, explain a technical decision and report what remains unverified. The offline exercise below compares supplied response headers with a small Python program. It distinguishes the enforcing CSP header name from Report-Only and lists attributes on separate cookies. It sends no requests and tests no application.

Jul 30, 2024 - 21:35
Updated: 
101.9k

Penetration Testing in Cybersecurity & Ethical Hacking · Lab / project

VAPT Hands-On Interview Questions with an Offline Exercise

Quick answer: Hands-on VAPT interviews ask you to interpret evidence, explain a technical decision and report what remains unverified. The offline exercise below compares supplied response headers with a small Python program. It distinguishes the enforcing CSP header name from Report-Only and lists attributes on separate cookies. It sends no requests and tests no application. Use the output as a starting point for requirement review, then explain which browser, server and authorisation questions it cannot answer.

Key takeaways

  • Keep supplied evidence separate from live observations.
  • Preserve individual Set-Cookie headers during review.
  • Distinguish CSP enforcement from reporting configuration.
  • Interpret cookie flags in the application context.
  • Explain the requirement, limitation and retest evidence.

Table of Contents

What should you clarify before a hands-on task?

Ask what input is supplied, what you may execute and what output the interviewer expects. A task to review recorded responses does not authorise connecting to names found inside them. Confirm the intended application behaviour before assigning severity to a missing header.

The NIST SP 800-115 testing and assessment guide supports planning and analysis of assessment evidence. Here the input consists entirely of invented Python literals. The before sample contains a Report-Only CSP header and a session cookie without explicit Secure or SameSite attributes. The after sample adds an enforcing-header name and those attributes.

The question is deliberately narrow: what changed in these records? It is not a claim that either sample came from a deployed service. Label the samples and retain them with the result so another reviewer can inspect the same input.

Why are CSP and Report-Only different?

The MDN CSP Report-Only header reference explains that Content-Security-Policy-Report-Only monitors policy violations without enforcing that policy. Content-Security-Policy is a separate response header. Finding the words CSP in an export therefore does not tell you which behaviour is configured.

The OWASP HTTP security headers guide describes CSP as an additional browser security layer. Header presence alone does not establish a strong policy, correct application behaviour or complete XSS protection. Directives, delivered responses and browser behaviour need separate review.

The fixture prints whether each header name exists. It does not parse CSP directives, validate reporting destinations or execute a browser. Even the supplied default-src value needs application context before anyone could decide whether it permits required functionality and constrains unwanted content appropriately.

How can you inspect these supplied headers offline?

This exact program was executed successfully on Python 3.14.4 with the expected output and empty standard error. The Python http.cookies reference documents SimpleCookie. Each Set-Cookie value is parsed separately, preserving multiple header records instead of collapsing them into a dictionary entry.

from http.cookies import SimpleCookie

samples = {
    "before": [
        ("Content-Security-Policy-Report-Only", "default-src 'self'"),
        ("Set-Cookie", "session=synthetic; Path=/; HttpOnly"),
        ("Set-Cookie", "theme=synthetic; Path=/; SameSite=Lax"),
    ],
    "after": [
        ("Content-Security-Policy", "default-src 'self'"),
        ("Set-Cookie", "session=synthetic; Path=/; Secure; HttpOnly; SameSite=Lax"),
        ("Set-Cookie", "theme=synthetic; Path=/; SameSite=Lax"),
    ],
}

for label, headers in samples.items():
    names = {name.lower() for name, value in headers}
    enforced = "content-security-policy" in names
    reporting = "content-security-policy-report-only" in names
    print(f"{label}: CSP header={enforced}, Report-Only header={reporting}")
    for name, value in headers:
        if name.lower() != "set-cookie":
            continue
        cookie = SimpleCookie()
        cookie.load(value)
        if len(cookie) != 1:
            raise ValueError("Expected one cookie per supplied header")
        for key, item in cookie.items():
            print(f"  {key}: Secure={bool(item['secure'])}, "
                  f"HttpOnly={bool(item['httponly'])}, "
                  f"SameSite={item['samesite'] or 'unspecified'}")

Expected output:

before: CSP header=False, Report-Only header=True
  session: Secure=False, HttpOnly=True, SameSite=unspecified
  theme: Secure=False, HttpOnly=False, SameSite=Lax
after: CSP header=True, Report-Only header=False
  session: Secure=True, HttpOnly=True, SameSite=Lax
  theme: Secure=False, HttpOnly=False, SameSite=Lax

What does the output establish?

The before sample has the reporting-header name but lacks the enforcing-header name. The after sample has the enforcing-header name. The session cookie gains explicit Secure and SameSite attributes, while the theme cookie stays unchanged. These are literal comparisons of the supplied records.

The MDN Set-Cookie reference explains the attributes. Secure restricts transmission to secure contexts subject to browser rules; HttpOnly limits script access to the cookie, while the cookie can still accompany script-initiated requests. SameSite addresses cross-site sending rules, which are different from same-origin restrictions.

The parser does not establish which cookie authenticates a user, whether the server accepts an expired session or whether every response sets consistent attributes. It also does not classify missing HttpOnly on a theme preference as automatically equivalent to missing protection on a session cookie.

Printed observationSupported statementNot established
CSP header=TrueThe supplied enforcing-header name existsPolicy quality or browser enforcement outcome
session Secure=TrueThe supplied cookie includes that flagComplete session security or server-side expiry
theme HttpOnly=FalseThat supplied preference cookie lacks the flagA confirmed authentication vulnerability

What follow-up questions should you ask?

Ask which cookie carries authentication, which responses set or update it and what the session lifecycle requires. A logout observation needs server-side validity and client-storage context. Header inspection alone does not answer those questions.

For state-changing requests, the OWASP CSRF prevention guide explains that SameSite is a defence-in-depth measure with important deployment boundaries. It should not be treated as a universal replacement for appropriate CSRF protection. A successful login also says nothing about permission to read another user's records.

Use the OWASP ASVS verification standard to choose application requirements for a fuller assessment. In this interview task, state the proposed evidence rather than pretending it has already been collected. The relevant follow-up might be an approved session-lifecycle review, not a larger automated scan.

Interview questionAnswer cueEvidence needed beyond this fixture
Is the session now secure?Several explicit attributes improvedLifecycle, application use and delivered-response behaviour
Is CSRF prevented?SameSite contributes under defined conditionsApplicable request protections and supported client behaviour
Can users read only permitted records?Headers do not determine object permissionIdentity, object and action authorisation observations

How would you write a finding from the exercise?

Write a limited observation first: the supplied before session-cookie record lacks explicit Secure and SameSite attributes required by the exercise's assumed baseline. Identify the sample and the specific attributes. Explain that deployment impact depends on the actual application and client context.

Do not report successful session theft, a browser exploit or unauthorised data access. None occurred. If the interviewer asks for severity, describe the missing facts needed to assess consequence and exposure. A category label without those facts would overstate the evidence.

The after record supports a comparison against that narrow baseline. It cannot close a real production finding without confirming that the corrected configuration is deployed on the relevant responses and that the change preserves legitimate behaviour.

How do you describe this task as hands-on experience?

Say that you built and executed an offline parser over synthetic response records, checked its expected output and explained the limits. That is a truthful technical contribution. It should not be described as a penetration test of a client application.

Be ready to discuss why the headers are stored as pairs, why cookies are parsed separately and why malformed or unexpected input requires explicit handling. The fixture deliberately accepts one cookie per supplied header; a broader ingestion tool would need additional validation and tests for its supported formats.

For a useful extension, change only a synthetic preference cookie and explain whether the session conclusion changes. The important skill is connecting each output to the right claim, rather than turning every printed False value into a vulnerability.

Related reading: presenting project experience; mobile platform and backend evidence.

References

Frequently Asked Questions

No, it reads only invented in-memory records and uses the Python standard library without making requests or accessing an account.

The Report-Only header monitors rather than enforces its policy; the enforcing header and actual policy behaviour need separate consideration.

Responses can set multiple cookies, so replacing repeated header names with one dictionary value can discard evidence needed for review.

It limits direct script access, but the browser can still send the cookie with requests initiated by scripts under applicable rules.

SameSite uses site-related rules, while origin includes scheme, host and port; the two boundaries should not be treated as identical.

It proves only the reported properties of supplied records; policy quality, session lifecycle and application authorisation remain separate assessment questions.

Requirements depend on a cookie’s purpose and application context, so a preference cookie and an authentication cookie need careful distinction.

Describe it honestly as an executed offline synthetic exercise, explaining your analysis without claiming a client engagement or live assessment.

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Wow Wow 0
Sad Sad 0
Angry Angry 0
Priyanka

I am dedicated to staying up-to-date on the most current technology trends and like to craft content that informs and inspires. Whether through detailed analysis, informative guides, or exact opinion articles, I desire to create engaging content for both technology lovers and industry experts.