๐ŸŒ Back-end Web Developement ยท subject

Back-end Web Developement Security Syllabus

The Security syllabus for Back-end Web Developement in full: 3 chapters and 8 topics, every one listed below, plus 50 Security flashcards with answers.

3Chapters
8Topics
50Flashcards

Security syllabus: all 3 chapters

Expand any chapter to see its topics and sub-topics.

  1. Authentication

    3 topics
    • JWT
    • OAuth
    • Single Sign-On (SSO)
  2. Data Encryption

    2 topics
    • SSL/TLS
    • Hashing Algorithms
  3. Vulnerabilities

    3 topics
    • SQL Injection
    • Cross-Site Scripting (XSS)
    • Cross-Site Request Forgery (CSRF)

Back-end Web Developement Security flashcards โ€” 50 questions with answers

  1. What does JWT stand for, and what is it used for?

    JWT stands for JSON Web Token. It is a compact, URL-safe, self-contained token format (RFC 7519) used to securely transmit claims between parties, most commonly for stateless authentication and authorization.

  2. What are the three parts of a JWT, and how are they separated?

    A JWT has three parts separated by dots ($.$): Header, Payload, and Signature โ€” written as $\text{header}.\text{payload}.\text{signature}$. Each part is Base64URL-encoded.

  3. What does the JWT Header contain?

    The Header contains metadata about the token, typically the token type ("typ": "JWT") and the signing algorithm ("alg", e.g. HS256 or RS256).

  4. What does the JWT Payload contain?

    The Payload contains the claims โ€” statements about an entity (usually the user) and additional data, such as registered claims (iss, sub, aud, exp, iat), public claims, and private claims.

  5. List the common registered (standard) JWT claims and their meanings.

    iss (issuer), sub (subject), aud (audience), exp (expiration time), nbf (not before), iat (issued at), and jti (JWT ID).

  6. How is the JWT signature computed for an HMAC (HS256) token?

    $$\text{signature} = \text{HMACSHA256}\big(\text{base64url}(header) + "." + \text{base64url}(payload),\ secret\big)$$ The signature verifies integrity and authenticity, not confidentiality.

  7. Is the payload of a standard JWT encrypted? What does this imply for storing sensitive data?

    No. A standard (signed) JWT is only Base64URL-encoded, not encrypted, so anyone can read the payload. Never store sensitive data (passwords, secrets) in it unless you use JWE (JSON Web Encryption).

  8. Compare symmetric (HS256) vs asymmetric (RS256) JWT signing.

    HS256 uses one shared secret for both signing and verifying (HMAC). RS256 uses a private key to sign and a public key to verify (RSA), so verifiers never need the signing secret โ€” better for distributed systems.

  9. What is OAuth 2.0, and what problem does it solve?

    OAuth 2.0 is an authorization framework (RFC 6749) that lets a third-party application obtain limited access to a user's resources on another service without exposing the user's credentials, via delegated access tokens.

  10. Name the four roles defined in OAuth 2.0.

    Resource Owner (the user), Client (the app requesting access), Authorization Server (issues tokens), and Resource Server (hosts the protected resources).

  11. Is OAuth 2.0 an authentication or an authorization protocol?

    OAuth 2.0 is fundamentally an authorization (delegated access) protocol. It is not designed for authentication; OpenID Connect (OIDC) is the layer built on top of OAuth 2.0 to provide authentication.

  12. Describe the OAuth 2.0 Authorization Code flow at a high level.

    The client redirects the user to the authorization server; the user authenticates and consents; the server returns an authorization code to the client's redirect URI; the client exchanges that code (plus its client secret) at the token endpoint for an access token (and optionally a refresh token).

  13. What is PKCE in OAuth 2.0 and why is it used?

    PKCE (Proof Key for Code Exchange, RFC 7636) secures the Authorization Code flow for public clients (e.g. mobile/SPA) by using a code_verifier and its hashed code_challenge, preventing authorization code interception attacks.

  14. What is the difference between an OAuth access token and a refresh token?

    An access token is short-lived and used to access protected resources. A refresh token is longer-lived and used to obtain new access tokens without re-prompting the user for credentials.

  15. What is OpenID Connect (OIDC) and how does it relate to OAuth 2.0?

    OIDC is an identity layer on top of OAuth 2.0 that adds authentication. It introduces the ID Token (a JWT containing user identity claims) alongside the access token.

  16. What is Single Sign-On (SSO)?

    SSO is an authentication scheme that lets a user log in once with a single set of credentials and gain access to multiple independent applications or services without re-authenticating for each one.

  17. Name two common protocols/standards used to implement SSO.

    SAML (Security Assertion Markup Language, XML-based) and OpenID Connect (OIDC, JSON/JWT-based, built on OAuth 2.0). Kerberos is another SSO protocol used in enterprise networks.

  18. In SAML-based SSO, what are the Identity Provider (IdP) and Service Provider (SP)?

    The Identity Provider (IdP) authenticates the user and issues a SAML assertion. The Service Provider (SP) is the application the user wants to access and trusts the IdP's assertion to grant access.

  19. What is a SAML assertion?

    A SAML assertion is an XML document issued by the IdP that contains statements about the authenticated user โ€” authentication, attribute, and authorization decision statements โ€” which the SP consumes to establish a session.

  20. List one key advantage and one key risk of SSO.

    Advantage: fewer passwords to manage, improved user experience, and centralized access control. Risk: it is a single point of failure โ€” if the SSO credentials or IdP are compromised, all connected applications are at risk.

