Docsity

PrepIQ Web Application Hacking and Security Ultimate Exam, Exams of Cybersecurity

Toggle sidebar
bg1
PrepIQ Web Application Hacking and Security
Ultimate Exam
**Question 1. Which HTTP method is defined as idempotent but not safe?**
A) GET
B) POST
C) PUT
D) TRACE
Answer: C
Explanation: PUT is idempotent because repeating the same request has the same
effect, but it changes server state, so it is not safe.
**Question 2. In the HTTP response, which status code indicates that the request
was successful and a new resource was created?**
A) 200 OK
B) 201 Created
C) 202 Accepted
D) 204 No Content
Answer: B
Explanation: 201 signals that the request succeeded and a new resource was
created on the server.
**Question 3. Which header directs browsers to only communicate with the site over
HTTPS for the next 6 months?**
A) Content-Security-Policy
B) X-Frame-Options
C) Strict-Transport-Security
D) X-Content-Type-Options
Answer: C
Explanation: HSTS (Strict-Transport-Security) forces browsers to use HTTPS for the
specified max-age.
**Question 4. Which of the following is NOT a typical way to maintain state in a web
application?**
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

Partial preview of the text

Download PrepIQ Web Application Hacking and Security Ultimate Exam and more Exams Cybersecurity in PDF only on Docsity!

Ultimate Exam

Question 1. Which HTTP method is defined as idempotent but not safe? A) GET B) POST C) PUT D) TRACE Answer: C Explanation: PUT is idempotent because repeating the same request has the same effect, but it changes server state, so it is not safe. Question 2. In the HTTP response, which status code indicates that the request was successful and a new resource was created? A) 200 OK B) 201 Created C) 202 Accepted D) 204 No Content Answer: B Explanation: 201 signals that the request succeeded and a new resource was created on the server. Question 3. Which header directs browsers to only communicate with the site over HTTPS for the next 6 months? A) Content-Security-Policy B) X-Frame-Options C) Strict-Transport-Security D) X-Content-Type-Options Answer: C Explanation: HSTS (Strict-Transport-Security) forces browsers to use HTTPS for the specified max-age. Question 4. Which of the following is NOT a typical way to maintain state in a web application?

Ultimate Exam

A) Cookies B) JWTs C) Hidden form fields D) DNS queries Answer: D Explanation: DNS queries are unrelated to application state; cookies, JWTs, and hidden fields are common mechanisms. Question 5. Which protocol is primarily used for SOAP-based web services? A) HTTP/ B) SMTP C) TCP D) SOAP over HTTP Answer: D Explanation: SOAP messages are usually transported over HTTP, though other transports exist. Question 6. Which JavaScript API enables asynchronous HTTP requests without page reload? A) fetch() B) document.write() C) alert() D) setTimeout() Answer: A Explanation: fetch() (or XMLHttpRequest) performs AJAX calls, allowing background communication. Question 7. Which OWASP Top 10 category deals with failures in the design of authentication mechanisms? A) A01:2021 – Broken Access Control B) A02:2021 – Cryptographic Failures

Ultimate Exam

Answer: C Explanation: Blind SQLi relies on indirect signals like response time or boolean outcomes, not direct data leakage. Question 11. In a NoSQL injection against MongoDB, which operator is commonly abused to bypass authentication? A) $ne B) $gt C) $regex D) $exists Answer: A Explanation: Using {$ne: null} can make a query always true, allowing login bypass. Question 12. Which mitigation technique is most effective against OS command injection? A) Escaping special characters only. B) Using a whitelist of allowed commands. C) Disabling the system shell. D) Encrypting user input. Answer: B Explanation: Whitelisting ensures only known safe commands are executed, eliminating injection paths. Question 13. Which of the following template engines is vulnerable to Server-Side Template Injection if user input is rendered without sanitization? A) Handlebars (client-side) B) Jinja2 (Python) C) React JSX (client-side) D) Angular interpolation (client-side) Answer: B

Ultimate Exam

Explanation: Jinja2 processes templates on the server; unsanitized user data can lead to SSTI. Question 14. Which XML parser configuration prevents XXE attacks? A) Enabling DTD processing. B) Allowing external entity resolution. C) Disabling DTDs and external entities. D) Using a permissive schema validation. Answer: C Explanation: Turning off DTDs and external entity resolution blocks malicious entity inclusion. Question 15. Which LDAP filter syntax element can be abused to perform LDAP injection? A) (&(uid=)) B) (|(uid=)) C) (uid=) D) (uid=*)! Answer: B Explanation: The OR operator (|) can be injected to change the logic of the LDAP query. Question 16. Which of the following password-storage practices is considered secure? A) MD5 hashing without salt. B) SHA-1 hashing with a static salt. C) bcrypt with a per-user salt. D) Plain-text storage in a configuration file. Answer: C Explanation: bcrypt automatically salts each password and is computationally expensive, making it secure.

