Docsity

Web Application Security: Q&A on HTTP, Vulnerabilities, and Security Measures, Exams of Technology

Toggle sidebar
bg1
SANS SEC522: Application Security: Securing Web Apps,
APIs, and Microservices
1
1:Which of the following is a key difference between HTTP/1.1 and HTTP/2?
A. HTTP/2 uses TCP, while HTTP/1.1 uses UDP.
B. HTTP/2 supports multiplexing multiple requests over a single connection.
C. HTTP/1.1 supports binary framing, whereas HTTP/2 uses plain text.
D. HTTP/2 does not support server push.
Correct Answer: B
Explanation: HTTP/2 introduces multiplexing, allowing multiple requests and responses to
be sent simultaneously over a single TCP connection, improving performance compared to
HTTP/1.1, which requires separate connections for concurrent requests.
2:Which authentication method involves the use of tokens that are issued by a server
upon successful login?
A. Basic Authentication
B. Token-Based Authentication
C. Digest Authentication
D. Form-Based Authentication
Correct Answer: B
Explanation: Token-Based Authentication involves the server issuing a token upon
successful login, which the client includes in subsequent requests to authenticate itself.
3:In a typical three-tier web application architecture, which layer is responsible for
interacting directly with the database?
A. Presentation Layer
B. Business Logic Layer
C. Data Access Layer
D. Client Layer
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Partial preview of the text

Download Web Application Security: Q&A on HTTP, Vulnerabilities, and Security Measures and more Exams Technology in PDF only on Docsity!

APIs, and Microservices

1:Which of the following is a key difference between HTTP/1.1 and HTTP/2?

A. HTTP/2 uses TCP, while HTTP/1.1 uses UDP. B. HTTP/2 supports multiplexing multiple requests over a single connection. C. HTTP/1.1 supports binary framing, whereas HTTP/2 uses plain text. D. HTTP/2 does not support server push. Correct Answer: B Explanation: HTTP/2 introduces multiplexing, allowing multiple requests and responses to be sent simultaneously over a single TCP connection, improving performance compared to HTTP/1.1, which requires separate connections for concurrent requests.

2:Which authentication method involves the use of tokens that are issued by a server

upon successful login? A. Basic Authentication B. Token-Based Authentication C. Digest Authentication D. Form-Based Authentication Correct Answer: B Explanation: Token-Based Authentication involves the server issuing a token upon successful login, which the client includes in subsequent requests to authenticate itself.

3:In a typical three-tier web application architecture, which layer is responsible for

interacting directly with the database? A. Presentation Layer B. Business Logic Layer C. Data Access Layer D. Client Layer

APIs, and Microservices

Correct Answer: C Explanation: The Data Access Layer in a three-tier architecture is responsible for interacting directly with the database, handling data retrieval and storage.

4:Which of the following is a recent trend in web application attacks?

A. SQL Injection B. Cross-Site Scripting (XSS) C. Server-Side Request Forgery (SSRF) D. Buffer Overflow Correct Answer: C Explanation: While SQL Injection and XSS are long-standing attack vectors, SSRF has become a more recent trend, allowing attackers to make unauthorized requests from the server.

5:What is the primary function of a Web Application Firewall (WAF)?

A. To prevent unauthorized physical access to the server B. To filter and monitor HTTP traffic between a web application and the Internet C. To manage database connections securely D. To handle load balancing for web applications Correct Answer: B Explanation: A Web Application Firewall (WAF) filters, monitors, and blocks HTTP traffic to and from a web application to protect against various attacks like SQL injection, XSS, and others.

6:Which HTTP method is typically used to retrieve data without causing any side

effects on the server? A. POST

APIs, and Microservices

Explanation: The HTTP protocol includes the request line, headers, and optionally a body. Encrypted payloads are part of HTTPS, which is HTTP over TLS, but encryption is not a component of HTTP itself.

9:Which authentication technology uses certificates to verify the identity of a user or