Show the other 30 Security flashcards
  1. What is the difference between SSL and TLS?

    SSL (Secure Sockets Layer) is the deprecated predecessor of TLS (Transport Layer Security). TLS is the modern, secure successor; SSL 2.0/3.0 are insecure and disabled. Current versions are TLS 1.2 and TLS 1.3.

  2. What three security guarantees does TLS provide?

    Confidentiality (encryption of data in transit), Integrity (detection of tampering via MAC/AEAD), and Authentication (verifying the server's โ€” and optionally the client's โ€” identity via certificates).

  3. Explain how TLS uses both asymmetric and symmetric encryption.

    TLS uses asymmetric (public-key) cryptography during the handshake to authenticate the server and securely establish a shared secret, then switches to fast symmetric encryption (e.g. AES) to encrypt the actual data for the session.

  4. What is an X.509 certificate and what does a Certificate Authority (CA) do?

    An X.509 certificate binds a public key to an identity (domain). A Certificate Authority (CA) is a trusted third party that digitally signs certificates, allowing clients to verify the certificate's authenticity through a chain of trust to a trusted root.

  5. What is the main improvement of TLS 1.3 over TLS 1.2 regarding the handshake?

    TLS 1.3 reduces the handshake to a single round trip (1-RTT, with 0-RTT resumption possible), removes obsolete/insecure algorithms, and mandates forward secrecy โ€” making it faster and more secure than TLS 1.2.

  6. What is Perfect Forward Secrecy (PFS) in TLS?

    PFS ensures that a compromise of the server's long-term private key cannot decrypt past recorded sessions, because ephemeral session keys are generated per session (e.g. via ephemeral Diffie-Hellman, ECDHE) and never stored.

  7. What is a cryptographic hash function, and what are its key properties?

    A hash function maps arbitrary-length input to a fixed-length output (digest). Key properties: deterministic, fast to compute, pre-image resistant (one-way), second pre-image resistant, and collision resistant.

  8. What does 'collision resistance' mean for a hash function?

    Collision resistance means it is computationally infeasible to find two distinct inputs $x \neq y$ such that $H(x) = H(y)$.

  9. Why are MD5 and SHA-1 considered insecure today?

    Both are broken with respect to collision resistance โ€” practical collision attacks exist (MD5 fully broken, SHA-1 collisions demonstrated), so they must not be used for security-critical purposes like digital signatures or certificates.

  10. Why should password hashing use algorithms like bcrypt, scrypt, or Argon2 instead of SHA-256?

    General-purpose hashes like SHA-256 are too fast, enabling brute-force/GPU attacks. bcrypt, scrypt, and Argon2 are deliberately slow and (for scrypt/Argon2) memory-hard, with a tunable work factor, making password cracking far more expensive.

  11. What is a salt in password hashing, and what attack does it prevent?

    A salt is a unique random value added to each password before hashing. It ensures identical passwords produce different hashes, defeating precomputed rainbow-table attacks and preventing detection of duplicate passwords.

  12. What is the difference between hashing and encryption?

    Hashing is a one-way function that cannot be reversed and produces a fixed-length digest (used for integrity/passwords). Encryption is a two-way, reversible function using a key that turns plaintext into ciphertext and back (used for confidentiality).

  13. What is an HMAC?

    HMAC (Hash-based Message Authentication Code) combines a cryptographic hash function with a secret key to provide both data integrity and authentication, computed as $\text{HMAC}(K, m) = H\big((K \oplus opad)\ \|\ H((K \oplus ipad)\ \|\ m)\big)$.

  14. What is SQL Injection (SQLi)?

    SQL Injection is a vulnerability where an attacker inserts or 'injects' malicious SQL into an application's query โ€” via untrusted input โ€” causing the database to execute unintended commands, potentially reading, modifying, or deleting data.

  15. Give a classic example of a SQL injection authentication bypass payload.

    Entering ' OR '1'='1 as the username/password turns WHERE username='' OR '1'='1' into an always-true condition, bypassing authentication because $\text{'1'='1'}$ is always true.

  16. What is the single most effective defense against SQL injection?

    Using parameterized queries (prepared statements) with bound parameters, so user input is always treated as data and never as executable SQL code. Stored procedures and ORMs (used correctly) also help.

  17. Name the main categories/classifications of SQL injection.

    In-band (Error-based and Union-based), Blind/Inferential (Boolean-based and Time-based), and Out-of-band SQL injection.

  18. What is Blind SQL injection?

    Blind SQLi is a variant where the application does not return query results or errors directly. The attacker infers data by observing the application's behavior โ€” true/false responses (Boolean-based) or response delays (time-based).

  19. Why is input validation alone insufficient to fully prevent SQL injection?

    Input validation (allowlisting) reduces risk but can be bypassed and may miss edge cases; it does not change how the query is constructed. Parameterization is required because it structurally separates code from data regardless of input content.

  20. What is Cross-Site Scripting (XSS)?

    XSS is a vulnerability where an attacker injects malicious client-side scripts (usually JavaScript) into web pages viewed by other users, causing the victim's browser to execute the attacker's code in the site's context.

  21. Name and describe the three types of XSS.

    Stored (Persistent): the payload is saved on the server and served to victims. Reflected: the payload is reflected off the server in the immediate response (e.g. via a URL parameter). DOM-based: the vulnerability is entirely in client-side JavaScript that writes untrusted data to the DOM.

  22. What can an attacker achieve with a successful XSS attack?

    Steal session cookies/tokens, hijack sessions, perform actions as the user, capture keystrokes, deface pages, redirect users to malicious sites, or deliver malware โ€” all in the victim's authenticated context.

  23. What is the primary defense against XSS?

    Context-aware output encoding/escaping of untrusted data when rendering it into HTML, and input validation. Additional defenses include a Content Security Policy (CSP) and setting the HttpOnly flag on session cookies.

  24. How does a Content Security Policy (CSP) help mitigate XSS?

    CSP is an HTTP response header that restricts which sources of scripts, styles, and other resources the browser may load/execute, blocking inline scripts and unauthorized origins โ€” limiting the impact of injected code.

  25. What does the HttpOnly cookie flag do in relation to XSS?

    HttpOnly prevents client-side JavaScript from reading the cookie via document.cookie, so even if XSS occurs, the attacker's script cannot directly steal the session cookie.

  26. What is Cross-Site Request Forgery (CSRF)?

    CSRF is an attack that tricks an authenticated user's browser into sending an unwanted, forged request to a web application in which they are logged in, causing state-changing actions to be performed without the user's intent.

  27. Why does CSRF work โ€” what does it exploit?

    It exploits the browser's automatic inclusion of credentials (like session cookies) with every request to a site, plus the site's trust that a request coming from the user's browser is intentional.

  28. What is the primary defense against CSRF?

    Anti-CSRF tokens (synchronizer tokens): a unique, unpredictable, per-session/per-request token that the server generates and validates on state-changing requests. It works because an attacker's site cannot read or guess the token.

  29. How does the SameSite cookie attribute help prevent CSRF?

    SameSite (set to Lax or Strict) instructs the browser not to send the cookie on cross-site requests, so a forged request from an attacker's origin arrives without the session cookie, defeating the CSRF attack.

  30. Contrast XSS and CSRF in one sentence each.

    XSS exploits the user's trust in a website by injecting and running malicious scripts in the victim's browser. CSRF exploits the website's trust in the user's browser by forging authenticated requests the user did not intend.

Back-end Web Developement Security FAQ

What is in the Back-end Web Developement Security syllabus?

Back-end Web Developement Security is split into 3 chapters: Authentication, Data Encryption and Vulnerabilities. Together they contain 8 topics.

How many chapters are in Back-end Web Developement Security?

3 chapters, containing 8 topics. The largest chapter is Authentication, with 3 topics.

Are there flashcards for Back-end Web Developement Security?

Yes โ€” a 50-card Security deck, printed in full in the flashcards section of this page and available in the Examius app with spaced repetition. The free plan covers one exam of your choice, including its flashcards; Examius Pro, a one-time purchase, unlocks every other exam and deck.