Limited-Time Offer: Enjoy 50% Savings! Coupon code: 50OFF Use it at checkout
Skip to content

Free The SecOps Group Certified AppSec Practitioner Exam CAP Exam Questions

Last updated: · 14 practice questions with answers and explanations

Page: 1 / 6 Total 60 questions

Want more questions? Get Premium Access.

Question 1

New Single answer

Topic: XML External Entity attack

Skill tested: Configures XML parsing to prevent external entity resolution and XXE data disclosure.

A claims-processing service accepts XML documents from partner organizations and parses them using a server-side XML library. A security review finds that a document can cause the service to read a local file through an external entity. The service must continue accepting valid XML, and partner documents do not require external DTDs or entity expansion. The development team wants a fix that addresses the parsing root cause rather than relying on network filtering or input-pattern detection. Which change is MOST appropriate?

Correct Answer: A. Disable DTD processing and external general and parameter entities in the XML parser.
Explanation:

Disabling DTD processing and external entity resolution prevents the parser from retrieving external resources, which addresses the cause of XXE while preserving ordinary XML parsing. Pattern blacklists can be bypassed through alternate syntax or encoding. Read-only permissions still allow sensitive files to be disclosed, and escaping the entire input can corrupt legitimate XML without reliably changing parser behavior.

Question 2

New Multiple answers

Topic: Authorization and Session Management related flaws

Skill tested: Enforces object-level authorization to prevent IDOR across user-controlled resource identifiers.

A customer portal uses URLs such as `/invoices/4817` to retrieve invoices. An authenticated customer changes the number to `4818` and receives another customer's invoice. The application already verifies that the requester has a valid session, and invoice identifiers must remain usable in links sent to customers. The team wants to prevent unauthorized access consistently across browser and API endpoints without depending on identifiers being difficult to guess. Which TWO changes provide the strongest direct controls? Select TWO.

Correct Answer: B. For every invoice read, verify that the authenticated principal is authorized for that specific invoice.; D. Apply a server-side ownership or permission check in the data-access path used by every endpoint.
Explanation:

IDOR is an object-level authorization failure, so each request must be checked against the authenticated user's rights to the requested invoice. Centralizing that check in the shared data-access path helps ensure that browser and API routes enforce the same rule. Random identifiers reduce easy enumeration but are not authorization. Hiding links and requiring a valid session do not stop an authenticated user from modifying an identifier.

Question 3

New Single answer

Topic: Input Validation Mechanisms

Skill tested: Chooses allowlist validation for constrained user input rather than bypassable blacklisting.

An internal reporting tool accepts a `format` parameter that may only be `csv`, `json`, or `pdf`. A recent patch blocks a list of suspicious characters, but testers found that unexpected values still reach downstream code through alternate encodings. The format is used to select a report renderer, and accepting any other value is unnecessary. The team wants deterministic validation before the renderer is called. What is the BEST approach?

Correct Answer: A. Require an exact match against the three permitted format values and reject all other input.
Explanation:

An allowlist is appropriate because the valid input set is small and explicitly defined. Exact matching rejects unexpected values before they influence renderer selection, regardless of whether an attacker uses an unanticipated character sequence. Expanding a blacklist is an ongoing bypass-prone task, while repeated decoding does not establish that a value is authorized. A broad alphabetic rule would still accept unsupported renderer names.

Question 4

New Single answer

Topic: Cross-Site Scripting

Skill tested: Applies context-aware output encoding when rendering untrusted text in HTML.

A support dashboard displays customer-provided ticket titles inside an HTML element. The application currently removes the literal `` string, but a penetration test demonstrates that a title containing markup can still execute in the agent's browser. Titles are plain text and do not need to contain HTML. The team wants to preserve punctuation and international characters while ensuring that the browser treats the title only as text. Which remediation is MOST appropriate?

Correct Answer: A. Apply HTML entity encoding to the title for the HTML text context at output time.
Explanation:

Context-appropriate HTML encoding converts characters such as angle brackets into representations that the browser displays as text rather than interpreting as markup. Encoding at output handles the actual rendering context and preserves ordinary text, including punctuation. A blacklist can miss alternate markup forms, changing database capacity has no security effect, and Base64 is reversible transport encoding - not a defense if the browser decodes the value before rendering.

Question 5

New Multiple answers

Topic: SQL Injection

Skill tested: Uses parameterized SQL and allowlisted identifiers to separate data from query structure.

A reporting endpoint filters records by a user-supplied status and optionally sorts by a requested column. The developer concatenates both values into SQL. Status values must remain user-selectable, and sorting may use only `created_at` or `priority`; the database driver cannot bind a column name as a query parameter. The team needs a design that prevents SQL injection without removing either feature. Which TWO measures should it implement? Select TWO.

