Courseiva

CCNA Secure Software Implementation Questions

32 questions · Secure Software Implementation topic · All types, answers revealed

1
MCQhard

A team is using SonarQube to enforce secure coding standards. Which analysis approach is required to detect vulnerabilities related to improper handling of sensitive information in logs?

A.Syntax checking
B.Unit testing
C.Dead code detection
D.Taint analysis
AnswerD

Taint analysis tracks untrusted data flows from sources to sinks, so it can flag when sensitive values propagate into logging calls. This dataflow tracking is what detects improper handling of sensitive information in logs, unlike pattern or style checks.

Why this answer

Data flow analysis (or taint analysis) is required to track whether sensitive data reaches an insecure sink like a log file.

2
MCQmedium

When managing third-party libraries, why is a Software Bill of Materials (SBOM) essential?

A.To encrypt source code
B.To provide a complete inventory of software components
C.To speed up build times
D.To replace the need for unit testing
AnswerB

An SBOM enumerates every component, library and dependency version within the software, giving the complete inventory needed to identify affected third-party libraries when a new vulnerability is disclosed. This visibility satisfies the third-party library management requirement by enabling rapid impact assessment and remediation.

Why this answer

An SBOM provides a machine-readable, complete inventory of all software components and their dependencies, which is essential for identifying and responding to vulnerabilities in third-party libraries. Without this inventory, an organization cannot know whether it is affected by a newly disclosed CVE in a transitive dependency. This transparency is the foundation of software supply chain risk management.

Exam trap

CSSLP often tests the misconception that an SBOM is a security tool that patches or encrypts, when it is actually an inventory and transparency artifact whose value lies in enabling vulnerability identification and supply chain risk management.

How to eliminate wrong answers

Option A is wrong because SBOMs do not encrypt source code — encryption is a separate cryptographic control, and an SBOM is a manifest of components, not a protection mechanism. Option C is wrong because SBOM generation is a documentation and inventory activity that does not affect build performance; in fact, generating SBOMs can add minor build overhead. Option D is wrong because an SBOM is not a testing tool and cannot replace unit testing — it identifies what components exist, not whether the code behaves correctly or securely.

3
Multi-Selecthard

Which TWO of the following are crucial when performing a manual code review for security?

Select 2 answers
A.Identifying data flow sources and sinks
B.Focusing only on UI design elements
C.Rewriting the entire application
D.Verifying authorization checks are enforced
E.Checking code indentation consistency
AnswersA, D

Tracing untrusted input from entry points (sources) to sensitive operations (sinks) exposes injection, path traversal and deserialisation flaws that pattern-matching tools miss. This directly satisfies the stem's manual review constraint: a human follows tainted data across functions and files, confirming whether validation or encoding actually neutralises it.

Why this answer

Option A is correct because identifying data flow sources and sinks is essential in manual security code review: you trace where untrusted input enters (sources such as HTTP parameters, headers, or file uploads) and where it reaches sensitive operations (sinks such as SQL queries, OS commands, or HTML output), which is how you spot injection, XSS, and similar flaws. Option D is correct because verifying that authorization checks are enforced ensures each sensitive function or resource access validates the caller's permissions server-side, preventing broken access control (e.g., IDOR or privilege escalation) that automated tools often miss. Option B is not appropriate because UI design elements are cosmetic and unrelated to security vulnerabilities.

Option C is not appropriate because rewriting the entire application is a remediation/development activity, not part of reviewing code for security. Option E is not appropriate because code indentation consistency is a style concern with no direct security impact.

Exam trap

The trap here is confusing code review with code quality or remediation activities — candidates pick style or rewrite options because they sound thorough, but CSSLP tests whether you know review is about data flow and access control enforcement.

4
Multi-Selecthard

Which THREE of the following are recognized techniques for minimizing the attack surface of an API?

Select 3 answers
A.Implement robust authentication
B.Use cleartext headers for all communication
C.Implement rate limiting
D.Expose full internal database schemas
E.Disable unused HTTP methods
AnswersA, C, E

Robust authentication forces callers to prove identity before reaching API logic, blocking anonymous abuse and shrinking the reachable attack surface. It is a recognised minimisation technique because unauthenticated endpoints expose parsing, business logic and data-access code to untrusted input.

Why this answer

Option A (Implement robust authentication) is correct because requiring strong, verified identity via mechanisms such as OAuth 2.0, API keys, or mTLS prevents unauthenticated or spoofed clients from reaching API endpoints, directly shrinking the set of reachable, exploitable entry points. Option C (Implement rate limiting) is correct because throttling requests per client/IP (e.g., HTTP 429 responses, token buckets) reduces the exposure window for brute-force, credential-stuffing, and abuse-based attacks, which is a core attack-surface reduction technique. Option E (Disable unused HTTP methods) is correct because turning off methods like PUT, DELETE, TRACE, or OPTIONS that the API does not need removes unnecessary verbs and handlers that attackers could otherwise probe or exploit.

Option B (Use cleartext headers for all communication) is not correct because transmitting headers in cleartext exposes credentials and tokens to interception, increasing rather than minimizing the attack surface. Option D (Expose full internal database schemas) is not correct because revealing internal schema details gives attackers structural intelligence that aids injection and enumeration attacks, which expands the attack surface instead of reducing it.

5
MCQmedium

You are auditing a web application for insecure deserialization. Which language-specific feature is most commonly the source of this vulnerability?

A.The use of internal logging
B.The use of JSON.parse()
C.The use of static typing
D.The use of native object serialization
AnswerD