device? A. OAuth B. SAML C. Mutual TLS (mTLS) D. OpenID Connect Correct Answer: C Explanation: Mutual TLS (mTLS) uses certificates for both client and server to verify each other's identities, providing strong authentication based on certificates.

10:What is the main advantage of using HTTP/3 over its predecessors?

A. It uses UDP instead of TCP for faster connection establishment. B. It is a text-based protocol, making it easier to read. C. It does not require encryption. D. It is backward compatible with HTTP/1.1. Correct Answer: A Explanation: HTTP/3 uses QUIC, which is based on UDP, allowing for faster connection establishment and improved performance over high-latency networks.

11:Which HTTP status code indicates that the request was successful and a new

resource was created? A. 200 OK B. 201 Created

APIs, and Microservices

C. 204 No Content D. 301 Moved Permanently Correct Answer: B Explanation: The 201 Created status code indicates that the request has been fulfilled and resulted in the creation of a new resource.

12:Which of the following is a common vulnerability associated with improper HTTP

header configuration? A. Cross-Site Scripting (XSS) B. Clickjacking C. HTTP Response Splitting D. SQL Injection Correct Answer: C Explanation: HTTP Response Splitting occurs when an application includes untrusted data in HTTP headers without proper validation, allowing attackers to inject additional headers or body content.

13:What does CORS stand for, and why is it important in web security?

A. Cross-Origin Resource Sharing; it controls how resources are shared between different origins. B. Content Origin Resource Security; it ensures content integrity. C. Cross-Origin Request Security; it prevents unauthorized requests. D. Content Over Resource Sharing; it manages resource allocation. Correct Answer: A Explanation: CORS stands for Cross-Origin Resource Sharing. It is a security feature that allows or restricts resources on a web page to be requested from another domain outside the domain from which the resource originated.

APIs, and Microservices

Correct Answer: B Explanation: HTTPS provides a secure channel by encrypting the data transmitted between the client and server, ensuring authentication, data integrity, and confidentiality.

17:Which of the following is an advantage of using JSON Web Tokens (JWT) for

authentication? A. They require server-side storage of session data. B. They are less secure than traditional cookies. C. They can be easily used across different domains and services. D. They are not compatible with stateless architectures. Correct Answer: C Explanation: JWTs are self-contained tokens that can be used across different domains and services, making them suitable for distributed and microservices architectures.

18:In the context of web server configurations, what is the principle of "least

privilege"? A. Granting users the highest level of access to perform their tasks. B. Restricting users' access rights to the minimum necessary to perform their functions. C. Allowing users to request elevated privileges when needed. D. Regularly changing user privileges to enhance security. Correct Answer: B Explanation: The principle of least privilege involves restricting users' access rights to the minimum necessary to perform their functions, reducing the potential impact of compromised accounts.

19:Which HTTP method is idempotent, meaning that multiple identical requests have

the same effect as a single request?

APIs, and Microservices

A. POST

B. PATCH

C. GET

D. PUT

Correct Answer: D Explanation: The PUT method is idempotent because multiple identical requests will result in the same state as a single request, making it safe for repeated use without additional side effects.

20:What is the main purpose of using environment variables in web application

configurations? A. To store sensitive information like API keys and database credentials outside the codebase. B. To increase the performance of the application. C. To allow multiple users to access the application simultaneously. D. To manage user sessions effectively. Correct Answer: A Explanation: Environment variables are used to store sensitive information such as API keys, database credentials, and configuration settings outside the codebase, enhancing security and flexibility.

21:Which of the following protocols is used by HTTP/3 to provide reliable data

transmission? A. TCP B. UDP C. SCTP D. ICMP

APIs, and Microservices

B. Enhanced scalability and flexibility C. Tighter coupling between components D. Difficulty in maintaining codebases Correct Answer: B Explanation: Microservices architecture enhances scalability and flexibility by allowing individual services to be developed, deployed, and scaled independently.

