Web Application Security Basics
- 24Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
What are the three fundamental building blocks of web applications?
24 questions
- 1
What are the three fundamental building blocks of web applications?
Model answer
HTML (Hypertext Markup Language), CSS (Cascading Style Sheets), and JavaScript.
Explanation
HTML structures the content, CSS defines presentation, and JavaScript adds dynamic behavior.
- 2
What is a user agent in the context of web applications?
Model answer
A user agent is any application that acts on behalf of the user, most commonly a web browser (e.g., Firefox, Chrome).
Explanation
The term is used in RFCs to refer to the browser or other software that makes HTTP requests.
- 3
What does HTTP stand for and what is its role in the web?
Model answer
HTTP stands for Hypertext Transfer Protocol; it is the protocol used for communication between user agents and web servers.
Explanation
HTTP defines how requests and responses are formatted and transmitted over the World Wide Web.
- 4
Describe the structure of an HTTP GET request.
Model answer
An HTTP GET request consists of a verb (GET), a destination URL, the protocol version, and a set of request headers.
Explanation
The verb indicates the action, the URL specifies the resource, and headers provide additional information like User-Agent and Referrer.
- 5
What is the meaning of the HTTP status code 200?
Model answer
The status code 200 means the request was successful (OK).
Explanation
It indicates that the server processed the request without error and is sending the expected response.
- 6
What does the Content-Type HTTP response header indicate?
Model answer
The Content-Type header tells the browser how to interpret the response body (e.g., text/html for HTML, application/javascript for JavaScript).
Explanation
It ensures the user agent renders or processes the response correctly.
- 7
What are the three main parts of an HTML element?
Model answer
An HTML element consists of tags, attributes, and optional content (e.g., string literals).
Explanation
Tags define the element type, attributes refine its properties, and content is the text or nested elements.
- 8
What is the purpose of CSS in a web page?
Model answer
CSS (Cascading Style Sheets) defines how HTML elements are rendered, controlling colors, sizes, fonts, and layout.
Explanation
It separates presentation from content, allowing consistent styling across pages.
- 9
How does JavaScript interact with a web page?
Model answer
JavaScript interacts with the web page through the Document Object Model (DOM), which provides a programming interface to read, modify, or update the HTML document.
Explanation
The DOM allows JavaScript to access any part of the page and respond to user actions.
- 10
Define the Same-Origin Policy.
Model answer
The Same-Origin Policy is a security mechanism that restricts JavaScript from interacting with resources from a different origin (scheme, host, and port combination).
Explanation
It prevents malicious code on one site from accessing sensitive data on another site.
- 11
What three components define an origin?
Model answer
An origin is defined by the scheme (protocol), hostname, and port number.
Explanation
For example, is a different origin from .
- 12
Give an example of two different origins.
Model answer
and are different origins because they have different ports.
Explanation
Similarly, and are different origins due to different schemes.
- 13
What is the purpose of the X-Frame-Options HTTP response header?
Model answer
X-Frame-Options prevents a web page from being embedded in an iframe on another site, mitigating clickjacking attacks.
Explanation
It instructs the browser to block framing of the page, with values like DENY or SAMEORIGIN.
- 14
What is a clickjacking attack?
Model answer
Clickjacking tricks a user into clicking something different from what they perceive, often by overlaying transparent iframes on top of visible elements.
Explanation
For example, an attacker could overlay a fake button on top of a real 'Checkout' button to steal a purchase.
- 15
Explain the Same-Site concept compared to Same-Origin.
Model answer
Same-Site considers the top-level domain plus one subdomain level (e.g., embracethered.com, , and blog.embracethered.com are same-site), while Same-Origin is stricter (scheme+host+port must match).
Explanation
Same-Site is used in cookie attributes and other security policies; it is less restrictive than Same-Origin.
- 16
What is the purpose of cookies in HTTP?
Model answer
Cookies allow HTTP, which is stateless, to maintain state across multiple requests, enabling sessions such as user authentication.
Explanation
The server sets a cookie in the response, and the browser automatically sends it back with each subsequent request to the same domain.
- 17
What does the HttpOnly cookie attribute do?
Model answer
HttpOnly makes the cookie inaccessible to JavaScript, preventing cross-site scripting (XSS) attacks from stealing the cookie.
Explanation
The cookie is only sent via HTTP(S) requests and cannot be read by client-side scripts.
- 18
What does the Secure cookie attribute ensure?
Model answer
The Secure attribute ensures the cookie is only sent over encrypted HTTPS connections, preventing interception over unencrypted HTTP.
Explanation
It protects the cookie from being exposed in man-in-the-middle attacks on insecure networks.
- 19
What does the SameSite cookie attribute control?
Model answer
SameSite controls whether the cookie is sent in cross-site requests, helping to mitigate cross-site request forgery (CSRF) and tracking.
Explanation
Values can be Strict, Lax, or None; Strict prevents sending the cookie on any cross-site request, Lax allows some top-level navigations.
- 20
What is the Strict-Transport-Security (HSTS) header?
Model answer
HSTS instructs the browser to always use HTTPS for future requests to the domain, automatically upgrading HTTP to HTTPS.
Explanation
It prevents downgrade attacks and ensures encrypted communication even if the user types http://.
- 21
Name two tools used for inspecting HTTP traffic in web application security testing.
Model answer
Fiddler and Burp Suite are two common tools; browser developer tools (e.g., Chrome DevTools) also provide network inspection.
Explanation
These tools allow viewing and modifying requests and responses to analyze web application behavior.
- 22
What is the Referrer header and what information does it provide?
Model answer
The Referrer header tells the web server the URL from which the user came (the previous page).
Explanation
It can be used for analytics, navigation tracking, but also poses privacy concerns.
- 23
Why is it important to always encrypt web traffic, even for internal applications?
Model answer
Encrypted traffic (HTTPS) protects data from interception and tampering by unauthorized parties, including on internal networks.
Explanation
Even internal networks can be compromised; encryption ensures confidentiality and integrity of communications.
- 24
What is Let's Encrypt?
Model answer
Let's Encrypt is a free, automated certificate authority that provides SSL/TLS certificates to enable HTTPS.
Explanation
It simplifies obtaining and renewing certificates, making encrypted web traffic more accessible.

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