Native object serialisation reconstructs arbitrary types from attacker-controlled bytes, and gadget chains in the classpath then execute during deserialisation. This language-specific mechanism, not generic parsing, is the root cause the stem's insecure deserialisation audit targets.

Why this answer

Native object serialization features (e.g., Java's ObjectInputStream, PHP's unserialize(), Python's pickle, .NET's BinaryFormatter) reconstruct objects from attacker-controlled byte streams, and if the classpath contains gadget chains, this leads directly to remote code execution. JSON.parse() only produces plain data structures (objects, arrays, primitives) with no code execution or object instantiation semantics, so it is not the classic source of insecure deserialization. The vulnerability arises because deserialization trusts the serialized data to define object state and type, which the attacker fully controls.

Exam trap

CSSLP often tests the misconception that any parsing of external data (like JSON.parse) is equivalent to deserialization, when the real risk is language-native object reconstruction that can instantiate classes and trigger gadget chains.

How to eliminate wrong answers

Option A is wrong because internal logging writes data to log sinks and does not reconstruct objects or execute code from untrusted input. Option B is wrong because JSON.parse() produces inert data structures and cannot instantiate arbitrary classes or trigger magic methods, so it is not the typical source of insecure deserialization. Option C is wrong because static typing is a compile-time safety feature that constrains types but does not itself deserialize untrusted data or create gadget-chain execution paths.

6
MCQhard

When utilizing a third-party library, what is the best strategy to minimize security risks during the build process?

A.Trust all repositories by default
B.Download libraries from the developer's website
C.Always use the 'latest' version
D.Pin dependencies to specific versions and verify hashes
AnswerD

Pinning dependencies to exact versions with verified hashes prevents a compromised or substituted package from entering the build, blocking supply-chain attacks such as typosquatting or malicious updates that floating version ranges would silently pull in.

Why this answer

Pinning dependencies to specific versions and verifying hashes ensures that the exact, known-good version of a library is used in every build, preventing unexpected updates that could introduce vulnerabilities or break functionality. Hash verification (e.g., via SHA-256 checksums) confirms the integrity of the downloaded package, guarding against tampering or supply chain attacks. This approach aligns with CSSLP principles of secure build processes and supply chain risk management.

Exam trap

CSSLP often tests the misconception that using the latest version or trusting official sources is sufficient for security, when in fact reproducibility and integrity verification are paramount.

How to eliminate wrong answers

Option A is wrong because trusting all repositories by default ignores the risk of malicious or compromised packages, a common vector for supply chain attacks. Option B is wrong because downloading libraries from the developer's website does not guarantee authenticity or integrity; the site could be compromised, or the download could be tampered with. Option C is wrong because always using the 'latest' version introduces untested and potentially vulnerable code, and breaks reproducibility, making it impossible to ensure a consistent secure state.

7
MCQhard

A developer is implementing a file upload feature in a web application. The application must allow users to upload images but prevent the execution of malicious scripts. The developer decides to validate the file extension and MIME type. Which additional security control is most effective to prevent stored cross-site scripting (XSS) via uploaded files?

A.Rename all uploaded files to a random string with a .png extension and store them in a directory within the web root.
B.Scan all uploaded files with an antivirus engine and reject any that contain suspicious patterns.
C.Use a client-side JavaScript validation to check the file's magic bytes before upload.
D.Store uploaded files outside the web root and serve them through a handler that sets the Content-Disposition header to attachment and a safe Content-Type.
AnswerD

Storing files outside the web root prevents direct execution or rendering by the web server. Serving them with Content-Disposition: attachment forces download rather than inline display, and a safe Content-Type like application/octet-stream prevents the browser from interpreting the file as HTML or script. This effectively mitigates stored XSS because even if a malicious file is uploaded, it cannot execute in the context of the site.

Why this answer

The most effective control is to store uploaded files outside the web root and serve them with headers that prevent inline rendering. This ensures that even if a malicious file is uploaded, it cannot be executed in the browser as part of the application's origin. Extension and MIME type validation alone can be bypassed, so additional measures like safe storage and serving are critical.

Exam trap

The trap here is believing that validating file extensions and MIME types is sufficient to prevent stored XSS, when attackers can bypass these checks with polyglot files or server misconfigurations.

8
MCQmedium

You are reviewing a Node.js web application. Which secure coding practice directly mitigates Cross-Site Scripting (XSS) when rendering user-supplied data in an EJS template?

A.Using <%- %> tags for all variables
B.Disabling the template engine
C.Using <%= %> tags for user data
D.Implementing a global regex filter
AnswerC

Using `<%= %>` escapes HTML entities before interpolation, neutralising injected markup so browsers treat user data as text rather than executable script. This directly satisfies the XSS mitigation requirement for EJS rendering, unlike `<%- %>`, which emits raw unescaped output and permits script injection.

Why this answer

In EJS, the <%= %> tag performs HTML entity escaping on the output, converting characters like <, >, &, and quotes into safe entities so injected markup cannot execute in the browser. This directly neutralizes the most common XSS vector — reflected or stored script tags in user-supplied data. Using escaped output is the canonical secure-coding practice for rendering untrusted content in EJS templates.

Exam trap

The trap here is confusing EJS's raw-output tag <%- %> with the escaped tag <%= %> — candidates who assume 'more explicit' or 'less processed' output is safer pick the wrong tag and enable XSS.

How to eliminate wrong answers

Option A is wrong because <%- %> renders raw, unescaped output, which is precisely the pattern that enables XSS when user data is interpolated. Option B is wrong because disabling the template engine does not mitigate XSS — it just removes the rendering layer and forces ad-hoc string concatenation, which is equally or more vulnerable. Option D is wrong because a global regex filter is a blacklist approach that is trivially bypassed with encoding tricks, unusual tags, and DOM-based vectors; it is not a substitute for contextual output encoding.

9
MCQeasy

A developer is writing code that handles sensitive cryptographic keys. The keys must be protected from unauthorized access. Which practice is most appropriate for securing cryptographic keys in the application?

A.Hard-code the keys in the source code to ensure they are always available.
B.Use a dedicated hardware security module (HSM) or key management service (KMS) to store and manage keys.
C.Encrypt the keys with a symmetric algorithm and store the encryption key in the same database.
D.Store keys in a configuration file that is checked into the version control system.
AnswerB

An HSM or KMS provides secure key storage, access control, and often key lifecycle management. Keys are never exposed in plaintext to the application; cryptographic operations are performed within the secure boundary. This is the recommended practice for protecting sensitive keys, as it prevents extraction and unauthorized use even if the application server is compromised.

Why this answer

Using a dedicated HSM or KMS is the most secure way to manage cryptographic keys. These systems provide strong access controls, audit logging, and protection against key extraction. Hard-coding, version-controlled config files, or storing encryption keys with the data are all insecure practices that can lead to key compromise.

Exam trap

The trap here is assuming that encrypting keys with a key stored in the same location provides security, when it merely obfuscates and does not protect against database compromise.

10
Multi-Selecteasy

Which THREE of the following are effective methods to prevent SQL Injection in a database-driven application?

Select 3 answers
A.Using stored procedures with dynamic SQL
B.Using parameterized queries
C.Relying solely on client-side validation
D.Applying the principle of least privilege to the database user
E.Strict input validation based on allow-lists
AnswersB, D, E

Parameterised queries send SQL code and user data as separate constructs, so supplied values are bound as literals and cannot alter query structure. This removes the injection vector at the database interface regardless of input content.

Why this answer

Option B (parameterized queries) is correct because parameterized queries (prepared statements) separate SQL code from user-supplied data, so the database engine treats input strictly as data rather than executable SQL, which neutralizes injection payloads. Option D (applying the principle of least privilege to the database user) is correct because limiting the application's database account to only the permissions it truly needs (e.g., no DROP, no xp_cmdshell, no unnecessary table access) reduces the blast radius if an injection flaw is ever exploited. Option E (strict input validation based on allow-lists) is correct because allow-list validation rejects any input that does not match an expected, tightly defined pattern, preventing malicious characters or payloads from ever reaching the SQL layer.

Option A is not correct because stored procedures that internally build dynamic SQL strings via concatenation remain vulnerable to injection; stored procedures are only safe when they themselves use parameterization. Option C is not correct because client-side validation can be trivially bypassed by an attacker using a proxy or direct HTTP requests, so it must never be the sole defense against SQL injection.

Exam trap

The trap is the word 'dynamic SQL' inside stored procedures — candidates assume stored procedures are automatically safe, but dynamic SQL built by concatenation inside a procedure is just as injectable as inline SQL.

11
MCQeasy

When conducting a static code analysis for a C++ application, which memory management error is best detected by tools like Fortify or Coverity?

A.Database connection timeout
B.Business logic flaws
C.Buffer overflow
D.Zero-day authentication bypass
AnswerC

Static analysis engines model pointer arithmetic and array bounds, flagging writes beyond allocated buffers. Buffer overflow is a memory-safety defect detectable from source alone, unlike runtime-only faults, so Fortify or Coverity identify it during code review before compilation or execution.

Why this answer

Buffer overflow is a memory safety vulnerability that arises from improper bounds checking on arrays or pointer arithmetic, leading to out-of-bounds writes. Static analysis tools like Fortify and Coverity use data flow analysis and taint tracking to identify such patterns by examining array indices, pointer dereferences, and memory copy operations. They can flag potential overflows without executing the code, making it a prime target for static analysis in C++ applications.

Exam trap

CSSLP often tests the distinction between static analysis capabilities and runtime or logic issues, causing candidates to confuse memory management errors with other vulnerability types.

How to eliminate wrong answers

Option A is wrong because database connection timeouts are runtime issues related to network or configuration, not memory management errors detectable by static code analysis. Option B is wrong because business logic flaws are semantic errors that require understanding of application requirements and cannot be reliably detected by static analysis tools focused on memory safety. Option D is wrong because zero-day authentication bypasses are typically logic or design flaws that static analysis tools may not catch, as they often involve complex attack vectors and are not specific to memory management.

12
MCQmedium

You are configuring a Content Security Policy (CSP) for a web application. Which directive should be used to restrict the sources from which scripts can be loaded?

A.style-src
B.script-src
C.img-src
D.connect-src
AnswerB

The script-src directive whitelists origins permitted to supply executable JavaScript, blocking inline and untrusted external scripts. It is the specific CSP control governing script loading sources, directly satisfying the requirement to restrict where scripts may be fetched from.

Why this answer

The script-src directive in a Content Security Policy controls which sources are permitted to load and execute JavaScript. It is the primary defense against cross-site scripting (XSS) and malicious script injection, restricting scripts to trusted origins, nonces, or hashes. Other directives govern different resource types and do not affect script loading.

Exam trap

The trap is confusing CSP directives that sound similar — candidates may pick connect-src or style-src because they don't recall that script-src specifically governs JavaScript execution sources.

How to eliminate wrong answers

Option A is wrong because style-src governs stylesheets (CSS), not scripts. Option C is wrong because img-src governs image sources, not scripts. Option D is wrong because connect-src governs fetch/XHR/WebSocket/EventSource destinations, not script loading.

13
MCQmedium

