1. Home
  2. Explore
  3. Computer Science
  4. Web Application Security Basics

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Web Application Security Basics

  • 22Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Web Application Basics

What are the three fundamental building blocks of web applications?

22 questions

  1. 1

    What are the three fundamental building blocks of web applications?

    1. A

      HTML, CSS, and JavaScript

    2. B

      DOM, XML, and JSON

    3. C

      HTTP, URL, and TCP

    4. D

      Browser, Server, and Database

    Correct answer
    A

    HTML, CSS, and JavaScript

    Explanation

    Web applications are built using HTML for structure, CSS for styling, and JavaScript for dynamic behavior.

  2. 2

    What is a user agent in the context of web applications?

    1. A

      The web server that hosts the application

    2. B

      Any application that acts on behalf of the user, such as a browser

    3. C

      A program that automatically fills forms for the user

    4. D

      A security tool that monitors user activity

    Correct answer
    B

    Any application that acts on behalf of the user, such as a browser

    Explanation

    The user agent, typically a browser, speaks HTTP and acts on the user's behalf.

  3. 3

    What does the Document Object Model (DOM) provide?

    1. A

      A programming interface for JavaScript to interact with an HTML document

    2. B

      A protocol for transferring files between servers

    3. C

      A security policy for cross-origin requests

    4. D

      A styling mechanism for web pages

    Correct answer
    A

    A programming interface for JavaScript to interact with an HTML document

    Explanation

    The DOM is the interface that allows JavaScript to read, modify, and update the HTML document.

  4. 4

    What can client-side JavaScript do within a web application?

    1. A

      Only display static text and images

    2. B

      Access the user's entire file system

    3. C

      Modify or read any data from the same web application

    4. D

      Communicate with any server regardless of origin

    Correct answer
    C

    Modify or read any data from the same web application

    Explanation

    JavaScript can manipulate the DOM and access data within the same web application, limited by the same-origin policy.

  5. 5

    What is the first line of an HTTP GET request?

    1. A

      HTTP/1.1 GET /path

    2. B

      HTTP/1.1 200 OK

    3. C

      GET /path HTTP/1.1 followed by headers

    4. D

      GET /path HTTP/1.1

    Correct answer
    C

    GET /path HTTP/1.1 followed by headers

    Explanation

    An HTTP GET request starts with the verb (GET), the path, and the HTTP version, followed by headers. The exact line is 'GET /path HTTP/1.1'.

  6. 6

    What does the Referer header in an HTTP request indicate?

    1. A

      The preferred language of the user

    2. B

      The type of browser the user is using

    3. C

      The URL of the page that linked or referred the user to the current page

    4. D

      The IP address of the user's computer

    Correct answer
    C

    The URL of the page that linked or referred the user to the current page

    Explanation

    The Referer header tells the web server which site the user came from, which can be used for analytics or security checks.

  7. 7

    What does the HTTP status code 200 indicate?

    1. A

      The server encountered an error

    2. B

      The request is unauthorized

    3. C

      The page was not found

    4. D

      The request was successful

    Correct answer
    D

    The request was successful

    Explanation

    Status code 200 means 'OK', indicating the server successfully processed the request.

  8. 8

    What is the purpose of the Content-Type HTTP response header?

    1. A

      It specifies the cookies to be set

    2. B

      It controls caching behavior

    3. C

      It indicates the server's software version

    4. D

      It tells the browser how to interpret the response body

    Correct answer
    D

    It tells the browser how to interpret the response body

    Explanation

    Content-Type tells the browser whether the body is HTML, JavaScript, an image, etc., so it can process it correctly.

  9. 9

    What is the same-origin policy (SOP)?

    1. A

      A rule that requires all web pages to share the same domain name

    2. B

      A security mechanism that prevents JavaScript from one origin from accessing resources from a different origin

    3. C

      A standard that forces all websites to use HTTPS

    4. D

      A policy that allows unrestricted cross-origin requests

    Correct answer
    B

    A security mechanism that prevents JavaScript from one origin from accessing resources from a different origin

    Explanation

    The same-origin policy restricts how a document or script loaded from one origin can interact with resources from another origin.

  10. 10

    What three components define an origin?

    1. A

      Hostname, port, and query string

    2. B

      Protocol, domain name, and path

    3. C

      Protocol (scheme), hostname, and port

    4. D

      Scheme, domain, and subdomain

    Correct answer
    C

    Protocol (scheme), hostname, and port

    Explanation

    An origin is defined by the combination of scheme (e.g., http, https), hostname (e.g., example.com), and port (e.g., 80, 443).

  11. 11

    Are and considered the same origin?

    1. A

      No, because they have different hostnames

    2. B

      Yes, because the port is the same (default)

    3. C

      No, because they have different protocols (HTTP vs HTTPS)

    4. D

      Yes, because the hostname is the same

    Correct answer
    C

    No, because they have different protocols (HTTP vs HTTPS)

    Explanation

    The protocol is part of the origin definition, so HTTP and HTTPS are different origins even if the hostname is identical.

  12. 12

    What does the X-Frame-Options HTTP response header do?

    1. A

      It specifies the frame size for the page

    2. B

      It allows the page to be loaded in an iframe from any origin

    3. C

      It prevents a page from being displayed in an iframe by another page

    4. D

      It encrypts the page content during transport

    Correct answer
    C

    It prevents a page from being displayed in an iframe by another page

    Explanation

    X-Frame-Options is a mitigation against clickjacking by controlling whether the page can be embedded in an iframe.

  13. 13

    What is clickjacking?

    1. A

      A method to steal cookies by intercepting clicks

    2. B

      A way to capture keystrokes by overlaying fake buttons

    3. C

      An attack that injects malicious JavaScript into a page

    4. D

      A technique that tricks users into clicking something different from what they perceive, by layering iframes

    Correct answer
    D

    A technique that tricks users into clicking something different from what they perceive, by layering iframes

    Explanation

    Clickjacking uses invisible iframes overlaid on visible elements to trick users into clicking unintended elements, like a checkout button.

  14. 14

    What does the same-site concept refer to?

    1. A

      Pages that use the same protocol and port

    2. B

      The entire domain including all subdomains without restriction

    3. C

      The top-level domain plus one additional subdomain (e.g., emabracethered.com and blog.embracethered.com)

    4. D

      Any web page that shares the same IP address

    Correct answer
    C

    The top-level domain plus one additional subdomain (e.g., emabracethered.com and blog.embracethered.com)

    Explanation

    Same-site is broader than same-origin; it includes all subdomains of a registered domain, e.g., embracethered.com and blog.embracethered.com are same-site.

  15. 15

    Why are cookies used in HTTP?

    1. A

      To store user passwords on the client side

    2. B

      To encrypt data transmitted between browser and server

    3. C

      To create state and maintain sessions across multiple requests, since HTTP is stateless

    4. D

      To improve page loading speeds by caching content

    Correct answer
    C

    To create state and maintain sessions across multiple requests, since HTTP is stateless

    Explanation

    HTTP is a stateless protocol; cookies allow servers to remember user state (e.g., login sessions) by storing small pieces of data in the browser.

  16. 16

    How does a browser send cookies to a server?

    1. A

      Only for POST requests

    2. B

      Only if the cookie has the Secure flag set

    3. C

      Only when JavaScript explicitly sends them

    4. D

      Automatically, with every HTTP request to a domain for which the browser has stored cookies

    Correct answer
    D

    Automatically, with every HTTP request to a domain for which the browser has stored cookies

    Explanation

    Browsers automatically include cookies in requests to the matching domain, without requiring any code action.

  17. 17

    What does the HttpOnly flag on a cookie do?

    1. A

      It makes the cookie expire immediately after being set

    2. B

      It ensures the cookie is only sent over HTTPS

    3. C

      It prevents client-side scripts (like JavaScript) from accessing the cookie

    4. D

      It stops the cookie from being sent cross-site

    Correct answer
    C

    It prevents client-side scripts (like JavaScript) from accessing the cookie

    Explanation

    The HttpOnly flag makes the cookie inaccessible to JavaScript, reducing the risk of cookie theft via XSS.

  18. 18

    What does the Secure flag on a cookie enforce?

    1. A

      The cookie is encrypted on the client side

    2. B

      The cookie is not accessible via JavaScript

    3. C

      The cookie is only transmitted over encrypted HTTPS connections

    4. D

      The cookie can only be read by the server

    Correct answer
    C

    The cookie is only transmitted over encrypted HTTPS connections

    Explanation

    The Secure flag ensures the cookie is not sent over unencrypted HTTP, protecting it from network sniffing.

  19. 19

    What is the purpose of the SameSite cookie attribute?

    1. A

      It forces the cookie to be sent only for subdomain requests

    2. B

      It encrypts the cookie value

    3. C

      It ensures the cookie is only set for the exact same origin

    4. D

      It controls whether the cookie is sent in cross-site requests, helping to prevent CSRF and tracking

    Correct answer
    D

    It controls whether the cookie is sent in cross-site requests, helping to prevent CSRF and tracking

    Explanation

    The SameSite attribute restricts cookie sending to same-site requests, which mitigates cross-site request forgery (CSRF) and limits ad tracking.

  20. 20

    What is Strict-Transport-Security (HSTS) used for?

    1. A

      It enables HTTP/2 protocol for faster loading

    2. B

      It instructs the browser to always use HTTPS for future requests to that domain

    3. C

      It prevents cookies from being sent over HTTP

    4. D

      It forces the use of a specific TLS certificate

    Correct answer
    B

    It instructs the browser to always use HTTPS for future requests to that domain

    Explanation

    HSTS tells the browser to automatically upgrade any HTTP requests to HTTPS, preventing downgrade attacks.

  21. 21

    Which organization provides free TLS certificates?

    1. A

      Symantec

    2. B

      Cloudflare

    3. C

      Let's Encrypt

    4. D

      Verizon

    Correct answer
    C

    Let's Encrypt

    Explanation

    Let's Encrypt is a free, automated, and open certificate authority that offers TLS certificates.

  22. 22

    Which tool was specifically mentioned for inspecting HTTP traffic on Windows?

    1. A

      Wireshark

    2. B

      Nmap

    3. C

      Fiddler

    4. D

      Metasploit

    Correct answer
    C

    Fiddler

    Explanation

    Fiddler is a free HTTP debugging proxy that can inspect requests and responses, and was highlighted for use on Windows.

Question 1 of 22
Question 1 of 22

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent