Sessions, cookies and web application security – Server Side interview prep
261 interview-style multiple-choice questions on Sessions, cookies and web application security, organized by topic: concepts, scenarios, code to read and tradeoffs, each with a short explanation. Learn the 191 key terms with the flashcards first, then test yourself.
Take the practice test · Flashcards · All study tools
What it covers
- 6.1 Server-side session design
- 6.2 Cookies from the back end
- 6.3 Session attacks and hardening
- 6.4 SQL and NoSQL injection
- 6.5 Command, template and other injection
- 6.6 SSRF, files and deserialization
- 6.7 Access control and business logic flaws
- 6.8 OWASP Top 10 and secure configuration
- 6.9 Abuse prevention, logging and response
Key terms
6.1 Server-side session design
- Session ID
- Random identifier linking a browser to server-side session data
- Sticky session
- Load balancer routing a user to the same server
- Persistent cookie
- Cookie with an expiry that survives browser restarts
- __Host- prefix
- Cookie name prefix that locks it to one host
- Session store
- Shared server-side session storage
- Session eviction
- Cache policy deleting live sessions
- Expired session cleanup
- Job deleting stale rows
- Session serialization
- Stored format must survive deploys
- Sliding expiration
- Expiry extends with activity
- Session locking
- One request at a time per session
- Cookie session store
- State kept in a signed cookie
- Log out everywhere
- Delete all of a user's sessions
- Hashed session ID
- Store only the hash
- ASP.NET Core session state
- Per-user data, not auth
- Spring Session
- Pluggable session storage
- Fail closed
- Deny when checks can't run
- Session key prefix
- Namespacing in shared Redis
- Server-side expiry
- The store decides session lifetime
- ITicketStore
- Server-side auth tickets
6.2 Cookies from the back end
- Public Suffix List
- Domains where cookies can't be shared
- Cookie name collision
- Apps clobbering shared names
- Multiple Set-Cookie
- One header per cookie
- X-Forwarded-Proto
- Original scheme behind a proxy
- Same-site vs same-origin
- Registrable domain vs exact origin
- Schemeful same-site
- Scheme counts for sites
- Cookie attribute injection
- User input adding attributes
- Session cookie name
- Rename defaults
- Cookie deletion match
- Same Path and Domain
- Strictly necessary cookies
- Exempt from consent
- Chunked cookies
- Large tickets split
- Set-Cookie caching
- Never cache in shared caches
- Vary: Cookie
- Cache fragmentation
- Lax plus Strict cookies
- Two-cookie session pattern
- Strict secure cookies
- HTTP can't set Secure cookies
- Cookie eviction
- Per-domain limits
- Host-only cookie
- No Domain attribute
- CNAME cloaking cap
- Short-lived cloaked cookies
6.3 Session attacks and hardening
- Session fixation
- Forcing a victim onto a known session ID
- Session hijacking
- Stealing and reusing a valid session
- Idle timeout
- Ending a session after inactivity
- Step-up authentication
- Asking for stronger proof before sensitive actions
- Session ID regeneration
- New ID on login or privilege change
- session_regenerate_id(true)
- Rotate and delete old session
- Session puzzling
- Reused session variables abused
- Concurrent session limit
- Cap sessions per user
- no-store on private pages
- No cached copies after logout
- OWASP idle timeouts
- 2–5 or 15–30 minutes
- Stale session roles
- Permissions cached at login
- Pass-the-cookie
- Replaying stolen session cookies
- Weak signing key
- Forgeable session cookies
- Partial authentication
- Password done, MFA pending
- Renewal timeout
- Periodic ID rotation
- Magic link
- Single-use login token
- Tracking mode COOKIE
- No jsessionid in URLs
- Security stamp
- Revalidates auth cookies
- Opaque session ID
- Random, revocable reference
6.4 SQL and NoSQL injection
- Identifier allowlist
- Map input to known names
- LIKE wildcard escaping
- Escape % and _
- Second-order SQL injection
- Stored input used unsafely later
- Boolean blind SQLi
- True/false inference
- Time-based blind SQLi
- Delay-based inference
- UNION-based SQLi
- Appending rows from other tables
- Stacked queries
- Extra statements after ;
- Dynamic SQL in procedures
- Still injectable
- Least-privilege DB account
- Limits injection damage
- Placeholder per IN value
- Safe variable lists
- NoSQL operator injection
- $ne in user input
- $where
- Server-side JavaScript in queries
- Lookup injection
- User-chosen ORM lookups
- JPQL injection
- Concatenated ORM queries
- sqlmap
- Automated SQLi testing
- Out-of-band SQLi
- Data exfiltrated via DNS
- xp_cmdshell
- SQL Server OS commands
- query_string injection
- Search syntax abuse
- Tagged SQL template
- Values sent as parameters
- format %I
- Safe identifier quoting
6.5 Command, template and other injection
- Argument injection
- Input read as an option
- Shell metacharacters
- Characters that chain commands
- shlex.quote
- Shell-escape one value
- SSTI
- Input rendered as template code
- Expression language injection
- OGNL, SpEL abuse
- Log4Shell
- JNDI lookup in logged strings
- LDAP injection
- Altered directory filters
- XPath injection
- Altered XML queries
- CRLF injection
- Newlines in headers
- Email header injection
- Newlines adding Bcc
- CSV injection
- Spreadsheet formulas in exports
- XXE
- External entities in XML
- Billion laughs
- Exponential entity expansion
- Host header poisoning
- Links built from Host
- ast.literal_eval
- Safe literal parsing
- Unicode normalization
- Normalize before validating
- Parameter pollution
- Duplicate parameters
- Shellshock
- Bash env var bug
- Content-Disposition filename
- Sanitized download names
6.6 SSRF, files and deserialization
- SQL injection
- Untrusted input changing the meaning of a SQL query
- Parameterized query
- Query with placeholders bound to values separately
- SSRF
- Server-side request forgery
- Mass assignment
- Clients setting fields they shouldn't through model binding
- Cloud metadata SSRF
- 169.254.169.254 credentials
- IMDSv2
- Token-gated metadata
- SSRF allowlist
- Approved destinations only
- DNS rebinding
- Check vs fetch IP mismatch
- Redirect bypass
- Allowed host redirects inward
- URL user info trick
- Host hidden after @
- Alternate IP forms
- 2130706433, 0x7f.1
- Blind SSRF
- No response returned
- Renderer SSRF
- HTML-to-PDF fetching internals
- Egress proxy
- Central outbound control
- Canonical path check
- Resolve then compare prefix
- Encoded traversal
- %2e%2e%2f and double encoding
- Zip Slip
- ../ in archive entries
- Zip bomb
- Tiny archive, huge output
- Web shell
- Uploaded executable script
- Image re-encoding
- Strips payloads and EXIF
- Gadget chain
- Code run during deserialization
- pickle
- Unsafe for untrusted data
- yaml.safe_load
- Basic types only
- BinaryFormatter
- Removed in .NET 9
- TypeNameHandling
- Type names in payloads
- ObjectInputFilter
- Deserialization allowlist
- Local file inclusion
- Including server files by parameter
6.7 Access control and business logic flaws
- Input model
- Allowlisted bindable fields
- Strong parameters
- permit() allowlist
- Limit overrun
- Parallel requests beat a limit
- Negative quantity
- Unvalidated numeric range
- Client-side price
- Untrusted amount
- Workflow bypass
- Skipping required steps
- Rounding abuse
- Fractions that add up
- Unverified email change
- Account takeover path
- Security through obscurity
- Hidden URL as protection
- Verb tampering
- Unchecked HTTP methods
- Method override bypass
- Tunneled methods skip rules
- Path normalization mismatch
- Proxy and app disagree
- Single-packet attack
- Synchronized parallel requests
- Conditional update
- Check and act in one statement
- Email normalization
- Consistent identity matching
- Segregation of duties
- No self-approval
- Hidden field state
- Client-controlled workflow flags
- MFA bypass path
- Weaker legacy login
- Parent-child check
- Child belongs to parent
- Per-item authorization
- Check each batch item
- Message authorization
- Re-check actor in consumers
6.8 OWASP Top 10 and secure configuration
- OWASP Top 10
- List of the most critical web application security risks
- IDOR
- Insecure direct object reference
- Security misconfiguration
- Unsafe defaults or settings in deployed systems
- Credential stuffing
- Reusing leaked credentials against other sites
- OWASP Top 10:2025
- Updated web risk ranking
- SSRF in 2025
- Folded into Broken Access Control
- Insecure Design
- Design-level flaws
- Integrity failures
- Unverified updates and data
- Logging and alerting failures
- Unwatched logs
- ASVS
- Testable security requirements
- OWASP Cheat Sheets
- Practical control guides
- Directory listing
- Folder contents exposed
- Exposed .git
- Downloadable repository
- Heap dump exposure
- Secrets in memory snapshots
- Production data in staging
- Weaker controls on real data
- Werkzeug debugger
- Interactive console RCE
- Fail open
- Errors grant access
- CVE vs CWE
- Specific bug vs weakness type
- CVSS
- 0–10 severity score
- KEV catalog
- Known exploited vulnerabilities
- Configuration drift
- Divergence from baseline
- Pen test vs scan
- Human exploitation vs automated checks
- IAST
- In-app runtime analysis
- Vulnerability disclosure policy
- How to report issues
- CIS Benchmarks
- Hardening baselines
6.9 Abuse prevention, logging and response
- Residential proxies
- Spread-out attack traffic
- SMS pumping
- Toll fraud via OTP sends
- Scraping
- Bulk copying of public data
- Card testing
- Validating stolen cards
- Honeytoken
- Fake credential that alerts
- Honeypot field
- Hidden bot trap
- Security event log
- Who, what, when, where, outcome
- SIEM
- Security log correlation and alerts
- Evidence preservation
- Isolate before rebuilding
- Key leak response
- Rotate and invalidate
- GDPR 72 hours
- Breach reporting window
- Incident playbook
- Prepared response steps
- Private Access Tokens
- Device-backed CAPTCHA alternative
- Proof of work
- CPU cost per client
- robots.txt
- Crawler request, not control
- Security notifications
- Alerts to users on account changes
- HTTP flood
- Layer 7 DDoS
- Cost-based limits
- Quotas for expensive work
- Log retention
- Keep, then delete on schedule
- Help desk social engineering
- Recovery abuse
- Event vs incident
- Occurrence vs harm
- Kill switch
- Flag to disable a feature
- Re-authentication
- Step-up before sensitive changes
Sample practice questions
How does classic server-side session authentication work?
- The server signs the user's entire profile into every page URL
- The browser stores the password and resends it with every request
- The server stores the session and gives the browser a random ID cookie
- The server recognizes the user from their IP address alone
Answer: C. The server stores the session and gives the browser a random ID cookie The cookie holds only an unguessable ID; the data stays on the server.
What does a cookie's `Domain` attribute control?
- Whether page JavaScript is allowed to read the cookie
- Which hosts get it; `Domain=example.com` includes subdomains
- The date and time at which the cookie expires
- Which other websites are allowed to embed the page
Answer: B. Which hosts get it; `Domain=example.com` includes subdomains Omitting `Domain` makes it a host-only cookie, which is tighter.
What is session fixation?
- Storing every user's session in one fixed file on disk
- A user who is logged in from two devices at the same time
- Planting a known session ID on a victim, then using it after they log in
- A session configured so that it never expires on the server
Answer: C. Planting a known session ID on a victim, then using it after they log in Prevent it by issuing a new session ID at login.
What makes this code vulnerable? ```csharp var sql = "SELECT * FROM Users WHERE Name = '" + name + "'"; ```
- `SELECT *` isn't valid SQL in most database engines
- The table name must be written in lowercase letters
- Input is concatenated into SQL, so `' OR '1'='1` alters the query
- C# strings can't contain single quote characters
Answer: C. Input is concatenated into SQL, so `' OR '1'='1` alters the query Use parameterized queries so input is always treated as data.
What is OS command injection?
- Sending SQL statements to a shell instead of a database
- User input reaching a shell, running extras like `; rm -rf /`
- A bug in the operating system's kernel exploited remotely
- Running too many shell commands in parallel on the server
Answer: B. User input reaching a shell, running extras like `; rm -rf /` Avoid the shell; call programs with argument arrays and validate input.
Which is the better input validation approach?
- Allowlist: accept only the expected format, type and range
- Blocklist: reject any input containing known bad strings
- None: just rely on the database to fail on bad input
- Browser-only: validate in the client and trust the server
Answer: A. Allowlist: accept only the expected format, type and range Client-side validation is for user experience; the server must validate again.
What is mass assignment (over-posting)?
- Assigning one task to many users at once in a project tracker
- Sending the same request many times in a row to the server
- Binding a body straight to a model, letting clients set fields like `isAdmin`
- Uploading a very large number of files in a single request
Answer: C. Binding a body straight to a model, letting clients set fields like `isAdmin` Bind to dedicated input DTOs with only the allowed fields.
What is the OWASP Top 10?
- A ranking of the ten most secure programming languages
- A list of the ten largest data breaches of all time
- A security certification exam for software developers
- An awareness list of the most critical web app security risks
Answer: D. An awareness list of the most critical web app security risks Broken access control has been at the top of recent editions.
Why log security events like failed logins and permission denials?
- So attacks can be detected, alerted on and investigated
- To make the log files larger for capacity planning
- To show each user a list of their own mistakes
- Because the HTTP standard requires those logs
Answer: A. So attacks can be detected, alerted on and investigated Never log passwords, tokens or other secrets.
What is a key tradeoff between server-side sessions and stateless JWTs?
- JWTs need a database lookup on every request, while sessions never do
- Sessions revoke easily but need shared storage; JWTs skip lookups but resist revocation
- Sessions can't be used over HTTPS, while JWTs work over any transport
- JWTs are always more secure than sessions, so sessions are effectively obsolete
Answer: B. Sessions revoke easily but need shared storage; JWTs skip lookups but resist revocation Many apps use cookies holding opaque session IDs for browsers and JWTs for APIs.
More Server Side
- HTTP fundamentals
- REST API design
- GraphQL
- gRPC & real-time APIs
- OAuth 2.0, OIDC & JWT
- C# & .NET
- Java & Spring Boot
- Node.js & Express
- Python, Django & FastAPI
- Go (Golang)
- Concurrency & multithreading
- OOP & SOLID
- Design patterns
- Dependency injection
- Logging & observability
- Data structures
- Algorithms & Big-O
- Linux & shell scripting