Correct Answer: B. Map the requested sort value to one of the two fixed, server-defined column identifiers.; D. Bind the status value as a parameter in a prepared statement.
Explanation:

Prepared-statement parameters keep the status value separate from SQL syntax. Since column identifiers generally cannot be supplied as ordinary bound values, the sort key should be matched to a fixed server-side allowlist and only that trusted identifier inserted into the query. Escaping is fragile and context-dependent; keyword filtering can be bypassed; hashing changes the value rather than making SQL construction safe.

Question 6

New Single answer

Topic: Cross-Site Request Forgery

Skill tested: Adds and validates CSRF tokens for state-changing requests using ambient browser credentials.

An online billing application authenticates users with a session cookie. A POST endpoint changes the destination bank account, and the request is accepted based only on the cookie and submitted account number. The endpoint must remain available to the application's browser interface, and the team cannot rely on users changing browsers or disabling cookies. What is the MOST appropriate primary defense against a forged cross-site form submission?

Correct Answer: B. Require and validate an unpredictable CSRF token associated with the user's session on the state-changing request.
Explanation:

A session-associated CSRF token that an attacker on another site cannot obtain provides a request-specific check in addition to the browser's ambient session cookie. The application should validate it on state-changing operations. Encrypting a value in client-side JavaScript does not establish that the user intended the action. A longer session identifier does not distinguish forged requests, and placing the parameter in the URL does not prevent cross-site submission.

Question 7

New Single answer

Topic: Encoding, Encryption and Hashing

Skill tested: Selects a one-way password hashing approach rather than reversible encryption or encoding.

A small SaaS provider stores user passwords because its login service must verify credentials, but it has no requirement to recover or display a user's original password. A database backup was recently exposed, and the team is redesigning password storage. The team also needs to avoid making offline guessing inexpensive if the database is stolen. Which storage approach is MOST appropriate?

Correct Answer: C. Store salted password hashes produced by a purpose-built, configurable password-hashing function.
Explanation:

A salted, deliberately costly password-hashing function supports verification without retaining a reversible password. Its salt prevents identical passwords from producing identical stored hashes and frustrates precomputed attacks; configurable work factors make guessing more expensive. Symmetric encryption is reversible and its key may be exposed, Base64 is only encoding, and a fast unsalted hash makes large-scale offline guessing and hash comparison easier.

Question 8

New Single answer

Topic: Authentication related Vulnerabilities

Skill tested: Mitigates online password brute force with throttling and risk-aware account protections.

A customer login service experiences repeated automated password guesses against many accounts. The business cannot permanently lock accounts after a small number of failures because attackers could deny service to legitimate customers. The service supports rate limiting and can record failed attempts by account and source. Which approach BEST reduces brute-force risk while limiting attacker-driven lockouts?

Correct Answer: D. Apply progressive throttling and monitoring, using multiple signals and a bounded recovery process.
Explanation:

Progressive throttling increases the cost of repeated guessing while avoiding a simple permanent account-lockout denial-of-service mechanism. Monitoring across account and source signals helps detect distributed attempts, and a bounded recovery process supports legitimate users. Permanent lockout lets attackers disable accounts. Password policy alone does not slow current online attempts, while blocking an address after one failure is easy to evade and may block shared networks.

Question 9

New Single answer

Topic: Security Best Practices and Hardening Mechanisms.

Skill tested: Uses Same Origin Policy boundaries and CORS configuration to limit cross-origin data access.

A web application serves a private customer API and a separate analytics site hosted on another origin. The API currently returns `Access-Control-Allow-Origin: *` and allows credentialed requests, although only the analytics origin needs to read selected responses. Browser same-origin restrictions should continue protecting other origins, and the API must not become publicly readable. What is the BEST configuration direction?

Correct Answer: C. Allow only the exact trusted analytics origin for the required resources, with credentials enabled only if needed.
Explanation:

CORS is a server-controlled exception to browser same-origin restrictions. The API should name the specific trusted origin and limit the policy to the required resources and methods; credentialed access should be enabled only when necessary. A wildcard does not provide the required origin restriction and cannot be combined with credentialed browser access as a valid permissive setup. Reflecting arbitrary origins effectively grants access to any requesting site.

Question 10

New Multiple answers

Topic: Security Best Practices and Hardening Mechanisms.

Skill tested: Selects browser security headers that restrict framing and enforce transport security.

