Question 310 A download endpoint reads a supplied path such as ../secrets/config.yml and returns files outside the allowed directory. What is the needed defense? Disable all HTTP error messages Hide file names in the interface only Canonicalize paths and enforce an allowlisted storage root Increase the upload size limit Explanation Correct Answer C:File access must be confined after resolving traversal sequences. Incorrect Answers A:Error handling alone does not restrict file paths. B:Attackers can still call the endpoint directly. D:Size is unrelated to traversal.
Question 311 A user can modify the resource ID in an API request and read another customer's profile. What control is missing? Server-side object-level authorization on every request A longer TLS certificate validity period A hidden form field with the user ID A nicer API error page Explanation Correct Answer A:Authentication alone does not prove permission to access a different object. Incorrect Answers B:TLS does not enforce per-object access. C:Client fields can be changed by attackers. D:Presentation does not restrict data.
Question 312 A customer-support portal accepts state-changing POST requests with the user's session cookie and no anti-CSRF protection. What should be added? Longer URL aliases SameSite-aware cookie policy and anti-CSRF request tokens where applicable Only server-side output compression Publicly readable session cookies Explanation Correct Answer B:Requests need defenses against cross-site use of a victim's authenticated session. Incorrect Answers A:Aliases do not prevent CSRF. C:Compression does not authenticate request origin. D:Exposing cookies worsens account compromise.
Question 313 A service receives requests using session IDs that never change after login. What improves session security? Keep anonymous and authenticated IDs identical forever Rotate session identifiers at authentication and privilege changes Ignore logout invalidation Store tokens in public URLs Explanation Correct Answer B:Fresh identifiers reduce session fixation risk. Incorrect Answers A:That permits fixation of a known session. C:Revocation matters for stolen or stale sessions. D:URLs can leak through logs and referrers.
Question 314 A password reset endpoint returns a reusable link valid for seven days without rate limits. Which change is essential? Send the existing password by email Make reset tokens predictable for support staff Disable all audit logs for reset events Short-lived single-use reset tokens with abuse controls Explanation Correct Answer D:Token expiration, one-time use and throttling limit account-takeover opportunities. Incorrect Answers A:Passwords should not be recoverable in plaintext. B:Predictability undermines secrecy. C:Recovery actions require visibility.
Question 315 A cloud service accepts unsigned tokens claiming administrator role. What is the primary defect? A low DNS TTL Failure to validate token signature, issuer, audience and claims Lack of a secondary documentation page An outdated homepage image Explanation Correct Answer B:Untrusted claims must not grant authority without verification. Incorrect Answers A:Caching has no bearing on token authenticity. C:Documentation cannot replace validation. D:Branding does not authorize API calls.
Question 316 A server retrieves arbitrary URLs supplied by users and can reach the cloud instance metadata service. Which attack should be mitigated? Reflected XSS in every browser A password-spraying attack A local disk fragmentation defect Server-side request forgery against internal and metadata endpoints Explanation Correct Answer D:A server acting on user URLs can be coerced to access privileged network resources. Incorrect Answers A:The described execution is server-side network fetching. B:No online login attempts are described. C:Storage layout is unrelated.
Question 317 A web fetch feature must access a small set of partner APIs, but accepts any URL. What is the best design? Enforce an allowlist and block private/link-local destinations after DNS resolution Turn off outbound request logging Trust user-supplied URLs because they are HTTPS Only remove the word localhost from strings Explanation Correct Answer A:Restricted outbound destinations reduce SSRF paths, including DNS-rebinding risks. Incorrect Answers B:That weakens detection. C:HTTPS does not imply an approved endpoint. D:Alternate addresses and encodings can bypass string filters.
Question 318 An XML parser processes external entities from untrusted uploads and can read local files. What mitigation is relevant? Store XML under a different filename Increase HTTP response timeouts Disable external entity resolution and use hardened parser settings Change the web font to monospace Explanation Correct Answer C:Preventing external entity processing limits file-read and network-fetch abuse. Incorrect Answers A:Naming cannot fix parser behavior. B:Timeouts do not disable entity expansion. D:Presentation does not control XML parsing.
Question 319 A JSON deserialization component instantiates arbitrary classes named in client-supplied data. What should developers do? Trust all client class names when TLS is enabled Disable all data validation for performance Restrict allowed types and avoid unsafe polymorphic deserialization Change the API port number Explanation Correct Answer C:Untrusted data must not choose executable object types. Incorrect Answers A:TLS does not authorize code classes. B:That increases risk. D:Port choice does not fix unsafe deserialization.
Question 320 A C application copies a user string into a fixed-size stack array without checking length. Which remediation fits? Remove diagnostic logging only Lengthen the stack return address Bounded copying with correct length validation and memory-safe design Run the process as administrator Explanation Correct Answer C:Bounds checks or safer languages reduce stack overflow opportunities. Incorrect Answers A:Logging does not enforce bounds. B:Return-address format is not the fix. D:Privilege increases exploitation impact.