25:What does the Strict-Transport-Security (HSTS) header enforce?

A. It ensures that browsers only communicate with the server over HTTPS. B. It restricts content types that can be loaded by the browser. C. It prevents the website from being embedded in iframes. D. It specifies the server's preferred encryption algorithms. Correct Answer: A Explanation: The Strict-Transport-Security (HSTS) header instructs browsers to only communicate with the server over HTTPS, preventing downgrade attacks and ensuring secure connections.

26:Which of the following best describes a Content Delivery Network (CDN)?

A. A network of servers that deliver web content to users based on their geographic location. B. A centralized server that stores all web application data. C. A firewall system that protects web applications. D. A protocol used for secure data transmission. Correct Answer: A Explanation: A CDN is a network of distributed servers that deliver web content to users based on their geographic location, improving load times and reducing latency.

APIs, and Microservices

27 In web application architecture, what is the primary role of the presentation layer?

A. To handle data storage and retrieval. B. To process business logic and rules. C. To manage user interfaces and user experience. D. To secure network communications. Correct Answer: C Explanation: The presentation layer is responsible for managing the user interface and user experience, handling how data is presented to and interacted with by the user.

28:Which security mechanism can be used to protect APIs from unauthorized access?

A. SQL Injection B. Rate Limiting C. Cross-Origin Resource Sharing (CORS) D. API Keys and OAuth Tokens Correct Answer: D Explanation: API Keys and OAuth Tokens are security mechanisms used to authenticate and authorize access to APIs, ensuring that only authorized clients can interact with them.

29:What is the primary purpose of input validation in web applications?

A. To enhance user interface design. B. To ensure that user-supplied data is safe and conforms to expected formats. C. To optimize database queries. D. To manage user sessions effectively. Correct Answer: B

APIs, and Microservices

C. To specify allowed HTTP methods. D. To manage caching policies. Correct Answer: A Explanation: The Content-Security-Policy (CSP) header defines the sources of content that browsers are allowed to load on a webpage, helping to prevent attacks like XSS.

33:Which of the following best describes "mDNS" in the context of web infrastructure

security? A. Multicast DNS, used for service discovery on local networks. B. Managed DNS, a service for handling DNS records. C. Modified DNS, a DNS protocol extension. D. Mobile DNS, optimized for mobile devices. Correct Answer: A Explanation: mDNS stands for Multicast DNS, which is used for service discovery on local networks without requiring a centralized DNS server. It can have security implications if not properly managed.

34:What is the purpose of using a reverse proxy in web application architecture?

A. To serve as the primary database server. B. To distribute incoming traffic to multiple backend servers. C. To handle client-side scripting. D. To encrypt data transmitted to the client. Correct Answer: B Explanation: A reverse proxy sits between clients and backend servers, distributing incoming traffic across multiple servers, improving performance, scalability, and security.

  1. What is the impact of deploying AI models without proper security measures in production environments?

APIs, and Microservices

A) It has no impact on application security. B) It can lead to data breaches, model manipulation, and unauthorized access, compromising both the application and its users. C) It improves the performance of the AI models. D) It reduces the complexity of the application. Answer: B) It can lead to data breaches, model manipulation, and unauthorized access, compromising both the application and its users. Explanation: Without adequate security, AI models can become vectors for attacks, leading to compromised data integrity, privacy violations, and unauthorized access.

36:What does the acronym OWASP stand for?

A. Open Web Application Security Project B. Online Web Application Security Protocol C. Open Wireless Application Security Project D. Official Web Application Security Plan Correct Answer: A Explanation: OWASP stands for the Open Web Application Security Project, a nonprofit foundation that works to improve the security of software through community-led open- source projects.

37:Which of the following best describes "server hardening"?

A. Increasing the server's processing power. B. Securing the server by reducing vulnerabilities and applying best practices. C. Installing additional software on the server. D. Optimizing server configurations for performance.

APIs, and Microservices