A security architect is reviewing the design of a new web application. The application must ensure that session identifiers are unpredictable and resistant to guessing attacks. The development team proposes using a random number generator. Which approach should the architect recommend to meet this requirement?

A.Use a sequential counter combined with a secret salt, and store the counter in a client-side cookie.
B.Generate session identifiers by hashing the current timestamp and the user's IP address using MD5.
C.Use a cryptographically secure pseudo-random number generator (CSPRNG) seeded with a high-entropy source, such as the operating system's entropy pool.
D.Use the language's standard random number generator, such as java.util.Random or rand() in C, because it is fast and sufficient for generating session IDs.
AnswerC

A CSPRNG is designed to produce output that is computationally infeasible to predict, even if previous outputs are known. Seeding it with a high-entropy source like /dev/urandom or CryptGenRandom ensures unpredictability. This directly satisfies the requirement for session identifiers that resist guessing attacks, as opposed to general-purpose random functions that may have predictable patterns.

Why this answer

Session identifiers must be generated using a cryptographically secure pseudo-random number generator (CSPRNG) seeded with high entropy to ensure unpredictability. This prevents attackers from guessing or predicting valid session IDs. Other methods, such as standard random generators or predictable data hashing, lack the necessary security properties and can lead to session hijacking.

Exam trap

The trap here is assuming that any random number generator is sufficient for security purposes, when only a CSPRNG provides the unpredictability required for session identifiers.

14
MCQeasy

A developer is using OWASP Dependency-Check to scan a Java application. Which configuration parameter should be utilized to ignore specific false-positive vulnerabilities identified in a third-party library?

A.--ignore-cve
B.--exclude-all
C.--skip-analysis
D.--suppression
AnswerD

The --suppression flag accepts an XML file listing false-positive identifiers, causing Dependency-Check to omit those matches from reported findings. This directly satisfies the stem's constraint of ignoring specific false-positive vulnerabilities in a third-party library without disabling broader detection.

Why this answer

OWASP Dependency-Check supports a suppression mechanism via XML suppression files that tell the scanner to ignore specific false-positive CVEs for identified dependencies. The --suppression <file> parameter points the tool at that XML file, allowing teams to document and exclude known false positives without disabling scanning entirely. This preserves coverage while reducing noise in CI/CD pipelines.

Exam trap

The trap is assuming a generic-sounding flag like --ignore-cve exists, when Dependency-Check's actual false-positive handling is file-based suppression via --suppression.

How to eliminate wrong answers

Option A is wrong because --ignore-cve is not a valid Dependency-Check CLI option; there is no flag that ignores CVEs by identifier directly on the command line. Option B is wrong because --exclude-all is not a real parameter and would conceptually defeat the purpose of scanning by excluding everything. Option C is wrong because --skip-analysis is not a Dependency-Check option; skipping analysis would bypass the vulnerability check rather than selectively suppress false positives.

15
MCQhard

In a Java Spring Boot application, which configuration prevents Cross-Site Request Forgery (CSRF) for state-changing HTTP requests?

A.Set the Content-Type header to application/json
B.Use a stateless session strategy with no tokens
C.Configure the HttpSecurity object to require CSRF tokens
D.Enable csrf().disable() in the SecurityFilterChain
AnswerC

Spring Security's HttpSecurity CSRF configuration enforces synchroniser tokens on state-changing methods (POST, PUT, DELETE), rejecting requests lacking a valid token. This directly satisfies the stem's requirement to prevent CSRF on state-changing HTTP requests in the Spring Boot application.

Why this answer

In Spring Security, CSRF protection is enabled by default and is configured through the HttpSecurity object; explicitly requiring CSRF tokens (via csrf() configuration with a CsrfTokenRepository) ensures state-changing requests (POST/PUT/DELETE) must present a valid token tied to the user's session. This prevents an attacker's forged cross-site request from succeeding because the attacker cannot read the victim's token.

Exam trap

The trap is that candidates see 'stateless' or 'JSON' and assume those inherently prevent CSRF — but CSRF defense specifically requires a token mechanism, and disabling CSRF (option D) is the classic wrong answer that sounds like a fix.

How to eliminate wrong answers

Option A is wrong because setting Content-Type to application/json does not prevent CSRF — browsers can still send cross-origin requests with that content type, and CSRF is about the browser automatically attaching credentials, not the content type. Option B is wrong because a stateless session with no tokens removes the very mechanism (session-bound token) that CSRF defense relies on; stateless APIs must use alternative protections like SameSite cookies or custom headers. Option D is wrong because csrf().disable() explicitly turns off CSRF protection, which is the opposite of what is required — it is only acceptable for stateless APIs using token-based auth.

16
MCQmedium

When developing a microservice using gRPC, which mechanism is recommended for authenticating service-to-service communication?

A.HTTP Basic Auth
B.Mutual TLS (mTLS)
C.IP allow-listing
D.Shared API keys in headers
AnswerB

Mutual TLS authenticates both client and server through X.509 certificates during the TLS handshake, satisfying gRPC's requirement for strong service-to-service authentication without shared secrets. Each microservice verifies the other's certificate, providing cryptographic identity and encrypted transport, which suits machine-to-machine communication where no interactive user exists to supply credentials.

Why this answer

Mutual TLS (mTLS) is the recommended mechanism for gRPC service-to-service authentication because gRPC is built on HTTP/2 over TLS, and mTLS provides bidirectional certificate-based authentication of both client and server. Each service presents a certificate, so the caller verifies the callee's identity and vice versa, and the channel is encrypted end-to-end. This aligns with zero-trust principles and is natively supported by gRPC's channel credentials without application-layer token handling.