Ultimate Exam

A) Header B) Payload C) Signature D) Claims Answer: C Explanation: The third Base64URL segment is the signature, generated from the header and payload. Question 21. Which algorithm confusion attack involves changing the JWT “alg” header to “none”? A) Key substitution B) Signature stripping C) Algorithm downgrade D) Token replay Answer: C Explanation: Setting “alg” to “none” tells the server to skip verification, allowing unsigned tokens. Question 22. Which OAuth flow is considered insecure for public clients because the access token is returned in the URL fragment? A) Authorization Code Grant B) Implicit Grant C) Client Credentials Grant D) Resource Owner Password Credentials Grant Answer: B Explanation: The Implicit Grant returns tokens in the fragment, exposing them to browser history and logs. Question 23. Which CSP directive helps mitigate reflected XSS by restricting script sources? A) default-src

Ultimate Exam

B) script-src C) img-src D) style-src Answer: B Explanation: script-src defines allowed origins for JavaScript, blocking unexpected script injection. Question 24. Which of the following is a typical symptom of a successful CSRF attack? A) The victim’s browser shows a JavaScript alert. B) An unauthorized state-changing request is performed using the victim’s credentials. C) The server returns a 401 Unauthorized response. D) The user’s password is displayed in the page source. Answer: B Explanation: CSRF tricks the browser into sending a request that changes state on behalf of the authenticated user. Question 25. Which attribute value for the Set-Cookie header helps mitigate CSRF? A) Secure B) HttpOnly C) SameSite=Lax D) Domain=.example.com Answer: C Explanation: SameSite=Lax (or Strict) prevents cookies from being sent on cross-site requests, reducing CSRF risk. Question 26. Which CORS response header indicates that any origin may access the resource? A) Access-Control-Allow-Methods B) Access-Control-Allow-Credentials

Ultimate Exam

Answer: C Explanation: Java native serialization can execute code during deserialization if untrusted data is processed. Question 30. Which of the following is a typical indicator of a business-logic flaw in an e-commerce checkout process? A) The server returns a 500 error when adding items to the cart. B) A user can modify the price parameter in the request and complete the purchase. C) The “Add to Wishlist” button is missing. D) The product description contains HTML tags. Answer: B Explanation: Allowing price manipulation demonstrates a failure in business-logic validation. Question 31. Which HTTP status code is commonly used to indicate that the request was blocked by a WAF? A) 403 Forbidden B) 404 Not Found C) 429 Too Many Requests D) 502 Bad Gateway Answer: A Explanation: WAFs often return 403 to signal that the request is forbidden due to policy. Question 32. Which of the following is a secure default for the X-Content-Type-Options header? A) nosniff B) sniff C) allow-all D) strict Answer: A

Ultimate Exam

Explanation: nosniff prevents browsers from MIME-sniffing, reducing drive-by download attacks. Question 33. Which HTTP method is commonly used by REST APIs to partially update a resource? A) POST B) PUT C) PATCH D) DELETE Answer: C Explanation: PATCH applies partial modifications, whereas PUT replaces the entire resource. Question 34. Which of the following is a recommended way to protect secret keys in a CI/CD pipeline? A) Store them in plain text in the repository. B) Hard-code them in source files. C) Use a secret-management service with restricted access. D) Echo them in build logs. Answer: C Explanation: Secret-management services provide encrypted storage and auditability. Question 35. Which of the following is NOT a typical sign of a misconfigured web server that leaks information? A) Directory listing enabled for /uploads. B) Server header revealing Apache version. C) HTTP 404 responses with detailed stack traces. D) Successful TLS handshake. Answer: D

Ultimate Exam

Question 39. Which of the following is a common technique to bypass a naive input filter that strips the word “script”? A) Using “ipt>” B) Using “%3Cscript%3E” (URL-encoded) C) Using “” D) All of the above. Answer: D Explanation: All listed payloads evade simple blacklist filters that only block the exact string “script”. Question 40. Which HTTP response header can be used to prevent browsers from caching sensitive pages? A) Cache-Control: no-store B) Pragma: no-cache C) Expires: 0 D) All of the above. Answer: D Explanation: Combining these directives ensures that browsers and proxies do not store the response. Question 41. Which of the following is a sign that a web application is vulnerable to path traversal? A) Requesting /images/../admin/config.php returns the admin config file. B) The server returns a 403 Forbidden for /admin/. C) The URL includes “%2e%2e%2f”. D) The application redirects to the login page. Answer: A Explanation: Using “../” to escape the intended directory and retrieve files indicates a traversal flaw.

