1. What does OWASP stand for?
A) Open Web Application Security Project
B) Online Web Application Security Program
C) Open Worldwide Application Security Protocol
D) Organization for Web Application Secure Programming
β
Answer: A) Open Web Application Security Project
π Explanation: OWASP is an open-source project dedicated to identifying and mitigating security risks in web applications.
2. Which of the following is NOT a part of the OWASP Top 10 list?
A) Injection
B) Sensitive Data Exposure
C) Network Spoofing
D) Broken Access Control
β
Answer: C) Network Spoofing
π Explanation: OWASP Top 10 focuses on web application vulnerabilities, while “Network Spoofing” is a broader network security concern.
3. SQL Injection falls under which OWASP category?
A) Security Misconfiguration
B) Injection
C) Broken Authentication
D) Cross-Site Scripting (XSS)
β
Answer: B) Injection
π Explanation: SQL Injection (SQLi) is a type of Injection attack that exploits poor query handling in databases.
4. Which security risk allows attackers to take control of user accounts by stealing session tokens?
A) Broken Authentication
B) Security Misconfiguration
C) XML External Entities (XXE)
D) Cross-Site Scripting (XSS)
β
Answer: A) Broken Authentication
π Explanation: Broken Authentication results from weak session management, allowing attackers to hijack user accounts.
5. How can SQL Injection be prevented?
A) Using string concatenation for database queries
B) Using prepared statements and parameterized queries
C) Disabling database logging
D) Obfuscating database error messages
β
Answer: B) Using prepared statements and parameterized queries
π Explanation: Prepared statements protect against SQL Injection by ensuring user input is safely handled.
6. What is the primary risk associated with Broken Access Control?
A) Unauthorized access to sensitive data
B) Phishing attacks
C) DNS spoofing
D) Man-in-the-Middle (MITM) attacks
β
Answer: A) Unauthorized access to sensitive data
π Explanation: Broken Access Control occurs when unauthorized users can access or modify sensitive data.
7. What is the best way to protect sensitive data in web applications?
A) Storing sensitive data in plain text
B) Using strong encryption and hashing techniques
C) Only allowing admins to view the data
D) Disabling user authentication
β
Answer: B) Using strong encryption and hashing techniques
π Explanation: Encryption ensures that even if data is exposed, it remains unreadable.
8. Which vulnerability is exploited by attackers using malicious JavaScript?
A) SQL Injection
B) Cross-Site Scripting (XSS)
C) Server-Side Request Forgery (SSRF)
D) Broken Access Control
β
Answer: B) Cross-Site Scripting (XSS)
π Explanation: XSS attacks occur when malicious scripts execute in a victim’s browser.
9. What is the best defense against Cross-Site Scripting (XSS)?
A) Encrypting passwords
B) Proper input validation and output encoding
C) Using HTTPS
D) Disabling browser security features
β
Answer: B) Proper input validation and output encoding
π Explanation: Validating input and encoding output prevents malicious script execution.
10. What is a common cause of Security Misconfiguration?
A) Using well-maintained security policies
B) Exposing unnecessary services and default settings
C) Regular software updates
D) Enabling multi-factor authentication
β
Answer: B) Exposing unnecessary services and default settings
π Explanation: Security misconfigurations arise from unused features, default credentials, and improper settings.
11. Which vulnerability allows unauthorized requests using an authenticated userβs credentials?
A) Server-Side Request Forgery (SSRF)
B) Cross-Site Request Forgery (CSRF)
C) XML External Entities (XXE)
D) Insecure Deserialization
β
Answer: B) Cross-Site Request Forgery (CSRF)
π Explanation: CSRF tricks users into executing unwanted actions on web applications.
12. How can CSRF be prevented?
A) Disabling cookies
B) Using CSRF tokens and SameSite cookie attributes
C) Encrypting URLs
D) Using CAPTCHAs
β
Answer: B) Using CSRF tokens and SameSite cookie attributes
π Explanation: CSRF tokens ensure only legitimate requests are processed.
13. What is XML External Entities (XXE) attack?
A) Attacking APIs through improper authentication
B) Injecting malicious XML code to exploit XML parsers
C) Modifying HTTP headers to gain unauthorized access
D) Creating multiple login attempts to bypass authentication
β
Answer: B) Injecting malicious XML code to exploit XML parsers
π Explanation: XXE can lead to data leakage and server-side attacks.
14. Why is Insecure Deserialization a risk?
A) It allows attackers to manipulate serialized objects and execute arbitrary code
B) It enables session hijacking
C) It exposes API endpoints to unauthorized users
D) It prevents users from logging into applications
β
Answer: A) It allows attackers to manipulate serialized objects and execute arbitrary code
π Explanation: Attackers can modify serialized objects to perform unauthorized actions.
15. What is Server-Side Request Forgery (SSRF)?
A) Exploiting a serverβs ability to send unintended requests
B) Stealing credentials through a phishing attack
C) Injecting SQL queries into the database
D) Redirecting users to a fake website
β
Answer: A) Exploiting a serverβs ability to send unintended requests
π Explanation: SSRF tricks servers into accessing unauthorized internal resources.
16. What is the impact of OWASP Top 10 vulnerabilities on web applications?
A) Financial losses and data breaches
B) Faster web application performance
C) Improved network speeds
D) Reduced storage requirements
β
Answer: A) Financial losses and data breaches
π Explanation: Security flaws can lead to stolen data, financial fraud, and reputational damage.
17. What type of attack occurs when an attacker exploits a vulnerability in a websiteβs database query structure?
A) Command Injection
B) SQL Injection
C) Cross-Site Request Forgery (CSRF)
D) XML External Entities (XXE)
β
Answer: B) SQL Injection
π Explanation: SQL Injection occurs when attackers manipulate SQL queries by injecting malicious input.
18. What is a common impact of Broken Access Control?
A) Increased page load speed
B) Unauthorized access to sensitive data
C) Automatic password recovery
D) Secure API access
β
Answer: B) Unauthorized access to sensitive data
π Explanation: Broken Access Control allows attackers to view, modify, or delete sensitive information.
19. What security measure helps prevent Broken Authentication?
A) Using weak passwords
B) Implementing Multi-Factor Authentication (MFA)
C) Disabling encryption
D) Allowing unlimited login attempts
β
Answer: B) Implementing Multi-Factor Authentication (MFA)
π Explanation: MFA adds an extra layer of security by requiring additional authentication factors beyond a password.
20. How does improper logging and monitoring increase security risks?
A) It improves system performance
B) It prevents attackers from being detected
C) It helps users reset their passwords
D) It speeds up incident response
β
Answer: B) It prevents attackers from being detected
π Explanation: Lack of proper logging allows attackers to remain undetected for long periods, increasing the damage potential.
21. Which of the following is NOT a way to mitigate OWASP security risks?
A) Regular security audits
B) Using parameterized queries
C) Allowing users to input raw SQL commands
D) Enforcing least privilege access
β
Answer: C) Allowing users to input raw SQL commands
π Explanation: Allowing raw SQL inputs is a serious security risk and should be avoided.
22. Which security risk involves an attacker intercepting unencrypted sensitive information?
A) Insecure Deserialization
B) Sensitive Data Exposure
C) Broken Authentication
D) Cross-Site Scripting (XSS)
β
Answer: B) Sensitive Data Exposure
π Explanation: Sensitive Data Exposure occurs when confidential information is transmitted or stored in an unprotected manner.
23. What is an effective way to prevent Insecure Deserialization attacks?
A) Allowing user-generated serialized objects
B) Verifying and validating serialized data before processing
C) Storing serialized objects in plain text
D) Using the same encryption key for all objects
β
Answer: B) Verifying and validating serialized data before processing
π Explanation: Only allowing trusted serialized objects helps prevent deserialization attacks.
24. What is the primary goal of Security Misconfiguration prevention?
A) Ensuring website aesthetics
B) Preventing system instability
C) Closing unnecessary attack surfaces
D) Improving website speed
β
Answer: C) Closing unnecessary attack surfaces
π Explanation: Security Misconfiguration occurs when default credentials, excessive permissions, or outdated software create vulnerabilities.
25. What makes Server-Side Request Forgery (SSRF) a serious risk?
A) It allows attackers to manipulate HTTP requests and access internal resources
B) It improves website performance
C) It prevents unauthorized access
D) It reduces API security risks
β
Answer: A) It allows attackers to manipulate HTTP requests and access internal resources
π Explanation: SSRF exploits vulnerabilities in web applications that allow requests to be sent on behalf of the server.
26. Why is enforcing the Principle of Least Privilege (PoLP) important in preventing OWASP risks?
A) It grants users admin rights by default
B) It limits users to only the access they need
C) It allows attackers to exploit vulnerabilities easily
D) It makes all users equal in terms of access
β
Answer: B) It limits users to only the access they need
π Explanation: Restricting access to only necessary privileges reduces the risk of exploitation.
27. Which HTTP security header helps prevent XSS attacks?
A) X-Content-Type-Options
B) X-Frame-Options
C) Content Security Policy (CSP)
D) Referrer-Policy
β
Answer: C) Content Security Policy (CSP)
π Explanation: CSP prevents XSS by restricting the sources from which scripts can be executed.
28. What is a major difference between Reflected and Stored XSS?
A) Reflected XSS executes once, while Stored XSS remains persistent
B) Stored XSS affects users only once
C) Reflected XSS requires user authentication
D) Stored XSS is less dangerous than Reflected XSS
β
Answer: A) Reflected XSS executes once, while Stored XSS remains persistent
π Explanation: Reflected XSS occurs when an injected script is executed immediately, while Stored XSS persists in the database.
29. Which OWASP risk is associated with hardcoded API keys and credentials?
A) Insecure API Security
B) Sensitive Data Exposure
C) Insecure Deserialization
D) Cross-Site Request Forgery (CSRF)
β
Answer: B) Sensitive Data Exposure
π Explanation: Hardcoded credentials expose sensitive information and make applications vulnerable to attacks.
30. Which of the following best describes a supply chain attack?
A) An attack targeting third-party components or dependencies
B) An attack that manipulates search engine results
C) An attack that relies on phishing emails
D) An attack that targets Wi-Fi networks
β
Answer: A) An attack targeting third-party components or dependencies
π Explanation: Supply chain attacks occur when an attacker compromises third-party libraries, software updates, or hardware components to inject malicious code.
31. What is a common way to prevent Broken Access Control?
A) Implementing proper role-based access control (RBAC)
B) Allowing all users to access all resources
C) Storing access control lists in plaintext
D) Enabling guest user privileges for all users
β
Answer: A) Implementing proper role-based access control (RBAC)
π Explanation: RBAC restricts users’ access based on their roles, preventing unauthorized actions.
32. Which of the following is a real-world impact of Broken Authentication?
A) A user can log in without entering a password
B) Attackers can brute-force login credentials and gain access
C) All users are automatically logged out
D) An application runs faster
β
Answer: B) Attackers can brute-force login credentials and gain access
π Explanation: Weak authentication mechanisms allow attackers to exploit login systems and access accounts.
33. How does a Cross-Origin Resource Sharing (CORS) misconfiguration create security risks?
A) It allows unauthorized third-party domains to access sensitive data
B) It prevents API calls from executing
C) It blocks user access to the application
D) It encrypts all user traffic
β
Answer: A) It allows unauthorized third-party domains to access sensitive data
π Explanation: CORS misconfigurations may expose APIs and user data to malicious third-party websites.
34. What is the primary risk of allowing users to upload files without validation?
A) Slower website performance
B) File Upload Vulnerability leading to Remote Code Execution (RCE)
C) Increased bandwidth usage
D) More secure web applications
β
Answer: B) File Upload Vulnerability leading to Remote Code Execution (RCE)
π Explanation: Unvalidated file uploads allow attackers to upload malicious scripts and execute arbitrary code.
35. Which attack method can exploit improper session management?
A) Session Hijacking
B) SQL Injection
C) DNS Spoofing
D) IP Spoofing
β
Answer: A) Session Hijacking
π Explanation: Session Hijacking occurs when attackers steal a userβs session ID to impersonate them.
36. What type of vulnerabilities can arise from an insecure direct object reference (IDOR)?
A) Unauthorized access to data by modifying URL parameters
B) Increased website load time
C) Redirection to phishing websites
D) Faster authentication
β
Answer: A) Unauthorized access to data by modifying URL parameters
π Explanation: IDOR occurs when users can directly access unauthorized objects by changing request parameters.
37. What does the “S” in HTTPS stand for, and why is it important?
A) Secure, it encrypts data in transit
B) Speed, it makes websites load faster
C) Server, it improves backend operations
D) Storage, it saves cookies
β
Answer: A) Secure, it encrypts data in transit
π Explanation: HTTPS secures communication between users and servers using SSL/TLS encryption.
38. What is a major risk of not setting proper HTTP security headers?
A) Increased loading time
B) Vulnerability to Clickjacking, XSS, and data exposure
C) Reduced website traffic
D) Improved caching performance
β
Answer: B) Vulnerability to Clickjacking, XSS, and data exposure
π Explanation: HTTP security headers (like CSP, X-Frame-Options) help protect against multiple attack vectors.
39. What is the primary cause of Server-Side Request Forgery (SSRF)?
A) Allowing untrusted user input in server-side HTTP requests
B) Weak encryption algorithms
C) Enabling multi-factor authentication
D) Implementing CAPTCHA for authentication
β
Answer: A) Allowing untrusted user input in server-side HTTP requests
π Explanation: SSRF happens when an attacker tricks the server into making unintended requests.
40. How can an application protect itself from Cross-Site Scripting (XSS)?
A) Encoding output and sanitizing user input
B) Encrypting all stored files
C) Disabling JavaScript in browsers
D) Using multi-threading for API calls
β
Answer: A) Encoding output and sanitizing user input
π Explanation: Proper input validation and output encoding prevent XSS attacks.
41. What is a characteristic of an insecure API?
A) Exposes excessive data
B) Uses proper authentication
C) Implements rate limiting
D) Enforces strong encryption
β
Answer: A) Exposes excessive data
π Explanation: Insecure APIs may expose unnecessary or sensitive information, increasing security risks.
42. Which OWASP risk is associated with misconfigured cloud storage services?
A) Sensitive Data Exposure
B) SQL Injection
C) Cross-Site Scripting (XSS)
D) Insecure Deserialization
β
Answer: A) Sensitive Data Exposure
π Explanation: Cloud misconfigurations often lead to unprotected storage, exposing sensitive data.
43. Why is security logging important in applications?
A) It helps detect and respond to security incidents
B) It increases storage space
C) It improves website performance
D) It prevents broken authentication
β
Answer: A) It helps detect and respond to security incidents
π Explanation: Logging allows administrators to track security events and detect malicious activity.
44. What is the role of Web Application Firewalls (WAFs) in security?
A) Blocking malicious web traffic and preventing OWASP attacks
B) Storing user session data
C) Encrypting passwords
D) Improving website speed
β
Answer: A) Blocking malicious web traffic and preventing OWASP attacks
π Explanation: WAFs help mitigate threats such as XSS, SQL Injection, and CSRF.
45. What is an effective way to prevent account takeover attacks?
A) Implementing Multi-Factor Authentication (MFA)
B) Disabling security updates
C) Allowing password reuse
D) Using public Wi-Fi for authentication
β
Answer: A) Implementing Multi-Factor Authentication (MFA)
π Explanation: MFA requires multiple verification factors, reducing the risk of unauthorized access.
46. Why should developers avoid storing plaintext passwords?
A) They can be easily stolen in data breaches
B) It improves performance
C) It allows users to remember their passwords easily
D) It prevents XSS attacks
β
Answer: A) They can be easily stolen in data breaches
π Explanation: Passwords should be securely hashed and salted to prevent unauthorized access.
47. What is a common symptom of an insecure deserialization attack?
A) Arbitrary code execution
B) Faster API responses
C) Increased storage usage
D) More efficient data retrieval
β
Answer: A) Arbitrary code execution
π Explanation: Insecure deserialization allows attackers to manipulate serialized objects and execute malicious code.
48. What is the impact of a successful CSRF attack?
A) Users unknowingly perform unwanted actions
B) Website traffic increases
C) Session cookies become encrypted
D) The website loads faster
β
Answer: A) Users unknowingly perform unwanted actions
π Explanation: CSRF tricks users into performing unauthorized actions, often leading to account compromises.
49. Why should unused features and services be disabled on a web server?
A) To reduce attack surface and prevent security misconfigurations
B) To increase system performance
C) To allow unlimited file uploads
D) To enable guest users to log in
β
Answer: A) To reduce attack surface and prevent security misconfigurations
π Explanation: Disabling unnecessary services minimizes security risks and attack vectors.
50. What is a common attack method against JWT (JSON Web Token)?
A) Token theft and reuse
B) Brute-force attacks
C) Clickjacking
D) HTTP Smuggling
β
Answer: A) Token theft and reuse
π Explanation: Attackers can steal JWT tokens and reuse them if they are not properly secured or expired.
51. What is a primary cause of Broken Authentication?
A) Weak password policies and session management issues
B) Using MFA for authentication
C) Disabling cookies
D) Implementing biometric authentication
β
Answer: A) Weak password policies and session management issues
π Explanation: Weak passwords, lack of multi-factor authentication (MFA), and improper session management lead to Broken Authentication.
52. Which of the following techniques can mitigate SQL Injection attacks?
A) Using parameterized queries
B) Allowing user-generated SQL queries
C) Storing passwords in plaintext
D) Disabling database logging
β
Answer: A) Using parameterized queries
π Explanation: Parameterized queries ensure that user input is handled safely, preventing SQL Injection attacks.
53. Which OWASP Top 10 vulnerability can be exploited using a web proxy tool like Burp Suite?
A) Broken Access Control
B) Security Misconfiguration
C) Insecure Deserialization
D) All of the above
β
Answer: D) All of the above
π Explanation: A web proxy tool allows attackers to intercept and manipulate requests, making it useful for exploiting multiple OWASP risks.
54. What type of attack exploits a lack of input validation in file uploads?
A) Remote Code Execution (RCE)
B) Clickjacking
C) Brute force attack
D) DNS Spoofing
β
Answer: A) Remote Code Execution (RCE)
π Explanation: Unvalidated file uploads allow attackers to upload and execute malicious scripts on the server.
55. How does a Clickjacking attack work?
A) By tricking users into clicking on invisible elements
B) By injecting malicious JavaScript
C) By modifying API requests
D) By brute-forcing login credentials
β
Answer: A) By tricking users into clicking on invisible elements
π Explanation: Clickjacking overlays a transparent layer over a legitimate button, deceiving users into performing unintended actions.
56. Which of the following is a common example of a Security Misconfiguration?
A) Keeping default credentials for an admin panel
B) Implementing access control properly
C) Using HTTPS for secure connections
D) Enforcing strict Content Security Policy (CSP)
β
Answer: A) Keeping default credentials for an admin panel
π Explanation: Default credentials allow attackers easy access to administrative interfaces.
57. What is the primary goal of implementing a Content Security Policy (CSP)?
A) To prevent Cross-Site Scripting (XSS) attacks
B) To block SQL Injection
C) To speed up website performance
D) To disable encryption
β
Answer: A) To prevent Cross-Site Scripting (XSS) attacks
π Explanation: CSP restricts the sources from which scripts can be loaded, mitigating XSS risks.
58. What is the primary risk of using hardcoded credentials in source code?
A) Performance degradation
B) Exposure of credentials in public repositories
C) Increased encryption strength
D) Improved debugging capabilities
β
Answer: B) Exposure of credentials in public repositories
π Explanation: Hardcoded credentials in repositories can be accessed by attackers, leading to data breaches.
59. Which method helps prevent credential stuffing attacks?
A) Rate limiting and account lockout mechanisms
B) Allowing unlimited login attempts
C) Storing passwords in plaintext
D) Using weak hashing algorithms
β
Answer: A) Rate limiting and account lockout mechanisms
π Explanation: Rate limiting prevents automated login attempts, reducing the effectiveness of credential stuffing.
60. How does an attacker exploit a DOM-based XSS vulnerability?
A) By modifying the Document Object Model (DOM) in the victimβs browser
B) By injecting SQL queries into the database
C) By modifying HTTP response headers
D) By redirecting users to a phishing site
β
Answer: A) By modifying the Document Object Model (DOM) in the victimβs browser
π Explanation: DOM-based XSS manipulates the webpage dynamically, executing malicious scripts in the userβs browser.
61. What is the impact of an improperly implemented CORS policy?
A) Unauthorized API access from malicious third-party sites
B) Increased application speed
C) Improved user authentication
D) Faster database queries
β
Answer: A) Unauthorized API access from malicious third-party sites
π Explanation: Misconfigured CORS can allow unauthorized web pages to interact with sensitive APIs.
62. What is a key characteristic of Server-Side Request Forgery (SSRF)?
A) The server is tricked into making unauthorized requests
B) Attackers modify database records
C) Users gain admin privileges
D) Passwords are decrypted
β
Answer: A) The server is tricked into making unauthorized requests
π Explanation: SSRF occurs when a server processes external requests on behalf of an attacker.
63. How does implementing the “SameSite” attribute in cookies enhance security?
A) It helps mitigate Cross-Site Request Forgery (CSRF) attacks
B) It speeds up website loading times
C) It encrypts cookies
D) It improves database performance
β
Answer: A) It helps mitigate Cross-Site Request Forgery (CSRF) attacks
π Explanation: The SameSite attribute restricts cookies from being sent with cross-site requests, reducing CSRF risks.
64. What is a common symptom of an insecure deserialization attack?
A) Execution of arbitrary code on the server
B) Faster API responses
C) Increased network speed
D) More efficient logging
β
Answer: A) Execution of arbitrary code on the server
π Explanation: Insecure deserialization allows attackers to manipulate serialized objects and execute malicious operations.
65. What is the most effective way to mitigate Broken Access Control?
A) Enforcing least privilege and implementing strong authorization controls
B) Allowing guest users full access
C) Using weak encryption
D) Hiding URLs from users
β
Answer: A) Enforcing least privilege and implementing strong authorization controls
π Explanation: Restricting access and properly enforcing authorization rules help prevent unauthorized access.
66. Why is it dangerous to use outdated software and libraries?
A) They contain known vulnerabilities that can be exploited
B) They improve performance
C) They make debugging easier
D) They prevent XSS attacks
β
Answer: A) They contain known vulnerabilities that can be exploited
π Explanation: Attackers often target outdated software that lacks security patches.
67. What is a common example of Sensitive Data Exposure?
A) Storing passwords in plaintext
B) Using TLS for encryption
C) Implementing proper access controls
D) Using a strong password policy
β
Answer: A) Storing passwords in plaintext
π Explanation: Storing credentials in plaintext makes them accessible to attackers if the database is compromised.
68. Why should error messages be handled carefully in web applications?
A) To prevent information disclosure to attackers
B) To increase application speed
C) To make debugging easier
D) To improve SEO ranking
β
Answer: A) To prevent information disclosure to attackers
π Explanation: Verbose error messages can reveal sensitive system details that attackers can exploit.
69. What is a common way to prevent XML External Entity (XXE) attacks?
A) Disabling XML external entity processing
B) Allowing all user-generated XML data
C) Encrypting XML files
D) Using weak API authentication
β
Answer: A) Disabling XML external entity processing
π Explanation: Disabling the use of external entities in XML parsing prevents XXE exploits.
70. What is the role of a Web Application Firewall (WAF) in preventing OWASP risks?
A) Detecting and blocking malicious web traffic
B) Encrypting all web traffic
C) Managing user authentication
D) Improving database performance
β
Answer: A) Detecting and blocking malicious web traffic
π Explanation: A WAF inspects HTTP requests and blocks threats like SQL Injection and XSS.
71. Why is it important to use HTTPS instead of HTTP?
A) It encrypts data in transit, preventing Man-in-the-Middle (MITM) attacks
B) It speeds up website performance
C) It reduces the need for authentication
D) It allows browsers to load pages faster
β
Answer: A) It encrypts data in transit, preventing Man-in-the-Middle (MITM) attacks
π Explanation: HTTPS secures communication between clients and servers using SSL/TLS encryption.
72. What is a key risk of an improperly configured security header policy?
A) It allows attackers to exploit vulnerabilities such as Clickjacking and XSS
B) It improves page loading speed
C) It prevents security audits
D) It increases database efficiency
β
Answer: A) It allows attackers to exploit vulnerabilities such as Clickjacking and XSS
π Explanation: Security headers like CSP, X-Frame-Options, and X-XSS-Protection mitigate common web vulnerabilities.
73. What is an effective way to prevent Brute Force Attacks on login pages?
A) Implementing account lockout after multiple failed attempts
B) Allowing unlimited login attempts
C) Storing passwords in plaintext
D) Disabling password requirements
β
Answer: A) Implementing account lockout after multiple failed attempts
π Explanation: Locking accounts after multiple incorrect login attempts prevents attackers from guessing passwords.
74. What is the primary concern with using outdated third-party libraries in applications?
A) They may contain known vulnerabilities that attackers can exploit
B) They improve website performance
C) They make debugging easier
D) They reduce security risks
β
Answer: A) They may contain known vulnerabilities that attackers can exploit
π Explanation: Old libraries may have security flaws that attackers can exploit if updates are not applied.
75. How can attackers exploit a vulnerable session management system?
A) By hijacking session tokens to gain unauthorized access
B) By encrypting session cookies
C) By using HTTPS
D) By blocking XSS attacks
β
Answer: A) By hijacking session tokens to gain unauthorized access
π Explanation: Weak session management can allow attackers to steal or predict session tokens.
76. What is a common attack method against insecure API endpoints?
A) Broken Object-Level Authorization (BOLA)
B) Cross-Site Request Forgery (CSRF)
C) Command Injection
D) DNS Spoofing
β
Answer: A) Broken Object-Level Authorization (BOLA)
π Explanation: BOLA allows unauthorized users to access or manipulate data due to weak API security controls.
77. What type of attack exploits the lack of proper authorization controls?
A) Broken Access Control
B) SQL Injection
C) Cross-Site Scripting (XSS)
D) Buffer Overflow
β
Answer: A) Broken Access Control
π Explanation: Broken Access Control allows unauthorized users to perform actions they should not have permission for.
78. Which type of vulnerability is primarily exploited when an attacker manipulates serialized objects?
A) Insecure Deserialization
B) Clickjacking
C) XSS
D) Credential Stuffing
β
Answer: A) Insecure Deserialization
π Explanation: Insecure Deserialization allows attackers to modify serialized objects, potentially leading to remote code execution.
79. How does an attacker typically exploit an IDOR (Insecure Direct Object Reference) vulnerability?
A) By modifying request parameters to access unauthorized data
B) By injecting malicious SQL queries
C) By manipulating JavaScript in the browser
D) By performing DDoS attacks
β
Answer: A) By modifying request parameters to access unauthorized data
π Explanation: IDOR vulnerabilities occur when an application exposes sensitive data by allowing direct access through request modifications.
80. Why is enforcing the Same-Origin Policy (SOP) important for web security?
A) It prevents malicious websites from making unauthorized requests to different origins
B) It speeds up website performance
C) It encrypts all HTTP requests
D) It blocks phishing emails
β
Answer: A) It prevents malicious websites from making unauthorized requests to different origins
π Explanation: SOP restricts scripts from interacting with resources from a different domain unless explicitly allowed.
81. What is a key weakness of relying only on client-side validation for security?
A) Attackers can bypass validation by modifying requests
B) It increases security by preventing SQL Injection
C) It ensures that data is always validated correctly
D) It speeds up application performance
β
Answer: A) Attackers can bypass validation by modifying requests
π Explanation: Client-side validation can be easily bypassed, so it must be reinforced with server-side validation.
82. Which OWASP vulnerability does an attacker exploit when they manipulate JWT (JSON Web Token)?
A) Broken Authentication
B) SQL Injection
C) Insecure Direct Object Reference
D) Buffer Overflow
β
Answer: A) Broken Authentication
π Explanation: Weak JWT implementation can lead to token theft, token forgery, or replay attacks.
83. What is a secure way to store passwords in a database?
A) Hashing with bcrypt, Argon2, or PBKDF2
B) Storing passwords in plaintext
C) Encrypting passwords using symmetric encryption
D) Using base64 encoding
β
Answer: A) Hashing with bcrypt, Argon2, or PBKDF2
π Explanation: Secure password hashing functions make it computationally expensive for attackers to brute-force stolen hashes.
84. What is a major risk of allowing unrestricted file uploads?
A) Attackers can upload malicious scripts for Remote Code Execution
B) It slows down website loading times
C) It improves the user experience
D) It prevents XSS attacks
β
Answer: A) Attackers can upload malicious scripts for Remote Code Execution
π Explanation: Improper file validation may allow attackers to upload and execute malicious files.
85. How does rate limiting help prevent security threats?
A) It restricts the number of requests from a user, preventing brute force and DoS attacks
B) It speeds up API responses
C) It improves encryption strength
D) It allows all users to bypass authentication
β
Answer: A) It restricts the number of requests from a user, preventing brute force and DoS attacks
π Explanation: Rate limiting helps protect against brute force login attempts and denial-of-service attacks.
86. What is a key security concern with public API keys?
A) They can be abused by attackers to access API services without authorization
B) They improve API performance
C) They prevent SQL Injection attacks
D) They increase authentication strength
β
Answer: A) They can be abused by attackers to access API services without authorization
π Explanation: API keys exposed in public repositories or web pages can be used by attackers to access services fraudulently.
87. Which of the following is an effective way to prevent Cross-Site Request Forgery (CSRF) attacks?
A) Using CSRF tokens and the SameSite cookie attribute
B) Allowing CORS for all domains
C) Encrypting URLs
D) Disabling user authentication
β
Answer: A) Using CSRF tokens and the SameSite cookie attribute
π Explanation: CSRF tokens and SameSite attributes ensure that only legitimate requests are processed.
88. How can an attacker exploit an open redirect vulnerability?
A) By redirecting users to malicious websites for phishing attacks
B) By injecting SQL queries
C) By modifying the HTML structure of the page
D) By tampering with user authentication tokens
β
Answer: A) By redirecting users to malicious websites for phishing attacks
π Explanation: Open redirects allow attackers to manipulate URLs and send users to malicious sites.
89. Which method helps protect against Clickjacking attacks?
A) Using the X-Frame-Options HTTP header
B) Implementing weak authentication mechanisms
C) Allowing all JavaScript execution
D) Using symmetric encryption
β
Answer: A) Using the X-Frame-Options HTTP header
π Explanation: The X-Frame-Options header prevents a website from being embedded in an iframe, mitigating Clickjacking risks.
90. What is an example of a business logic vulnerability?
A) Users exploiting the checkout process to get products for free
B) SQL Injection attacks
C) Encrypting sensitive data
D) Implementing strong password policies
β
Answer: A) Users exploiting the checkout process to get products for free
π Explanation: Business logic vulnerabilities allow users to bypass intended application functionality.
91. What is the primary goal of security logging and monitoring?
A) Detect and respond to security incidents in real-time
B) Improve website performance
C) Store user session data
D) Reduce database size
β
Answer: A) Detect and respond to security incidents in real-time
π Explanation: Security logging and monitoring allow organizations to detect and respond to threats quickly.
92. How can attackers exploit weak password policies?
A) By performing brute force and credential stuffing attacks
B) By injecting malicious scripts
C) By tampering with security headers
D) By modifying API responses
β
Answer: A) By performing brute force and credential stuffing attacks
π Explanation: Weak passwords make it easier for attackers to guess or reuse credentials.
93. What is the risk of improper session expiration?
A) Users remain authenticated indefinitely, increasing hijacking risks
B) Increased website performance
C) Improved data encryption
D) Prevents attackers from stealing sessions
β
Answer: A) Users remain authenticated indefinitely, increasing hijacking risks
π Explanation: If sessions do not expire, attackers can reuse old session tokens to gain unauthorized access.
94. Which of the following is NOT an OWASP Top 10 vulnerability?
A) SQL Injection
B) Cross-Site Scripting (XSS)
C) Insecure File Permissions
D) Broken Access Control
β
Answer: C) Insecure File Permissions
π Explanation: While insecure file permissions are a security concern, they are not specifically listed in the OWASP Top 10.
95. What is a major security risk of using HTTP instead of HTTPS?
A) Data transmitted between client and server can be intercepted
B) The website loads faster
C) The website is protected from all attacks
D) Users can bypass login authentication
β
Answer: A) Data transmitted between client and server can be intercepted
π Explanation: HTTPS encrypts data in transit, preventing attackers from capturing sensitive information.
96. What is an effective way to prevent IDOR (Insecure Direct Object Reference) vulnerabilities?
A) Implement proper access controls and validate user permissions
B) Encrypt all database queries
C) Store objects in plaintext
D) Use HTTP instead of HTTPS
β
Answer: A) Implement proper access controls and validate user permissions
π Explanation: IDOR vulnerabilities arise when access controls are weak, allowing unauthorized users to access or modify resources.
97. Why is it dangerous to expose database error messages to users?
A) They can reveal sensitive system information to attackers
B) They improve system performance
C) They prevent SQL Injection attacks
D) They encrypt sensitive data
β
Answer: A) They can reveal sensitive system information to attackers
π Explanation: Detailed error messages can disclose database structures, helping attackers craft more effective attacks.
98. How can attackers exploit Cross-Origin Resource Sharing (CORS) misconfigurations?
A) By accessing sensitive data from different origins without authorization
B) By injecting SQL queries
C) By modifying browser cookies
D) By encrypting API responses
β
Answer: A) By accessing sensitive data from different origins without authorization
π Explanation: Poorly configured CORS settings may allow unauthorized domains to access restricted data.
99. What type of attack involves inserting malicious JSON objects into an API request?
A) Insecure Deserialization
B) Cross-Site Request Forgery (CSRF)
C) Server-Side Request Forgery (SSRF)
D) SQL Injection
β
Answer: A) Insecure Deserialization
π Explanation: Insecure Deserialization allows attackers to send modified serialized objects that can be executed on the server.
100. What is an example of a race condition vulnerability?
A) Two users modifying the same resource simultaneously, causing unexpected behavior
B) An attacker injecting SQL queries into a database
C) A phishing attack targeting employees
D) An API that does not require authentication
β
Answer: A) Two users modifying the same resource simultaneously, causing unexpected behavior
π Explanation: Race conditions occur when multiple processes attempt to modify the same resource simultaneously.
101. Why should developers avoid using default credentials in applications?
A) They are easy for attackers to guess and exploit
B) They improve system performance
C) They prevent brute force attacks
D) They encrypt passwords automatically
β
Answer: A) They are easy for attackers to guess and exploit
π Explanation: Attackers frequently attempt to log in using default credentials, making it a significant security risk.
102. How does HTTP response splitting impact web security?
A) It allows attackers to inject malicious headers into responses
B) It prevents SQL Injection attacks
C) It speeds up website performance
D) It secures API endpoints
β
Answer: A) It allows attackers to inject malicious headers into responses
π Explanation: HTTP response splitting enables header injection, potentially leading to security vulnerabilities.
103. What is an effective way to mitigate security risks from third-party components?
A) Regularly updating dependencies and removing outdated libraries
B) Allowing all third-party code without verification
C) Disabling authentication for external services
D) Storing API keys in plaintext
β
Answer: A) Regularly updating dependencies and removing outdated libraries
π Explanation: Keeping third-party components up to date helps protect against known vulnerabilities.
104. What security measure helps protect against an attacker stealing JWT tokens?
A) Using short token expiration times and secure storage
B) Storing tokens in local storage without encryption
C) Disabling authentication checks
D) Allowing all tokens to remain valid indefinitely
β
Answer: A) Using short token expiration times and secure storage
π Explanation: Expiring tokens quickly and securely storing them reduces the risk of token theft.
105. How can attackers exploit Open Redirect vulnerabilities?
A) By redirecting users to malicious phishing websites
B) By injecting SQL queries
C) By modifying API headers
D) By blocking security logs
β
Answer: A) By redirecting users to malicious phishing websites
π Explanation: Open Redirect vulnerabilities allow attackers to trick users into visiting fake or malicious websites.
106. Which of the following is a strong defense against XSS attacks?
A) Encoding user input and implementing Content Security Policy (CSP)
B) Storing credentials in plaintext
C) Using weak password policies
D) Allowing unrestricted JavaScript execution
β
Answer: A) Encoding user input and implementing Content Security Policy (CSP)
π Explanation: Proper encoding and CSP mitigate XSS risks by restricting script execution.
107. What is an example of business logic abuse?
A) Exploiting coupon codes to get free products repeatedly
B) Using SQL Injection to access user data
C) Redirecting users to phishing websites
D) Injecting malicious JSON into API requests
β
Answer: A) Exploiting coupon codes to get free products repeatedly
π Explanation: Business logic vulnerabilities occur when attackers manipulate application logic to gain unauthorized benefits.
108. What does a Web Application Firewall (WAF) primarily protect against?
A) Web-based attacks like SQL Injection and XSS
B) Physical network intrusions
C) Phishing emails
D) Disk encryption failures
β
Answer: A) Web-based attacks like SQL Injection and XSS
π Explanation: A WAF filters and blocks malicious HTTP traffic targeting web applications.
109. What is a primary risk of unrestricted API access?
A) Unauthorized users can manipulate data and perform privileged actions
B) Improved website performance
C) Faster query execution
D) Secure storage of API keys
β
Answer: A) Unauthorized users can manipulate data and perform privileged actions
π Explanation: Unrestricted API access increases the risk of data leaks and unauthorized modifications.
110. Why is input validation important in web applications?
A) It prevents malicious data from being processed and executed
B) It speeds up website loading times
C) It improves server response rates
D) It allows unrestricted file uploads
β
Answer: A) It prevents malicious data from being processed and executed
π Explanation: Input validation helps prevent various injection attacks by ensuring data integrity.
111. What is the main risk of exposing debug mode in production applications?
A) It may reveal sensitive application details and configurations to attackers
B) It increases application performance
C) It prevents SQL Injection attacks
D) It improves authentication security
β
Answer: A) It may reveal sensitive application details and configurations to attackers
π Explanation: Debug mode can expose stack traces, database queries, and system information that can aid attackers.
112. How can attackers exploit an application that lacks rate limiting?
A) By performing brute force or automated attacks against authentication endpoints
B) By executing encrypted SQL queries
C) By accessing API logs directly
D) By increasing database performance
β
Answer: A) By performing brute force or automated attacks against authentication endpoints
π Explanation: Rate limiting prevents attackers from making excessive requests, reducing brute force and DoS attack risks.
113. What is a key risk of allowing users to upload unvalidated files?
A) Attackers can upload malicious files that execute code on the server
B) It speeds up website loading times
C) It prevents SQL Injection attacks
D) It increases encryption security
β
Answer: A) Attackers can upload malicious files that execute code on the server
π Explanation: Unvalidated file uploads can lead to Remote Code Execution (RCE) and malware infections.
114. What security risk arises when developers fail to rotate encryption keys?
A) Older compromised keys can still decrypt sensitive data
B) It improves encryption strength
C) It speeds up database queries
D) It increases user authentication security
β
Answer: A) Older compromised keys can still decrypt sensitive data
π Explanation: Regularly rotating encryption keys reduces the impact of a compromised key.
115. Why should applications implement session timeouts?
A) To prevent unauthorized access in case a user forgets to log out
B) To make sessions last indefinitely
C) To allow unlimited access to authenticated users
D) To reduce web traffic
β
Answer: A) To prevent unauthorized access in case a user forgets to log out
π Explanation: Expiring inactive sessions helps prevent unauthorized access if an attacker hijacks a session.
116. What is an example of a user enumeration vulnerability?
A) Displaying different error messages for valid and invalid usernames during login
B) Encrypting all user data
C) Using TLS to secure authentication
D) Storing passwords with bcrypt
β
Answer: A) Displaying different error messages for valid and invalid usernames during login
π Explanation: Attackers can determine if an account exists based on different login error messages.
117. What is a common method for preventing API key leaks in public repositories?
A) Storing API keys in environment variables instead of source code
B) Hardcoding API keys in JavaScript files
C) Disabling encryption on API requests
D) Allowing unrestricted API access
β
Answer: A) Storing API keys in environment variables instead of source code
π Explanation: API keys should never be stored in source code; environment variables provide a more secure alternative.
118. How can developers prevent SSRF (Server-Side Request Forgery) attacks?
A) Restricting outgoing requests to trusted domains and validating input
B) Allowing all HTTP methods
C) Using base64 encoding for requests
D) Disabling SSL/TLS
β
Answer: A) Restricting outgoing requests to trusted domains and validating input
π Explanation: SSRF attacks exploit server-side request handling; limiting outgoing requests reduces the risk.
119. What is a major risk of using weak hashing algorithms like MD5 and SHA-1 for password storage?
A) They can be cracked using modern computing power
B) They increase password security
C) They improve website speed
D) They enhance encryption strength
β
Answer: A) They can be cracked using modern computing power
π Explanation: MD5 and SHA-1 are outdated hashing algorithms that can be easily brute-forced.
120. How does an attacker typically exploit an Open Redirect vulnerability?
A) By redirecting users to phishing sites via manipulated URLs
B) By injecting SQL commands into login fields
C) By modifying authentication tokens
D) By encrypting URL parameters
β
Answer: A) By redirecting users to phishing sites via manipulated URLs
π Explanation: Open Redirect vulnerabilities allow attackers to trick users into visiting malicious websites.
121. Why is it important to set the Secure attribute on cookies?
A) It ensures cookies are only transmitted over HTTPS, preventing theft in plaintext HTTP requests
B) It prevents all authentication attacks
C) It speeds up login times
D) It disables cookies in browsers
β
Answer: A) It ensures cookies are only transmitted over HTTPS, preventing theft in plaintext HTTP requests
π Explanation: The Secure attribute ensures cookies are not sent over unencrypted connections.
122. What is the best way to prevent Clickjacking attacks?
A) Implementing the X-Frame-Options header
B) Allowing iframes from all origins
C) Disabling JavaScript
D) Using weak encryption
β
Answer: A) Implementing the X-Frame-Options header
π Explanation: The X-Frame-Options header prevents embedding of a website in an iframe, reducing Clickjacking risks.
123. What is a risk of failing to properly validate JWT tokens?
A) Attackers can forge tokens and gain unauthorized access
B) JWT authentication becomes stronger
C) The application prevents CSRF attacks
D) The user experience is improved
β
Answer: A) Attackers can forge tokens and gain unauthorized access
π Explanation: Weak JWT validation allows attackers to manipulate authentication tokens.
124. Why is it important to implement a strong Content Security Policy (CSP)?
A) It helps prevent Cross-Site Scripting (XSS) by restricting allowed sources of scripts
B) It speeds up website rendering
C) It prevents SQL Injection
D) It improves cookie security
β
Answer: A) It helps prevent Cross-Site Scripting (XSS) by restricting allowed sources of scripts
π Explanation: CSP restricts script execution, reducing the risk of XSS attacks.
125. What is the impact of failing to implement proper error handling?
A) Detailed error messages may reveal sensitive information to attackers
B) Improved application performance
C) Reduced attack surface
D) Enhanced security logs
β
Answer: A) Detailed error messages may reveal sensitive information to attackers
π Explanation: Exposing detailed error messages helps attackers gather intelligence about system configurations.
126. How can security misconfigurations be mitigated?
A) Regularly updating and reviewing security settings
B) Using default passwords
C) Allowing all HTTP methods
D) Keeping debug mode enabled in production
β
Answer: A) Regularly updating and reviewing security settings
π Explanation: Regular audits and security reviews help prevent security misconfigurations.
127. Why is it important to implement principle of least privilege (PoLP)?
A) It reduces the risk of unauthorized access and privilege escalation
B) It improves website loading times
C) It increases API request speeds
D) It allows users to bypass authentication
β
Answer: A) It reduces the risk of unauthorized access and privilege escalation
π Explanation: PoLP limits users to only the permissions they need, reducing the impact of breaches.
128. What is an effective way to secure sensitive API endpoints?
A) Implementing authentication, authorization, and input validation
B) Allowing unrestricted access
C) Hardcoding API keys in JavaScript files
D) Using weak encryption
β
Answer: A) Implementing authentication, authorization, and input validation
π Explanation: Securing APIs requires robust authentication and access control mechanisms.
129. What risk does Cross-Site Scripting (XSS) pose to users?
A) Attackers can execute malicious scripts in a userβs browser
B) Increased website speed
C) Automatic database updates
D) Secure password storage
β
Answer: A) Attackers can execute malicious scripts in a userβs browser
π Explanation: XSS allows attackers to steal data, impersonate users, or manipulate web pages.
130. What is the role of security headers in web applications?
A) They enforce security policies that help prevent attacks like XSS and Clickjacking
B) They speed up database queries
C) They encrypt all user data
D) They improve SEO rankings
β
Answer: A) They enforce security policies that help prevent attacks like XSS and Clickjacking
π Explanation: Security headers protect against various web vulnerabilities by enforcing security measures.
131. What is the primary reason for using parameterized queries in databases?
A) To prevent SQL Injection attacks
B) To speed up query execution
C) To allow users to input raw SQL
D) To store passwords in plaintext
β
Answer: A) To prevent SQL Injection attacks
π Explanation: Parameterized queries prevent SQL Injection by treating user inputs as data rather than executable SQL commands.
132. What is the impact of a successful Server-Side Request Forgery (SSRF) attack?
A) An attacker can force the server to make unauthorized requests
B) The website loads faster
C) The API becomes more efficient
D) All session cookies expire immediately
β
Answer: A) An attacker can force the server to make unauthorized requests
π Explanation: SSRF attacks trick the server into sending requests to internal or external services, potentially exposing sensitive data.
133. How does implementing a WAF (Web Application Firewall) improve security?
A) It filters and blocks malicious web traffic, preventing attacks like SQL Injection and XSS
B) It speeds up website loading times
C) It replaces the need for authentication
D) It automatically encrypts all passwords
β
Answer: A) It filters and blocks malicious web traffic, preventing attacks like SQL Injection and XSS
π Explanation: A WAF inspects HTTP requests and blocks malicious activities targeting web applications.
134. What is the best practice for handling password resets securely?
A) Sending a one-time link to the registered email for resetting passwords
B) Storing previous passwords for easy recovery
C) Allowing users to reset passwords without verification
D) Using the same reset token for all users
β
Answer: A) Sending a one-time link to the registered email for resetting passwords
π Explanation: Secure password reset processes should use temporary, one-time-use tokens sent to verified users.
135. Why is it important to implement logging and monitoring in web applications?
A) To detect and respond to security incidents in real-time
B) To increase website speed
C) To store user preferences
D) To encrypt all API keys
β
Answer: A) To detect and respond to security incidents in real-time
π Explanation: Logging and monitoring allow security teams to identify and mitigate threats as they occur.
136. What does the ‘Secure’ attribute in cookies do?
A) Ensures that cookies are transmitted only over HTTPS
B) Encrypts all cookie data
C) Prevents CSRF attacks
D) Increases website performance
β
Answer: A) Ensures that cookies are transmitted only over HTTPS
π Explanation: The Secure attribute prevents cookies from being sent over unencrypted HTTP connections.
137. How does an attacker exploit a Business Logic Vulnerability?
A) By abusing application workflows to bypass restrictions or gain benefits
B) By modifying HTTP headers
C) By injecting JavaScript into an input field
D) By redirecting users to phishing websites
β
Answer: A) By abusing application workflows to bypass restrictions or gain benefits
π Explanation: Business Logic Vulnerabilities occur when attackers manipulate application processes for unintended outcomes.
138. What is a major risk of exposing API endpoints without authentication?
A) Unauthorized users can access or manipulate sensitive data
B) API response times increase
C) Authentication logs become unreadable
D) The application becomes immune to SQL Injection
β
Answer: A) Unauthorized users can access or manipulate sensitive data
π Explanation: Exposing APIs without authentication allows unauthorized access, leading to data breaches and manipulation.
139. What is a common cause of XML External Entity (XXE) vulnerabilities?
A) Improperly configured XML parsers allowing external entity processing
B) Using JSON instead of XML
C) Encrypting all XML files
D) Disabling all logging
β
Answer: A) Improperly configured XML parsers allowing external entity processing
π Explanation: XXE occurs when an XML parser processes external entities, allowing attackers to read files or perform DoS attacks.
140. How can developers mitigate the risk of CSRF (Cross-Site Request Forgery) attacks?
A) Implementing CSRF tokens and SameSite cookie attributes
B) Encrypting URL parameters
C) Allowing all CORS requests
D) Using JavaScript validation only
β
Answer: A) Implementing CSRF tokens and SameSite cookie attributes
π Explanation: CSRF tokens ensure that only legitimate user requests are processed, preventing unauthorized actions.
141. What is a common impact of an insecure API design?
A) Data exposure and unauthorized API access
B) Increased website speed
C) Enhanced user authentication
D) Faster database queries
β
Answer: A) Data exposure and unauthorized API access
π Explanation: Poorly secured APIs can expose sensitive data and allow unauthorized actions.
142. What does the HTTP header X-XSS-Protection do?
A) Prevents reflected Cross-Site Scripting (XSS) attacks
B) Encrypts all JavaScript on a page
C) Prevents all SQL Injection attacks
D) Increases application performance
β
Answer: A) Prevents reflected Cross-Site Scripting (XSS) attacks
π Explanation: The X-XSS-Protection header blocks XSS attacks by preventing script execution in certain browsers.
143. Why should applications implement strong password policies?
A) To reduce the risk of brute-force and credential stuffing attacks
B) To slow down website performance
C) To increase API response time
D) To prevent SQL Injection
β
Answer: A) To reduce the risk of brute-force and credential stuffing attacks
π Explanation: Strong password policies help protect accounts from unauthorized access.
144. How can developers protect against privilege escalation attacks?
A) Implementing strict access controls and least privilege principles
B) Allowing all users to access administrative features
C) Using weak password policies
D) Disabling logging
β
Answer: A) Implementing strict access controls and least privilege principles
π Explanation: Privilege escalation occurs when users gain higher access than intended; enforcing strict controls prevents this.
145. What is the risk of failing to validate JWT expiration?
A) Attackers can reuse expired tokens to gain access
B) The API response times increase
C) The application prevents SQL Injection
D) The authentication process speeds up
β
Answer: A) Attackers can reuse expired tokens to gain access
π Explanation: JWT expiration validation prevents unauthorized users from reusing old tokens.
146. What security risk arises from using predictable session IDs?
A) Attackers can hijack active sessions by guessing session tokens
B) Users can log in faster
C) API requests are encrypted
D) Authentication logs become unreadable
β
Answer: A) Attackers can hijack active sessions by guessing session tokens
π Explanation: Predictable session IDs make it easier for attackers to perform session hijacking.
147. What is a key benefit of enabling HTTP Strict Transport Security (HSTS)?
A) It enforces HTTPS connections and prevents downgrade attacks
B) It encrypts database queries
C) It speeds up JavaScript execution
D) It prevents SQL Injection
β
Answer: A) It enforces HTTPS connections and prevents downgrade attacks
π Explanation: HSTS ensures that users always connect securely via HTTPS.
148. What does an attacker accomplish by exploiting an insecure deserialization vulnerability?
A) Arbitrary code execution on the server
B) Increased authentication speed
C) Faster database queries
D) Secure cookie storage
β
Answer: A) Arbitrary code execution on the server
π Explanation: Insecure deserialization allows attackers to manipulate serialized objects and execute malicious code.
149. Why is it important to keep software and dependencies updated?
A) To patch known vulnerabilities and security flaws
B) To slow down website performance
C) To allow attackers to find more exploits
D) To prevent debugging
β
Answer: A) To patch known vulnerabilities and security flaws
π Explanation: Regular updates help close security gaps that attackers might exploit.
150. How does enforcing Multi-Factor Authentication (MFA) improve security?
A) It adds an extra layer of protection beyond just passwords
B) It speeds up the login process
C) It prevents SQL Injection
D) It increases session expiration time
β
Answer: A) It adds an extra layer of protection beyond just passwords
π Explanation: MFA makes it harder for attackers to gain unauthorized access, even if they steal credentials.
151. Why is it recommended to use bcrypt, Argon2, or PBKDF2 for password hashing?
A) These algorithms are designed to be slow, making brute-force attacks more difficult
B) They store passwords in plaintext for easy retrieval
C) They do not require salt for hashing
D) They increase website performance
β
Answer: A) These algorithms are designed to be slow, making brute-force attacks more difficult
π Explanation: Slow hashing functions with added computational cost make it harder for attackers to crack passwords.
152. What is a major risk of storing passwords using MD5 hashing?
A) MD5 is weak and can be easily cracked using brute force or rainbow tables
B) It prevents SQL Injection
C) It encrypts passwords securely
D) It reduces database storage requirements
β
Answer: A) MD5 is weak and can be easily cracked using brute force or rainbow tables
π Explanation: MD5 is outdated and should not be used for password hashing due to its vulnerabilities.
153. What is the best way to prevent XML External Entity (XXE) attacks?
A) Disable external entity processing in XML parsers
B) Use plaintext passwords
C) Implement weak authentication policies
D) Encrypt all XML files
β
Answer: A) Disable external entity processing in XML parsers
π Explanation: Disabling external entities prevents attackers from exploiting XXE vulnerabilities.
154. What does the SameSite=Strict
attribute in cookies do?
A) It prevents cookies from being sent with cross-site requests
B) It allows all cookies to be shared across different sites
C) It speeds up authentication
D) It disables CSRF tokens
β
Answer: A) It prevents cookies from being sent with cross-site requests
π Explanation: The SameSite=Strict
setting helps mitigate CSRF attacks by preventing cookies from being sent in cross-site contexts.
155. What is an example of a broken access control vulnerability?
A) A user modifying a request to access another user’s data
B) Encrypting passwords with bcrypt
C) Using HTTPS for secure connections
D) Enabling CSP security headers
β
Answer: A) A user modifying a request to access another user’s data
π Explanation: Broken Access Control occurs when users can manipulate requests to access unauthorized data.
156. How can developers mitigate the risk of Clickjacking?
A) Implementing the X-Frame-Options
HTTP header
B) Allowing all websites to frame their pages
C) Using weak password policies
D) Enabling JavaScript debugging
β
Answer: A) Implementing the X-Frame-Options
HTTP header
π Explanation: The X-Frame-Options
header prevents web pages from being embedded in iframes, reducing Clickjacking risks.
157. Why should applications avoid using security questions for authentication?
A) Answers to security questions can often be guessed or obtained from social engineering
B) They improve website speed
C) They make authentication faster
D) They encrypt all passwords
β
Answer: A) Answers to security questions can often be guessed or obtained from social engineering
π Explanation: Security questions often have predictable answers that attackers can obtain through research or social engineering.
158. How does a poorly configured CORS (Cross-Origin Resource Sharing) policy pose a security risk?
A) It allows unauthorized third-party websites to access restricted resources
B) It speeds up API responses
C) It prevents SQL Injection
D) It improves user authentication
β
Answer: A) It allows unauthorized third-party websites to access restricted resources
π Explanation: A misconfigured CORS policy can expose sensitive APIs to unauthorized websites.
159. What is a primary goal of implementing Multi-Factor Authentication (MFA)?
A) To provide an additional layer of security beyond just passwords
B) To remove the need for passwords
C) To make authentication slower
D) To prevent DDoS attacks
β
Answer: A) To provide an additional layer of security beyond just passwords
π Explanation: MFA enhances security by requiring additional verification factors, reducing the risk of account compromise.
160. How does improper error handling expose security risks?
A) It reveals sensitive information such as database queries, stack traces, or system paths
B) It speeds up application responses
C) It improves session management
D) It makes debugging easier
β
Answer: A) It reveals sensitive information such as database queries, stack traces, or system paths
π Explanation: Detailed error messages can disclose system details that attackers can use to exploit vulnerabilities.
161. What is the impact of insecure deserialization?
A) It can allow attackers to execute arbitrary code on the server
B) It speeds up authentication
C) It encrypts all passwords
D) It prevents SQL Injection
β
Answer: A) It can allow attackers to execute arbitrary code on the server
π Explanation: Insecure deserialization occurs when untrusted data is processed and executed on the server.
162. What security risk arises from improper session invalidation?
A) Users remain authenticated even after logging out, increasing session hijacking risks
B) It prevents XSS attacks
C) It encrypts API requests
D) It speeds up database queries
β
Answer: A) Users remain authenticated even after logging out, increasing session hijacking risks
π Explanation: Proper session invalidation ensures users are logged out securely, reducing the risk of hijacking.
163. Why is it dangerous to store sensitive data in local storage?
A) Local storage is accessible via JavaScript and can be stolen by XSS attacks
B) It encrypts data securely
C) It prevents unauthorized access
D) It improves authentication security
β
Answer: A) Local storage is accessible via JavaScript and can be stolen by XSS attacks
π Explanation: Data stored in local storage is vulnerable to client-side attacks such as XSS.
164. What does enabling HTTP Strict Transport Security (HSTS) do?
A) Forces all HTTP traffic to be redirected to HTTPS
B) Disables encryption on certain API endpoints
C) Prevents all XSS attacks
D) Increases website speed
β
Answer: A) Forces all HTTP traffic to be redirected to HTTPS
π Explanation: HSTS ensures that all connections are encrypted, preventing downgrade attacks.
165. How can attackers exploit a misconfigured cloud storage bucket?
A) By accessing and downloading sensitive data stored in the cloud
B) By improving website performance
C) By encrypting user authentication logs
D) By preventing XSS attacks
β
Answer: A) By accessing and downloading sensitive data stored in the cloud
π Explanation: Misconfigured cloud storage can expose sensitive data to the public, leading to data breaches.
166. What is a primary method for securing API authentication?
A) Implementing OAuth 2.0, JWTs, or API keys with proper access controls
B) Allowing unauthenticated API access
C) Storing API keys in public repositories
D) Using weak passwords for API authentication
β
Answer: A) Implementing OAuth 2.0, JWTs, or API keys with proper access controls
π Explanation: Secure authentication mechanisms protect API endpoints from unauthorized access.
167. What is a risk of weak session tokens?
A) Attackers can predict or brute-force session tokens to hijack user sessions
B) They improve authentication security
C) They encrypt all user data
D) They increase session expiration time
β
Answer: A) Attackers can predict or brute-force session tokens to hijack user sessions
π Explanation: Secure session tokens should be random, unique, and properly managed.
168. Why should developers avoid using wildcard characters in CORS policies?
A) It allows any origin to access APIs, increasing security risks
B) It speeds up authentication
C) It prevents XSS attacks
D) It improves API security
β
Answer: A) It allows any origin to access APIs, increasing security risks
π Explanation: Wildcard CORS policies (*
) expose APIs to unauthorized cross-origin access.
169. How can developers prevent privilege escalation attacks?
A) Implementing strict role-based access controls (RBAC)
B) Allowing all users to have admin privileges
C) Disabling authentication logs
D) Using hardcoded credentials
β
Answer: A) Implementing strict role-based access controls (RBAC)
π Explanation: RBAC ensures that users only have the necessary permissions for their roles.
170. What is an effective way to secure JWT tokens?
A) Using short expiration times and secure storage mechanisms
B) Storing JWTs in local storage
C) Using predictable JWT signatures
D) Allowing expired tokens
β
Answer: A) Using short expiration times and secure storage mechanisms
π Explanation: Securely storing JWTs and enforcing expiration prevents token misuse.
171. What is the impact of failing to set HTTP security headers properly?
A) It exposes web applications to vulnerabilities like XSS, Clickjacking, and data leaks
B) It improves website performance
C) It speeds up database queries
D) It prevents SQL Injection
β
Answer: A) It exposes web applications to vulnerabilities like XSS, Clickjacking, and data leaks
π Explanation: Properly configured security headers help mitigate various web security threats.
172. What does the HttpOnly
flag in cookies do?
A) Prevents client-side JavaScript from accessing cookies
B) Encrypts cookies automatically
C) Forces the cookie to expire immediately
D) Prevents all authentication attacks
β
Answer: A) Prevents client-side JavaScript from accessing cookies
π Explanation: The HttpOnly
flag helps protect cookies from being stolen via XSS attacks.
173. Why is implementing rate limiting important for authentication endpoints?
A) It helps prevent brute-force and credential stuffing attacks
B) It increases website speed
C) It reduces server logging requirements
D) It allows unlimited login attempts
β
Answer: A) It helps prevent brute-force and credential stuffing attacks
π Explanation: Rate limiting restricts the number of login attempts, making brute-force attacks more difficult.
174. What is a major security concern with public-facing APIs?
A) They can be targeted for unauthorized access, data leaks, and abuse
B) They improve website security
C) They prevent CSRF attacks
D) They always use strong encryption
β
Answer: A) They can be targeted for unauthorized access, data leaks, and abuse
π Explanation: APIs must be properly secured with authentication and access controls to prevent unauthorized access.
175. How can attackers exploit missing or improper authentication in an API?
A) By gaining unauthorized access to sensitive data and system functions
B) By increasing website performance
C) By encrypting API responses
D) By blocking SQL Injection
β
Answer: A) By gaining unauthorized access to sensitive data and system functions
π Explanation: Weak API authentication allows attackers to perform unauthorized actions or access sensitive data.
176. What is a primary reason for using HTTPS instead of HTTP?
A) It encrypts data in transit, preventing eavesdropping and MITM attacks
B) It speeds up authentication
C) It prevents all hacking attempts
D) It allows websites to store passwords in plaintext
β
Answer: A) It encrypts data in transit, preventing eavesdropping and MITM attacks
π Explanation: HTTPS ensures secure communication between users and servers.
177. What security measure helps prevent IDOR (Insecure Direct Object Reference) vulnerabilities?
A) Implementing proper authorization and access controls
B) Storing user data in plaintext
C) Allowing unrestricted user input
D) Using weak password policies
β
Answer: A) Implementing proper authorization and access controls
π Explanation: IDOR occurs when users can directly access unauthorized objects by modifying request parameters.
178. How does an attacker exploit a poorly configured Cross-Origin Resource Sharing (CORS) policy?
A) By making unauthorized API requests from a malicious website
B) By injecting SQL queries
C) By modifying browser session cookies
D) By performing privilege escalation
β
Answer: A) By making unauthorized API requests from a malicious website
π Explanation: A weak CORS policy allows malicious websites to interact with an application’s API.
179. What is a key risk of allowing unvalidated redirects and forwards?
A) Attackers can redirect users to phishing or malicious websites
B) It increases website performance
C) It prevents SQL Injection
D) It improves user authentication
β
Answer: A) Attackers can redirect users to phishing or malicious websites
π Explanation: Open redirects allow attackers to manipulate URLs and send users to harmful destinations.
180. Why should developers avoid hardcoding credentials in source code?
A) Hardcoded credentials can be easily extracted and used by attackers
B) They improve API authentication
C) They prevent SQL Injection
D) They increase website performance
β
Answer: A) Hardcoded credentials can be easily extracted and used by attackers
π Explanation: Hardcoded credentials in code repositories expose sensitive access keys to attackers.
181. What is a common technique for preventing brute force attacks on user accounts?
A) Implementing account lockout after multiple failed login attempts
B) Allowing unlimited login attempts
C) Using weak passwords
D) Storing user credentials in plaintext
β
Answer: A) Implementing account lockout after multiple failed login attempts
π Explanation: Locking accounts after repeated failed attempts reduces the effectiveness of brute-force attacks.
182. Why is it important to use input validation in web applications?
A) It helps prevent injection attacks such as SQL Injection and XSS
B) It speeds up database queries
C) It allows all user input to be processed without filtering
D) It disables security logs
β
Answer: A) It helps prevent injection attacks such as SQL Injection and XSS
π Explanation: Input validation ensures that user data does not contain malicious code.
183. What security risk arises from using outdated software and libraries?
A) Attackers can exploit known vulnerabilities to gain access
B) It improves website performance
C) It increases website security
D) It prevents SQL Injection
β
Answer: A) Attackers can exploit known vulnerabilities to gain access
π Explanation: Outdated software often contains unpatched security flaws that attackers can exploit.
184. What type of attack is prevented by the X-Frame-Options: DENY
header?
A) Clickjacking
B) SQL Injection
C) Server-Side Request Forgery (SSRF)
D) Broken Authentication
β
Answer: A) Clickjacking
π Explanation: The X-Frame-Options: DENY
header prevents a page from being embedded in an iframe, mitigating Clickjacking attacks.
185. How does the use of CAPTCHA improve security?
A) It helps prevent automated bot attacks and credential stuffing
B) It speeds up authentication
C) It encrypts database queries
D) It prevents SQL Injection
β
Answer: A) It helps prevent automated bot attacks and credential stuffing
π Explanation: CAPTCHA challenges block automated scripts from performing malicious actions.
186. What is the primary risk of using predictable session IDs?
A) Attackers can hijack user sessions by guessing or brute-forcing session tokens
B) It prevents CSRF attacks
C) It speeds up API responses
D) It improves authentication security
β
Answer: A) Attackers can hijack user sessions by guessing or brute-forcing session tokens
π Explanation: Session hijacking occurs when attackers gain unauthorized access to user sessions.
187. Why should developers use prepared statements for database queries?
A) To prevent SQL Injection attacks by separating SQL logic from user input
B) To make queries execute faster
C) To allow dynamic SQL injection
D) To improve database indexing
β
Answer: A) To prevent SQL Injection attacks by separating SQL logic from user input
π Explanation: Prepared statements prevent attackers from injecting malicious SQL commands.
188. What is an example of an authentication bypass vulnerability?
A) Allowing users to access restricted resources without verifying credentials
B) Using strong password policies
C) Implementing two-factor authentication
D) Encrypting all API requests
β
Answer: A) Allowing users to access restricted resources without verifying credentials
π Explanation: Authentication bypass vulnerabilities allow attackers to access protected resources without logging in.
189. What is the impact of not implementing proper session expiration?
A) Attackers can reuse session tokens to gain unauthorized access
B) It prevents SQL Injection
C) It increases API response times
D) It improves user authentication
β
Answer: A) Attackers can reuse session tokens to gain unauthorized access
π Explanation: Expired sessions should be invalidated to prevent unauthorized access.
190. What is the best way to secure API authentication?
A) Using OAuth, API keys, and token-based authentication with proper access controls
B) Allowing public access to all APIs
C) Using hardcoded credentials
D) Encrypting API responses only
β
Answer: A) Using OAuth, API keys, and token-based authentication with proper access controls
π Explanation: Secure authentication methods prevent unauthorized access to API endpoints.
191. What is the primary security risk of using default credentials in applications?
A) Attackers can easily gain unauthorized access using commonly known default credentials
B) It speeds up authentication
C) It improves application security
D) It prevents brute force attacks
β
Answer: A) Attackers can easily gain unauthorized access using commonly known default credentials
π Explanation: Default credentials are widely known and can be exploited in brute force attacks or unauthorized access attempts.
192. What is the best way to prevent privilege escalation attacks?
A) Implementing the principle of least privilege and strict access controls
B) Allowing all users administrative privileges
C) Disabling authentication logs
D) Using hardcoded credentials
β
Answer: A) Implementing the principle of least privilege and strict access controls
π Explanation: Restricting user privileges ensures that even if an attacker gains access, they cannot escalate their permissions easily.
193. What does the Secure
attribute in cookies do?
A) Ensures cookies are only transmitted over HTTPS connections
B) Encrypts cookies by default
C) Prevents all CSRF attacks
D) Allows cookies to be accessed by JavaScript
β
Answer: A) Ensures cookies are only transmitted over HTTPS connections
π Explanation: The Secure
flag ensures that cookies are not sent over insecure HTTP connections, reducing the risk of interception.
194. What is the risk of storing JWT tokens in local storage?
A) They can be accessed by JavaScript and stolen via XSS attacks
B) They are more secure than session cookies
C) They improve authentication speed
D) They prevent brute force attacks
β
Answer: A) They can be accessed by JavaScript and stolen via XSS attacks
π Explanation: Local storage is accessible by JavaScript, making JWT tokens vulnerable to theft if an XSS attack occurs.
195. Why should security patches and updates be applied regularly?
A) To fix known vulnerabilities and protect against new security threats
B) To increase website speed
C) To improve database indexing
D) To reduce CPU usage
β
Answer: A) To fix known vulnerabilities and protect against new security threats
π Explanation: Regular updates patch security vulnerabilities that attackers could exploit.
196. How can developers mitigate the risk of open redirect vulnerabilities?
A) Validate and restrict user-supplied redirect URLs
B) Allow users to input any URL
C) Disable all redirects
D) Encrypt URL parameters
β
Answer: A) Validate and restrict user-supplied redirect URLs
π Explanation: Open redirects allow attackers to redirect users to malicious websites; proper validation prevents this.
197. What is a common impact of a successful Cross-Site Scripting (XSS) attack?
A) An attacker can steal cookies, session tokens, or perform unauthorized actions on behalf of the user
B) The website loads faster
C) The database performance improves
D) Users are logged out automatically
β
Answer: A) An attacker can steal cookies, session tokens, or perform unauthorized actions on behalf of the user
π Explanation: XSS attacks allow attackers to execute scripts in the victimβs browser, leading to data theft or account hijacking.
198. What is a major risk of not logging and monitoring security events?
A) Attacks and breaches can go undetected for long periods
B) It speeds up application performance
C) It prevents SQL Injection
D) It encrypts all network traffic
β
Answer: A) Attacks and breaches can go undetected for long periods
π Explanation: Without proper logging and monitoring, security incidents may not be detected or mitigated in time.
199. Why is it important to implement proper session expiration?
A) It reduces the risk of session hijacking by limiting the lifetime of a session
B) It improves login speed
C) It prevents SQL Injection
D) It encrypts session cookies automatically
β
Answer: A) It reduces the risk of session hijacking by limiting the lifetime of a session
π Explanation: Expiring sessions properly ensures that even if an attacker steals a session token, it cannot be used indefinitely.
200. What is an effective way to prevent sensitive data exposure?
A) Encrypting sensitive data in transit and at rest
B) Storing all data in plaintext
C) Using HTTP instead of HTTPS
D) Allowing unrestricted access to sensitive files
β
Answer: A) Encrypting sensitive data in transit and at rest
π Explanation: Encrypting data ensures that even if it is intercepted or stolen, it remains unreadable to attackers.