Exam trap

CSSLP often tests the difference between transport-layer mutual authentication and application-layer credentials — candidates pick API keys (D) because they are familiar, missing that mTLS provides cryptographic identity binding that static keys cannot.

How to eliminate wrong answers

Option A is wrong because HTTP Basic Auth sends base64-encoded credentials on every request, offers no mutual authentication, and is trivially replayable if the channel is compromised — it is unsuitable for service-to-service trust. Option C is wrong because IP allow-listing is network-layer and easily defeated by spoofing, compromised hosts, or lateral movement within a cluster where pod IPs are dynamic. Option D is wrong because shared API keys are static, long-lived, and provide no identity binding — if one service is compromised, the key grants access to every service that trusts it, and rotation is operationally painful.

17
MCQeasy

Which standard security practice should be applied to all passwords stored in a database?

A.Encryption with a symmetric key
B.Storing in a configuration file
C.Hashing with a unique salt per user
D.Base64 encoding
AnswerC

A unique per-user salt defeats rainbow tables and ensures identical passwords produce different digests, while hashing remains one-way. This satisfies the stem's requirement for the standard practice applied to all stored passwords, unlike encryption, which is reversible.

Why this answer

The correct practice is to hash passwords with a unique salt per user. Hashing is a one-way function that transforms the password into a fixed-length digest, making it infeasible to reverse. A unique salt per user prevents attackers from using precomputed rainbow tables and ensures that identical passwords produce different hashes.

This is a fundamental requirement in standards like NIST SP 800-63B and OWASP ASVS.

Exam trap

CSSLP often tests the misconception that encryption is always better than hashing for password storage, but encryption is reversible and thus unsuitable; hashing with salt is the only correct method.

How to eliminate wrong answers

Option A is wrong because encryption with a symmetric key is reversible; if the key is compromised, all passwords can be decrypted. Option B is wrong because storing passwords in a configuration file (even if encrypted) is insecure, as the file may be accessible to unauthorized users or included in backups. Option D is wrong because Base64 encoding is a reversible encoding, not a security measure; it provides no confidentiality and can be trivially decoded.

18
MCQmedium

In an OAuth2 flow, what is the purpose of the 'state' parameter?

A.To prevent CSRF attacks
B.To store the user's password
C.To track the user's location
D.To encrypt the access token
AnswerA

The 'state' parameter carries an opaque value the client generates and returns with the authorisation response. The client verifies it matches the value it sent, binding the response to its own request and blocking cross-site request forgery attacks that would otherwise inject a forged authorisation code.

Why this answer

The 'state' parameter in OAuth2 is an opaque value generated by the client and returned unchanged by the authorization server in the redirect. The client verifies that the returned state matches the value it sent, which binds the authorization response to the user's session and prevents cross-site request forgery (CSRF) attacks where an attacker tricks a victim into submitting an attacker's authorization code.

Exam trap

The trap is confusing the state parameter with token security mechanisms; CSSLP tests whether you know that state is specifically an anti-CSRF measure, not a password store, location tracker, or encryption mechanism.

How to eliminate wrong answers

Option B is wrong because OAuth2 never uses the state parameter to store passwords; passwords are handled by the authorization server's login UI and are never passed through the state parameter. Option C is wrong because tracking user location is unrelated to OAuth2's state parameter; geolocation is not part of the OAuth2 specification. Option D is wrong because the state parameter does not encrypt the access token; token confidentiality is provided by TLS and, in some flows, by token encryption mechanisms like JWE, not by the state parameter.

19
Multi-Selectmedium

Which THREE of the following are best practices for the secure use of third-party libraries?

Select 3 answers
A.Automatically update to the latest version without testing
B.Monitor for vulnerability disclosures
C.Perform security audits on third-party code
D.Store all third-party code in the public root folder
E.Pin library versions to avoid unexpected changes
AnswersB, C, E

Continuous monitoring of vulnerability disclosures for third-party libraries satisfies the stem's requirement to manage inherited risk after integration. Feeds such as the National Vulnerability Database, vendor advisories and software composition analysis alerts identify newly published CVEs affecting pinned versions, enabling timely patching before attackers exploit known flaws in deployed dependencies.

Why this answer

Option B is correct because continuously monitoring for vulnerability disclosures (e.g., via CVE feeds, NVD, or dependency-scanning tools like OWASP Dependency-Check or Snyk) lets teams learn about and remediate known flaws in third-party libraries before attackers exploit them. Option C is correct because performing security audits on third-party code — reviewing the library's source, license, and security posture (e.g., static analysis, SBOM review) — verifies that the dependency does not introduce vulnerabilities or malicious code into the application. Option E is correct because pinning library versions (e.g., exact versions in package.json, requirements.txt, or lock files) prevents unexpected changes or supply-chain attacks from silently pulling in a compromised or incompatible newer release.

Option A is not a best practice because automatically updating to the latest version without testing can introduce breaking changes or newly disclosed vulnerabilities and bypasses change control. Option D is not a best practice because storing third-party code in the public root folder exposes it to direct web access, potentially leaking source code or enabling exploitation of unauthenticated endpoints.

20
MCQmedium

You are reviewing code and find a hardcoded API key. Which security control should be implemented to securely manage this secret?

A.Use a secret management service
B.Store it in a public environment variable
C.Add it to the .gitignore file
D.Obfuscate the key in the code
AnswerA

A secret management service stores the API key outside source code and injects it at runtime, removing the hardcoded credential from the repository. This satisfies the requirement to manage the secret securely, enabling rotation and access auditing.

Why this answer