A public web portal is served exclusively over HTTPS and includes pages that must never be embedded in third-party frames. A review also finds that browsers can still be directed to an HTTP URL before being redirected to HTTPS. The organization wants browser-enforced controls for both risks and does not need compatibility with legacy clients that ignore modern headers. Which TWO response-header measures directly address these requirements? Select TWO.

Correct Answer: A. Set `Strict-Transport-Security` with an appropriate `max-age` after confirming HTTPS coverage.; C. Set a Content-Security-Policy `frame-ancestors` directive that permits no framing origins.
Explanation:

CSP `frame-ancestors` controls which origins may embed the page, and a policy with no allowed framing origins prevents third-party framing. HSTS tells supporting browsers to use HTTPS for the host for the configured period, reducing downgrade and insecure-navigation exposure after it has been received over HTTPS. CORS governs cross-origin script access, not framing or transport. `nosniff` concerns MIME handling, and cache directives do not enforce HTTPS.

Question 11

New Single answer

Topic: TLS security

Skill tested: Diagnoses certificate name and trust-chain misconfiguration in a TLS deployment.

A company replaces its API certificate during a deployment. Some clients report a hostname mismatch, while others report that the certificate chain is incomplete. The leaf certificate is valid for `api.example.net`, but the production service is accessed as `payments.example.net`; the server also sends only the leaf certificate. The organization wants standard clients to validate the intended service without installing private trust roots or disabling verification. What should the operations team do?

Correct Answer: D. Install a certificate valid for `payments.example.net` and serve the required intermediate certificate chain.
Explanation:

TLS clients validate that the requested hostname matches a name in the certificate and that a trusted chain can be built. The deployed certificate must cover `payments.example.net`, and the server should send the required intermediate certificates so clients can construct the chain. Ignoring validation defeats authentication. A self-signed certificate is not trusted by standard clients without a separately managed trust anchor, and cipher strength does not fix certificate identity or chain errors.

Question 12

New Single answer

Topic: Server-Side Request Forgery

Skill tested: Restricts server-side outbound requests with destination allowlisting and network controls.

A document-preview service fetches a URL supplied by a user. Attackers have used it to request internal administration endpoints, including addresses that are not publicly routable. The feature only needs to retrieve documents from a small set of partner domains, and partner hostnames may resolve to changing public IP addresses. The team wants to reduce SSRF exposure at both application and infrastructure layers. Which approach is MOST appropriate?

Correct Answer: C. Allowlist approved partner hostnames, validate resolved destinations against prohibited network ranges, and restrict outbound network access.
Explanation:

A defense-in-depth design limits fetches to approved destinations, validates resolved addresses to prevent access to internal or otherwise prohibited ranges, and applies network egress controls so application mistakes have less impact. HTTPS protects transport to a destination but does not make that destination safe. Blocking one literal address misses alternate representations and other private ranges, while a dot check has no meaningful destination-security property.

Question 13

New Single answer

Topic: Insecure File Uploads

Skill tested: Validates uploaded files using content checks and safe storage outside executable web paths.

A recruiting portal accepts résumé uploads. It currently trusts the filename extension and stores files in a directory that the web server serves directly. A user can upload files only for later review by staff; direct public access is not required. The team must preserve common document formats while preventing uploaded content from being interpreted as executable server-side code. What is the BEST design?

Correct Answer: C. Validate permitted formats using server-side checks, assign a safe generated name, and store files outside the web root with controlled retrieval.
Explanation:

Server-side validation should constrain allowed formats using more than the client-supplied filename or MIME type. A generated name prevents user-controlled paths and extensions from determining server behavior, while storage outside the web root prevents direct execution or unintended public access; controlled retrieval can serve approved files safely. Trusting extensions or MIME headers is insufficient, and renaming a file does not neutralize its contents or remove public-directory risks.

Question 14

New Single answer

Topic: Code Injection Vulnerabilities

Skill tested: Prevents command injection by avoiding shell interpretation and passing arguments safely.

A maintenance endpoint accepts a hostname and invokes a system utility to check connectivity. The application currently builds a shell command by concatenating the submitted hostname into a string. The endpoint must retain the diagnostic function, but it should not allow a caller to add shell operators or execute another command. Which change is MOST appropriate?

Correct Answer: B. Execute the utility through an API that accepts a fixed executable and separate argument values, with strict hostname validation.
Explanation:

Avoiding shell interpretation is the strongest practical defense: invoke a fixed executable with arguments passed separately, and validate the hostname against the accepted syntax. This prevents shell operators from being parsed as command structure. Metacharacter escaping is error-prone and shell-specific; Base64 does not help if the value is decoded or interpreted later. Running with elevated privileges would increase the impact of any remaining injection flaw.