A. Storing them directly in the source code. B. Using environment variables or dedicated secret management services. C. Sharing them via email. D. Embedding them in client-side scripts. Correct Answer: B Explanation: Storing secrets in environment variables or using dedicated secret management services ensures that sensitive information is kept out of the source code and managed securely.

41:What is the primary goal of "defense in depth" in web application security?

A. To rely on a single security mechanism for protection. B. To layer multiple security controls to protect against different types of threats. C. To focus solely on perimeter security. D. To prioritize performance over security. Correct Answer: B Explanation: Defense in depth involves implementing multiple layers of security controls to protect against a variety of threats, ensuring that if one layer is breached, others still provide protection.

42:Which HTTP method is used to partially update a resource?

A. GET

B. POST

C. PUT

D. PATCH

Correct Answer: D

APIs, and Microservices

Explanation: The PATCH method is used to apply partial modifications to a resource, allowing for more efficient updates compared to replacing the entire resource with PUT.

43:What is the main purpose of using version control systems like Git in web

application development? A. To deploy applications to production servers. B. To manage and track changes to the codebase over time. C. To handle user authentication. D. To perform automated testing. Correct Answer: B Explanation: Version control systems like Git are used to manage and track changes to the codebase over time, enabling collaboration, history tracking, and rollback capabilities.

44:Which of the following is an example of a stateless authentication mechanism?

A. Session IDs stored on the server. B. Cookies with session tokens. C. JSON Web Tokens (JWT). D. Server-side stored user sessions. Correct Answer: C Explanation: JSON Web Tokens (JWT) are stateless because all the necessary authentication information is contained within the token itself, eliminating the need for server-side session storage.

45:What is the purpose of the SameSite attribute in cookies?

A. To specify the encryption method for the cookie. B. To control whether the cookie is sent with cross-site requests.

APIs, and Microservices

48:Which of the following best describes "credential-stealing" attacks?

A. Exploiting vulnerabilities to gain unauthorized access to credentials. B. Encrypting user credentials for secure storage. C. Generating strong passwords for users. D. Validating user credentials during login. Correct Answer: A Explanation: Credential-stealing attacks involve exploiting vulnerabilities to obtain user credentials, such as usernames and passwords, often through phishing, malware, or exploiting application flaws.

49:In the context of SSRF, why is it important to validate and sanitize user input that

affects server-side requests? A. To improve server performance. B. To prevent unauthorized access to internal systems and resources. C. To enhance user experience. D. To comply with data formatting standards. Correct Answer: B Explanation: Validating and sanitizing user input that influences server-side requests helps prevent SSRF attacks, where attackers may exploit the application to access internal systems or sensitive resources.

50:What is the primary risk associated with improperly managed web server

configurations? A. Reduced server performance. B. Increased difficulty in scaling the application. C. Exposure of sensitive information and increased vulnerability to attacks. D. Higher operational costs.

APIs, and Microservices

Correct Answer: C Explanation: Improperly managed web server configurations can lead to the exposure of sensitive information, misconfigurations that make the server more vulnerable to attacks, and other security risks.

51:Which of the following is a common practice for securing APIs?

A. Allowing all HTTP methods. B. Using IP whitelisting exclusively. C. Implementing authentication and authorization mechanisms. D. Storing API keys in client-side code. Correct Answer: C Explanation: Implementing authentication and authorization mechanisms ensures that only authorized users and applications can access and perform actions on APIs, enhancing security.

52:What is the purpose of rate limiting in web applications?

A. To enhance user experience by speeding up responses. B. To restrict the number of requests a client can make in a given time frame, preventing abuse. C. To balance the load across multiple servers. D. To encrypt data transmitted between client and server. Correct Answer: B Explanation: Rate limiting restricts the number of requests a client can make within a specific time frame, helping to prevent abuse, such as brute-force attacks or denial-of-service (DoS) attacks.

53:Which of the following best describes "injection attacks"?