A dedicated secret management service (e.g., HashiCorp Vault, AWS Secrets Manager, Azure Key Vault) stores secrets encrypted, controls access via identity and policy, supports rotation and auditing, and keeps secrets out of source code entirely. This is the correct control because it addresses the root cause — secrets embedded in code — rather than masking the symptom. It also enables centralized revocation and rotation when a key is compromised.

Exam trap

CSSLP often tests the misconception that hiding a secret in code or an environment variable is sufficient protection, when the only correct control is a dedicated secret management service that provides encryption, access control, and rotation.

How to eliminate wrong answers

Option B is wrong because a public environment variable exposes the secret to anyone with access to the environment, logs, or process listings, and 'public' explicitly removes any confidentiality protection. Option C is wrong because adding a file to .gitignore only prevents future commits of that file — it does not remove the secret from existing git history, does not protect the secret at runtime, and does not provide access control or rotation. Option D is wrong because obfuscating a key in code (e.g., base64 or string concatenation) is security through obscurity; the key remains in the codebase and can be trivially recovered by anyone who reads the source.

21
Multi-Selecteasy

Which TWO of the following are essential components of a Secure Software Development Lifecycle (SSDLC)?

Select 2 answers
A.Hardware procurement
B.Marketing strategies
C.Security requirements definition
D.Threat modeling
E.Unlimited project budget
AnswersC, D

Security requirements definition establishes the protective and compliance obligations the software must satisfy before design begins, making it an essential SSDLC component. Without it, later design, coding and testing activities lack measurable security criteria to verify against, so requirements cannot be traced or validated.

Why this answer

Security requirements definition (C) is essential because the SSDLC must capture security and privacy requirements alongside functional requirements early in the lifecycle, so that controls such as authentication, encryption, and compliance obligations are designed in rather than bolted on later. Threat modeling (D) is essential because it systematically identifies potential threats, attack surfaces, and mitigations (e.g., using STRIDE or DREAD) during design, allowing architects to address risks before code is written. The other options do not belong: hardware procurement (A) is an infrastructure/logistics activity rather than a software security practice, marketing strategies (B) concern business promotion and are unrelated to secure development, and an unlimited project budget (E) is neither a security control nor a realistic or necessary SSDLC component.

Exam trap

The trap is selecting non-security activities (like hardware procurement or marketing) as SSDLC components, confusing general project management with security-specific practices.

22
MCQhard

During a peer code review, you find a function that constructs an OS command using user input. What is the most secure way to handle this?

A.Run the command as a root user
B.Use built-in language APIs instead of shell commands
C.Sanitize the input with a blacklist
D.Escape the input with shell-specific characters
AnswerB

Built-in language APIs avoid invoking a shell, so user input cannot be interpreted as command syntax. This eliminates OS command injection at its source, satisfying the requirement to handle untrusted input securely rather than relying on escaping or sanitisation of shell metacharacters.

Why this answer

The most secure way to handle user input that would otherwise be used to construct an OS command is to avoid shell invocation entirely and use built-in language APIs that perform the desired operation (e.g., file I/O, process spawning with argument arrays). This eliminates the shell interpreter and the possibility of command injection, because user input is passed as data, not parsed as shell syntax. Sanitization and escaping are fallback mitigations that are error-prone and shell-specific.

Exam trap

The trap is believing that input sanitization or escaping is sufficient, when the truly secure approach is to eliminate shell invocation by using built-in language APIs that treat input as data.

How to eliminate wrong answers

Option A is wrong because running the command as root violates least privilege and dramatically increases the impact of any command injection or compromise; it does not address the injection flaw itself. Option C is wrong because blacklist sanitization is inherently incomplete: attackers can use encoding, alternate delimiters, or shell-specific syntax not covered by the blacklist, and new bypasses are discovered regularly. Option D is wrong because escaping with shell-specific characters is fragile and depends on correctly identifying every dangerous metacharacter for the target shell (bash, sh, cmd.exe, PowerShell), and mistakes lead to injection; it is a defense-in-depth measure, not the primary fix.

23
MCQhard

A developer is using parameterized queries in C#. Which vulnerability is primarily prevented by this implementation?

A.Session Hijacking
B.SQL Injection
C.Insecure Deserialization
D.Directory Traversal
AnswerB

Parameterised queries send SQL code and user data to the database as separate entities, so supplied values are treated purely as data rather than executable statements. This prevents attackers from altering query structure, directly blocking SQL Injection, the vulnerability named in the stem.

Why this answer

Parameterized queries (prepared statements) separate SQL code from data by sending the query structure to the database first and binding user input as parameters, so input is never interpreted as SQL syntax. This structurally prevents SQL injection, the top web vulnerability class, regardless of what characters the attacker supplies.

Exam trap

The trap is confusing SQL injection with other injection or session-based attacks — candidates must recognize that parameterized queries specifically neutralize SQLi by separating code from data, not by sanitizing characters.

How to eliminate wrong answers

Option A is wrong because session hijacking involves stealing or predicting session tokens (e.g., via XSS or insecure cookies), which parameterized queries do nothing to address. Option C is wrong because insecure deserialization concerns untrusted serialized objects being reconstructed into executable code, unrelated to SQL statement construction. Option D is wrong because directory traversal exploits file path handling (../ sequences), not database query parsing.

24
Multi-Selectmedium

A development team is implementing input validation for a web application. They want to ensure that all user-supplied data is properly sanitized to prevent injection attacks. Which TWO of the following are effective techniques for input validation? (Choose two.)