Ultimate Exam

Question 42. Which of the following is the most secure way to generate a session identifier? A) Using the current timestamp. B) Concatenating username with a random number. C) Generating a 128-bit cryptographically random token. D) Hashing the user’s IP address. Answer: C Explanation: Cryptographically strong random values provide high entropy and are unpredictable. Question 43. Which HTTP verb is typically disallowed on public APIs to prevent unintended data deletion? A) GET B) POST C) DELETE D) HEAD Answer: C Explanation: DELETE removes resources; many APIs restrict it to authenticated, authorized users. Question 44. Which technique can be used to detect a time-based blind SQL injection? A) Observe error messages. B) Measure response latency after injecting “SLEEP(5)”. C) Look for UNION SELECT results. D) Check for base64-encoded output. Answer: B Explanation: Introducing a delay (e.g., SLEEP) and measuring response time reveals blind injection. Question 45. Which of the following is a recommended practice when using JWTs for session management?

Ultimate Exam

B) Strict-Transport-Security C) Content-Security-Policy D) X-XSS-Protection Answer: B Explanation: HSTS tells browsers to enforce HTTPS for the domain. Question 49. Which of the following is the most effective way to mitigate a reflected XSS vulnerability in a search parameter? A) Encode the parameter value when inserting into HTML. B) Block the request if it contains “

Ultimate Exam

D) Using predictable usernames. Answer: B Explanation: Locking or throttling after repeated failures slows automated guessing. Question 52. Which of the following is a common misconfiguration that leads to open redirect vulnerabilities? A) Using relative URLs for internal navigation. B) Accepting a “next” parameter without validation. C) Enforcing HTTPS on all pages. D) Setting Content-Security-Policy to default-src 'self'. Answer: B Explanation: Unvalidated redirect URLs allow attackers to send users to malicious sites. Question 53. Which of the following HTTP methods can be used to retrieve metadata about a resource without fetching the body? A) GET B) HEAD C) OPTIONS D) TRACE Answer: B Explanation: HEAD returns headers identical to GET but without the response body. Question 54. Which of the following is an example of a security-relevant HTTP response header that helps prevent MIME-type sniffing? A) X-Frame-Options B) X-Content-Type-Options: nosniff C) Referrer-Policy D) Feature-Policy Answer: B

Ultimate Exam

Question 58. Which of the following is an effective mitigation against XML External Entity (XXE) attacks in a Java application? A) Enable external DTD loading. B) Set the parser feature “http://apache.org/xml/features/disallow-doctype-decl” to true. C) Use a permissive XML schema. D) Serialize XML with base64. Answer: B Explanation: Disallowing DOCTYPE declarations stops external entity processing. Question 59. Which of the following is a common sign that a web server is leaking its version via the “Server” header? A) The header reads “Apache/2.4.41 (Ubuntu)”. B) The header is omitted entirely. C) The header contains only “nginx”. D) The header shows “Server:”. Answer: A Explanation: Detailed version information assists attackers in targeting known vulnerabilities. Question 60. Which of the following is the most appropriate way to store API keys on a server? A) In a .env file with restricted filesystem permissions. B. In the source code repository. C. In a publicly accessible directory. D. In a client-side JavaScript file. Answer: A Explanation: Environment files kept out of version control and with proper permissions protect secrets. Question 61. Which of the following best describes the “principle of least privilege” in the context of web application permissions?

Ultimate Exam

A) Users should have access to all features for convenience. B) Each user should receive only the permissions necessary to perform their tasks. C) Administrators should share passwords to simplify management. D) All services should run as root. Answer: B Explanation: Limiting permissions reduces the impact of compromised accounts. Question 62. Which of the following is a typical indicator of a successful SSRF that reaches an internal metadata service? A) The response contains “AWS_ACCESS_KEY_ID”. B) The server returns a 200 OK with an HTML page. C) The request is blocked by a firewall. D) The DNS lookup fails. Answer: A Explanation: Cloud metadata endpoints expose credentials; seeing such data confirms SSRF. Question 63. Which of the following is the most reliable way to detect a hidden directory using a wordlist? A) Sending GET requests with random strings. B) Using a recursive directory brute-force tool with a comprehensive wordlist. C) Scanning the site with a port scanner. D) Inspecting the robots.txt file only. Answer: B Explanation: Brute-forcing with a curated wordlist uncovers hidden paths not listed elsewhere. Question 64. Which of the following HTTP status codes indicates that the request method is not allowed for the target resource? A) 401 Unauthorized B) 403 Forbidden