Select 2 answers
A.Use a blacklist of known malicious characters and remove them from the input.
B.Store all user input in a database without modification and rely on database triggers to sanitize data.
C.Rely on client-side JavaScript validation to ensure data integrity before submission.
D.Encode output based on the context where it will be displayed, such as HTML, JavaScript, or SQL.
E.Use a whitelist of allowed characters and reject any input that does not match.
AnswersD, E

Output encoding ensures that data is safely rendered in the target context. For HTML, encoding special characters like < and > prevents script execution; for SQL, parameterized queries handle encoding. While not strictly input validation, output encoding is a critical complementary control that prevents injection even if malicious input is stored. It is effective because it neutralizes dangerous characters at the point of use.

Why this answer

Whitelist validation and context-aware output encoding are two fundamental techniques for preventing injection attacks. Whitelisting ensures only expected data is accepted, while output encoding neutralizes dangerous characters when data is rendered. Together, they provide strong defense against injection.

Blacklisting, client-side validation, and deferred sanitization are less effective and can be bypassed.

Exam trap

The trap here is thinking that blacklisting malicious characters or relying on client-side validation provides adequate security, when these methods are easily bypassed and do not address the root cause.

25
Multi-Selectmedium

Which THREE of the following practices contribute to secure configuration of a web server?

Select 3 answers
A.Remove default files and pages
B.Allow all HTTP methods (TRACE, OPTIONS)
C.Enable verbose error reporting
D.Disable directory listing
E.Enforce HTTPS (TLS)
AnswersA, D, E

Removing default files and pages eliminates vendor-supplied sample scripts, documentation and administrative interfaces that ship enabled by default. These artefacts frequently expose known paths, version details or unauthenticated functionality, directly satisfying the stem's secure-configuration requirement by reducing the attack surface before any application code is deployed.

Why this answer

Option A is correct because removing default files and pages (e.g., Apache's /var/www/html/index.html, IIS's iisstart.htm, or sample scripts like phpinfo.php) eliminates well-known entry points and information-disclosure vectors that attackers routinely probe. Option D is correct because disabling directory listing (Apache's Options -Indexes or nginx's autoindex off) prevents the server from exposing file and folder names that could reveal sensitive resources or aid reconnaissance. Option E is correct because enforcing HTTPS with TLS (e.g., via HSTS and redirecting port 80 to 443) protects credentials and session data from interception and man-in-the-middle attacks, which is a core secure-configuration requirement.

Option B is wrong because allowing all HTTP methods such as TRACE and OPTIONS enables cross-site tracing and method enumeration; these should be restricted to only those required (typically GET, POST, HEAD). Option C is wrong because verbose error reporting leaks stack traces, file paths, and server versions that assist attackers; production servers should return generic error messages and log details server-side instead.

26
MCQeasy

Which cryptographic practice is recommended for protecting sensitive data at rest in a relational database?

A.Using cleartext with database permissions
B.Using MD5 hashing
C.Using AES-256 encryption
D.Storing data in base64 encoding
AnswerC

AES-256 is a symmetric block cipher providing strong confidentiality for stored data, satisfying the at-rest protection requirement. Its 256-bit key resists brute-force attacks, and it is the standard algorithm for database and volume encryption, unlike hashing or asymmetric ciphers suited to other purposes.

Why this answer

AES-256 is a symmetric block cipher approved by NIST (FIPS 197) and is the standard recommendation for encrypting data at rest in databases, offering strong confidentiality with acceptable performance. It is used in modes like GCM or CBC with proper key management (e.g., KMS, HSM) to protect sensitive fields, tablespaces, or full-disk volumes.

Exam trap

The trap here is confusing encoding (Base64), hashing (MD5), and encryption (AES) — candidates who see 'protect data' and pick MD5 forget that hashing is one-way and cannot protect data that must be read back.

How to eliminate wrong answers

Option A is wrong because cleartext storage relies solely on database permissions, which fail the moment an attacker gains OS-level access, steals a backup, or exploits an application flaw — confidentiality is not provided. Option B is wrong because MD5 is a broken, fast hash (collisions demonstrated in 2004) designed for integrity, not confidentiality; it is not reversible encryption and cannot protect data at rest. Option D is wrong because Base64 is a reversible encoding, not encryption — anyone can decode it with a single command, so it offers zero confidentiality.

27
Multi-Selecthard

Which TWO of the following are required to successfully implement a secure logging mechanism?

Select 2 answers
A.Log every single user mouse movement
B.Send logs to a publicly accessible bucket
C.Filter sensitive data before logging
D.Store logs in a tamper-evident system
E.Disable all logging to improve performance
AnswersC, D

Filtering sensitive data before logging prevents credentials, tokens and personal information entering log stores, satisfying the secure logging requirement that records must not become a confidentiality liability. Without this control, logs themselves leak the very data the application protects.

Why this answer

Option C is correct because filtering sensitive data (e.g., passwords, PII, tokens, credit-card numbers) before it is written to logs prevents confidential information from being exposed in log files, which is a core requirement of a secure logging mechanism and aligns with standards like PCI DSS and GDPR. Option D is correct because storing logs in a tamper-evident system (e.g., append-only storage, write-once buckets, cryptographic hashing/chaining, or a SIEM with integrity controls) ensures that attackers cannot alter or delete records to hide their activity, preserving the logs' evidentiary value for auditing and incident response. Option A is not required and would generate excessive noise and storage costs while providing little security value.

Option B is wrong because sending logs to a publicly accessible bucket exposes potentially sensitive data to unauthorized parties. Option E is wrong because disabling logging removes the very visibility needed for detection, investigation, and compliance.

28
Multi-Selectmedium

Which TWO of the following are effective strategies to prevent Cross-Site Scripting (XSS)?

Select 2 answers
A.Relying on antivirus software
B.Disabling cookies
C.Using insecure HTML comments
D.Using a Content Security Policy (CSP)
E.Context-aware output encoding
AnswersD, E

A Content Security Policy restricts which script sources the browser will execute, so injected inline or third-party scripts are blocked even when output encoding fails. This defence-in-depth directly mitigates XSS by constraining the rendering context.

Why this answer

Option D, using a Content Security Policy (CSP), is correct because CSP is an HTTP response header (e.g., Content-Security-Policy: default-src 'self') that restricts which sources of scripts, styles, and other resources the browser may load, thereby blocking inline script execution and mitigating reflected and stored XSS even if an injection occurs. Option E, context-aware output encoding, is correct because encoding untrusted data according to its output context (HTML entity encoding for HTML body, JavaScript escaping for script blocks, attribute encoding for HTML attributes, URL encoding for URLs) ensures injected characters are rendered as inert text rather than executable markup or script, which is the primary defense against XSS. Option A, relying on antivirus software, is not appropriate because antivirus operates on the client endpoint and cannot reliably detect or block browser-executed script injections delivered through web applications.

Option B, disabling cookies, does not prevent XSS; it only removes one target of session theft and may break application functionality, while the injected script still executes in the victim's browser. Option C, using insecure HTML comments, is not a security control at all and can even worsen exposure by leaving sensitive data or code in page source.

Exam trap

CSSLP often tests the misconception that client-side or session-level controls (antivirus, disabling cookies) prevent XSS, when the real defenses are server-side output encoding and browser-enforced CSP.

29
MCQmedium

A developer is implementing a REST API. To prevent Mass Assignment vulnerabilities, what should be enforced during the model binding process?

A.Use Data Transfer Objects (DTOs) to restrict input
B.Disable SSL on the API endpoint
C.Increase the request timeout
D.Store user passwords in plaintext
AnswerA

DTOs define an explicit allow-list of bindable properties, so the model binder cannot populate fields absent from the DTO. This directly blocks over-posting of sensitive attributes such as role or isAdmin, satisfying the requirement to prevent Mass Assignment during model binding.

Why this answer

Mass assignment occurs when an attacker submits extra fields (e.g., isAdmin=true) that the framework blindly binds to the model. Using Data Transfer Objects (DTOs) restricts binding to only the fields the API intends to accept, so unexpected properties are ignored. This enforces an explicit allow-list at the model-binding layer, which is the recommended defense in frameworks like Spring, Rails, and ASP.NET.

Exam trap

The trap here is confusing input validation with binding restriction — candidates may pick 'strict input validation' style answers, but mass assignment is specifically about which fields the framework binds, not whether values are well-formed.

How to eliminate wrong answers

Option B is wrong because disabling SSL would expose credentials and data in transit, worsening security rather than preventing mass assignment. Option C is wrong because request timeout has no relationship to which fields get bound to a model. Option D is wrong because storing passwords in plaintext is a separate, severe vulnerability (violates hashing best practices) and does nothing to prevent mass assignment.

30
MCQeasy

What is the primary security benefit of using a hardened container base image for microservices?

A.It reduces the attack surface
B.It increases execution speed
C.It automatically encrypts application logs
D.It eliminates the need for patching
AnswerA

A hardened base image strips unnecessary packages, shells, package managers and services, so fewer binaries carry exploitable vulnerabilities. Any compromise gains fewer local tools for privilege escalation or lateral movement, directly reducing the attack surface available to an attacker inside the container.

Why this answer

A hardened container base image removes unnecessary packages, services, shells, and default credentials, reducing the number of potential vulnerabilities and entry points an attacker can exploit. This directly shrinks the attack surface, which is the primary security benefit. Hardening does not inherently improve speed, encrypt logs, or remove the need for patching.

Exam trap

The trap is selecting a non-security benefit (speed, log encryption, no patching) that sounds plausible but does not reflect the actual purpose of hardening, which is attack surface reduction.

How to eliminate wrong answers

Option B is wrong because execution speed is a performance characteristic, not a security benefit, and hardening may even slightly reduce speed by removing convenience tools. Option C is wrong because log encryption is a separate control (e.g., via logging drivers or sidecars) and is not provided by base image hardening. Option D is wrong because hardened images still require patching; in fact, they must be rebuilt and repatched regularly to remain secure.

31
MCQhard

A developer is using an ORM (Object-Relational Mapping) framework. What risk remains even when using built-in ORM features?

A.Cross-Site Scripting
B.Brute force attacks
C.Buffer overflows
D.SQL Injection through unsafe raw queries
AnswerD

ORM parameterisation only protects generated queries; developers can still concatenate user input into raw SQL executed through the framework's escape hatch. That unsafe raw query path preserves classic SQL Injection, the residual risk the question asks about.

Why this answer

Even with ORMs, developers can introduce SQL injection if they dynamically construct queries using string concatenation inside the ORM's raw query methods.

32
MCQhard

When implementing file uploads, which practice is most effective in preventing remote code execution (RCE)?

A.Storing files outside the web root and renaming them
B.Checking the file size
C.Validating the file extension only
D.Enabling execution permissions on the upload folder
AnswerA

Storing uploads outside the web root removes the path the web server would use to execute them, while renaming strips the original extension and any embedded executable code trigger. Together these defeat RCE because the server can no longer map the file to a script handler, satisfying the constraint that uploaded content must never be directly executable.

Why this answer

Renaming files and storing them outside the web root prevents attackers from executing malicious scripts they have uploaded.

Ready to test yourself?

Try a timed practice session using only Secure Software Implementation questions.