8.5 Secure Coding Standards & Practices

CISSP Domain 8 ยท Software Development Security

8.5 Secure Coding Standards & Practices

Secure software should not depend on every developer independently remembering every possible vulnerability.

Organisations reduce software risk by defining repeatable coding rules, approved security patterns, safe APIs and programmable security controls that make common weaknesses harder to introduce.

CISSP 8.5 focuses on four explicit areas: source-code weaknesses and vulnerabilities, API security, secure coding practices, and software-defined security.

The central idea is: prevent predictable weakness patterns during implementation instead of relying only on testing to discover them later.

๐Ÿงฉ

Know the Weakness

Understand how unsafe source patterns become exploitable vulnerabilities.

RECOGNISE THE PATTERN
๐Ÿ”Œ

Secure the Interface

Authenticate, authorize, validate and constrain every API interaction.

EVERY ENDPOINT IS A TRUST BOUNDARY
๐Ÿ“

Standardise the Safe Way

Give developers actionable, testable rules and approved security patterns.

MAKE SECURE THE DEFAULT
Current CISSP 8.5 Scope

Define and Apply Secure Coding Guidelines and Standards

The current ISC2 CISSP Exam Outline explicitly contains four subtopics.

Security Weaknesses and Vulnerabilities at the Source-Code Level

Recognise implementation patterns that can create exploitable software weaknesses.

Security of Application Programming Interfaces - API

Protect machine-to-machine and application interfaces with strong authentication, authorization, validation, resource controls and secure data handling.

Secure Coding Practices

Apply consistent rules and patterns for validation, encoding, authentication, authorization, cryptography, errors, secrets, memory and other implementation concerns.

Software-Defined Security

Express and enforce security capabilities through programmable software, policy and automation rather than relying only on fixed or manually configured controls.

Official 8.5 Topics

WEAKNESSWhat can go wrong in code?
APIHow do interfaces enforce trust?
PRACTICEHow should developers code?
SOFTWARE-DEFINEDHow can security be programmed?
CWE, OWASP API Security Top 10, OWASP Secure Coding Practices and CERT standards are supporting references used to teach these four official ISC2 topics. They are not additional ISC2 8.5 sub-bullets.
Domain 8 Map

Where 8.5 Fits

8.1 SDLC

Integrate security throughout development.

WHEN?

8.2 Development Ecosystem

Secure languages, libraries, tools, repositories and testing.

WHERE & WITH WHAT?

8.3 Security Effectiveness

Determine whether software-security activities actually work.

DOES IT WORK?

8.4 Acquired Software

Assess externally supplied software and services.

WHO BUILT / RUNS IT?

8.5 Secure Coding

Prevent implementation weaknesses through secure rules and patterns.

HOW SHOULD CODE BE WRITTEN?

Foundation

Weakness vs Vulnerability

Weakness

A flaw, error or condition in software design or implementation that can contribute to security problems.

Think: CWE category or weakness type.

Vulnerability

A weakness present in a real product or system under conditions that create exploitable or otherwise meaningful security exposure.

Think: specific vulnerable implementation.

Unsafe Coding Pattern โ†’ Weakness
Weakness + Reachable Context โ†’ Vulnerability
Vulnerability + Threat โ†’ Exploit / Security Impact
Secure coding tries to stop the weakness before it becomes a vulnerability in a deployed product.
๐Ÿงฌ CWE vs CVE Weakness type vs specific disclosed vulnerability
CWE - Common Weakness Enumeration

A taxonomy of recurring software and hardware weakness types.

SQL Injection Out-of-Bounds Write Missing Authorization Path Traversal
CVE - Common Vulnerabilities and Exposures

Identifies specific publicly disclosed vulnerabilities in real products.

CWE helps explain the type of mistake. CVE identifies a particular vulnerability instance.

Common Source-Level Weakness Families

Input Handling

Improper validation, unsafe canonicalization and unexpected data reaching sensitive operations.

Injection

Untrusted data changes the meaning of SQL, OS commands, code, templates or other interpreters.

Output Handling

Untrusted data is rendered into HTML, JavaScript, URLs or other contexts without appropriate encoding.

Authorization

The application fails to verify whether the caller may access the requested object, function or property.

Authentication & Sessions

Identity verification, token handling, reset flows or session lifecycle are implemented incorrectly.

Memory Safety

Out-of-bounds reads/writes, use-after-free and similar lifetime or bounds errors.

Integer / Numeric Errors

Overflow, underflow, truncation or signed/unsigned confusion changes security-sensitive logic or allocation.

Race Conditions

Security assumptions change between separate operations performed on shared state.

File Handling

Unsafe upload, pathname handling, temporary files or permissions expose data or executable content.

Serialization

Untrusted data is transformed into internal object state through unsafe deserialization mechanisms.

Error Handling

Failures disclose sensitive internals or leave the application in an unsafe state.

Secrets & Cryptography

Credentials are embedded in source or cryptographic mechanisms are selected/used incorrectly.

Secure Coding Practice

Input Validation

Input validation checks whether data has the properties the application expects before the data is trusted or used.

Type

Is this actually an integer, date, identifier, filename or other expected data type?

Length

Is the input within reasonable minimum and maximum sizes?

Range

Is the numeric or temporal value inside permitted bounds?

Format

Does the data conform to the expected structure?

Allowlist

Where practical, accept known valid forms rather than trying to enumerate every malicious form.

Business Rule

A syntactically valid value can still be invalid for the business operation.

Canonical Form

Normalize or resolve equivalent representations before security decisions where needed.

Server-Side Enforcement

Client-side validation improves usability but must not be trusted as the only security control.

Validate what the application expects - not merely what known attacks look like.
Important Distinction

Validate vs Sanitize vs Encode

ControlQuestionExample
ValidateIs this input acceptable?Customer age must be an integer from 0 to 120.
SanitizeCan unsafe or unwanted elements be transformed or removed safely?Removing unsupported markup from allowed rich text.
EncodeHow should data be represented safely in this output context?HTML-encode untrusted text before inserting it into HTML content.
There is no universal "sanitize()" function that makes arbitrary untrusted data safe for every destination.
Source-Level Weakness

Injection

Injection occurs when untrusted data is allowed to change the structure or meaning of instructions sent to an interpreter.

Untrusted Data โ†’ String Concatenation
Concatenated String โ†’ Interpreter
Interpreter โ†’ Attacker-Controlled Meaning
SQL Injection

User-controlled data changes a database command.

OS Command Injection

User-controlled data changes a shell or operating-system command.

Code Injection

User-controlled data becomes executable code or script.

Template / Expression Injection

Untrusted data is interpreted by a template or expression engine as instructions.

The preferred pattern is usually to keep code and data structurally separate rather than attempting to remove every dangerous character.
๐Ÿ—„๏ธ SQL Injection - Think Parameterization Keep data separate from query syntax
Unsafe concept

Build a SQL statement by concatenating an account number supplied by the caller.

Safer concept

Use a parameterized query or prepared statement so the database receives query structure separately from the untrusted value.

Input validation is still useful for business correctness, but it should not replace structural separation of SQL code and data.
Source-Level Weakness

Cross-Site Scripting - XSS

XSS occurs when attacker-controlled data is rendered into browser content in a way that allows it to become executable script or otherwise change the intended page structure.

Output Encoding

Encode untrusted data according to the exact destination context.

Safe Templates

Prefer frameworks with secure contextual encoding enabled by default.

Avoid Dangerous Sinks

Reduce use of APIs that interpret strings as HTML or script.

Content Security Policy

Can provide defense in depth but should not replace correct output handling.

Rich Text

When HTML is intentionally allowed, use a well-maintained allowlist-based sanitizer designed for that purpose.

Stored vs Reflected

Whether data is persisted or immediately reflected changes the path, not the fundamental output-trust problem.

Path Traversal & File Handling

Path Traversal

Do not allow external path elements to escape the intended storage root.

Canonicalization

Resolve path representation carefully before applying security checks where necessary.

File Upload

Validate expected type/size and treat uploaded content as untrusted.

Storage Location

Avoid storing untrusted uploads where they automatically become executable.

Generated Names

Use server-controlled storage identifiers rather than blindly trusting supplied filenames.

Permissions

Run file-processing components with only the access they require.

Source-Level Weakness

Memory-Safety Weaknesses

Languages that expose direct memory management can permit classes of weakness that are difficult or impossible to express in memory-safe languages.

Out-of-Bounds Write

Code writes before or after the intended memory region, potentially corrupting adjacent state.

Out-of-Bounds Read

Code reads memory outside the intended object and may expose sensitive information or crash.

Buffer Overflow

Input exceeds the capacity of a destination buffer.

Use-After-Free

Code continues to reference memory after its lifetime has ended.

Double Free

The same allocation is freed more than once, potentially corrupting memory-management state.

Null / Invalid Pointer

Code dereferences an invalid reference and can cause crashes or unsafe behavior.

Prefer safer language features, safe libraries, bounds-aware APIs and compiler/runtime protections where feasible - but remember that memory safety does not solve authorization or business-logic flaws.
๐Ÿ”ข Integer and Numeric Safety Small arithmetic mistakes can become memory and authorization problems
Overflow Underflow Truncation Signed / Unsigned Confusion Unsafe Conversion
Example

An attacker controls the requested item count. Multiplication used to calculate buffer size wraps around, producing a much smaller allocation than expected.

Validate ranges before arithmetic and use language/library mechanisms that detect or safely handle overflow where appropriate.
Source-Level Weakness

Race Conditions & TOCTOU

A race condition occurs when security depends on the timing or ordering of operations on shared state.

Check Permission / State โ†’ Time Gap
Time Gap โ†’ State Changes
Use Resource โ†’ Assumption No Longer True
Where possible, make security-sensitive checks and actions atomic or use mechanisms that preserve the required state across the operation.

Untrusted Deserialization

Serialization converts application state into a transportable or storable form. Deserialization reconstructs that state.

Unsafe deserialization can allow untrusted input to create unexpected object types, trigger dangerous code paths or modify sensitive application state.

Prefer Simple Data Formats

Use data-oriented formats and explicit schemas rather than arbitrary executable object graphs where possible.

Validate Structure

Reject fields, types and values outside the expected schema.

Avoid Dangerous Native Object Deserialization

Do not deserialize attacker-controlled objects using mechanisms capable of invoking arbitrary application behavior.

Integrity

Where serialized state must be trusted, protect authenticity and integrity appropriately.

Secure Coding Practice

Authentication, Authorization & Session Security

Authentication

Establish identity using approved organisational mechanisms rather than ad hoc application-specific schemes where possible.

Authorization

Check access for every protected resource and action according to the caller's current permissions.

Least Privilege

Application and service identities should receive only required permissions.

Centralized Security Components

Use well-reviewed authentication and authorization frameworks rather than repeatedly reimplementing complex security logic.

Session Tokens

Generate unpredictable tokens, protect them from disclosure and apply appropriate expiry and invalidation.

Password Reset

Treat recovery flows as authentication flows; tokens should be scoped, protected and appropriately time-limited.

Privilege Changes

Re-evaluate or invalidate sessions when risk-relevant identity or privilege state changes where required.

Logging

Record important authentication and authorization events without recording reusable secrets.

Secure Coding Practice

Fail Securely

Fail Open

A failed security mechanism allows the operation.

Fail Closed / Secure

A failed security decision leaves access denied or the system in another defined safe state.

Example

An authorization service times out. The application should not automatically conclude: "therefore allow access."

Failure handling should preserve the security objective while considering availability and business requirements.

Error Handling & Secure Logging

User-Facing Errors

Return enough information to recover or report the problem without exposing internal implementation details.

Internal Diagnostics

Preserve useful diagnostic context in protected logs or monitoring systems.

Stack Traces

Do not expose raw stack traces, internal paths or database errors to unauthorized users.

Sensitive Data

Do not log passwords, private keys, full session tokens or unnecessary sensitive personal data.

Security Events

Record authentication failures, authorization failures, input-validation failures and security-relevant administrative actions where appropriate.

Consistent Handling

Centralized error and logging components reduce inconsistent security behavior.

Secure Coding Practice

Secrets Management

Application โ†’ Secret Reference
Secret Reference โ†’ Protected Secret Store
Secret Store โ†’ Authorized Runtime Identity
Runtime Identity โ†’ Short-Lived / Scoped Secret Where Possible
Do Not Hard-Code

Avoid embedding reusable credentials in source, binaries, container images or ordinary configuration files.

Least Privilege

A secret should grant only the access required by the application.

Rotation

Design applications so credentials can be changed without rewriting source code.

Exposure Control

Avoid printing secrets in logs, errors, crash dumps or telemetry.

Environment Separation

Development credentials should not automatically grant production access.

Prefer Workload Identity

Where platforms support it, short-lived identity-based credentials can reduce dependence on static secrets.

Secure Coding Practice

Cryptographic Practices

Use Approved Algorithms

Follow organisational and regulatory cryptographic requirements rather than choosing algorithms informally.

Use Established Libraries

Prefer well-reviewed cryptographic APIs and protocols rather than implementing primitives yourself.

Key Management

Protect generation, storage, access, rotation, backup and destruction of keys.

Randomness

Use cryptographically suitable randomness for keys, tokens, nonces and security-sensitive identifiers.

Passwords

Use appropriate password hashing mechanisms rather than reversible encryption or fast general-purpose hashes.

Transport Security

Use approved modern TLS configurations rather than custom encryption protocols.

Crypto Coding Memory Aid

DON'T INVENTUse established algorithms
DON'T EMBEDProtect keys and secrets
DON'T REUSEFollow nonce / IV requirements
DON'T DOWNGRADEUse supported secure protocol versions
Official 8.5 Topic

API Security

APIs expose application functionality to other applications, services, devices and automation.

Every API endpoint should be treated as a security boundary where identity, authorization, input, resource use and data exposure must be controlled.

Authentication

Who is calling?

Object Authorization

May this caller access this specific record or object?

Function Authorization

May this caller invoke this operation?

Property Authorization

Which fields may this caller read or modify?

Input Validation

Is the request structurally and semantically valid?

Output Minimization

Return only information the caller is authorized and needs to receive.

Resource Controls

Limit request size, frequency, processing cost and other abuse paths.

Inventory

Know which endpoints, versions and environments are exposed.

API Request Memory Aid

IDENTIFYWho is the caller?
AUTHENTICATEProve the identity
AUTHORIZEMay they perform this action?
VALIDATEIs the request acceptable?
LIMITCan the request exhaust or abuse resources?
PROCESSExecute safely
MINIMIZEReturn only authorized data
LOGRecord relevant security events
API Security

Broken Object Level Authorization - BOLA

Request

Customer A legitimately accesses: /accounts/123

Attack

Customer A changes the identifier to: /accounts/124

If the API returns another customer's account because it trusts the identifier without checking ownership or permission, object-level authorization is broken.

Never treat possession or knowledge of an object identifier as authorization.

Object vs Property vs Function Authorization

QuestionAuthorization Level
May this user access customer record 123?Object Level
May this user change the customer's riskRating property?Object Property Level
May this user invoke /admin/deleteCustomer?Function Level
Authentication answers "who are you?" Authorization still needs to answer "what exactly are you allowed to do?"
API Security

Unrestricted Resource Consumption

API requests can consume:

CPU Memory Bandwidth Database Connections Storage Email / SMS Cost Third-Party API Cost AI / Compute Tokens
Rate Limits

Constrain request frequency where appropriate.

Size Limits

Bound request bodies, uploads, page sizes and response sizes.

Complexity Limits

Constrain expensive queries and recursive/graph operations.

Quotas

Limit per-user, per-client or per-tenant consumption where needed.

Timeouts

Avoid unbounded operations and resource retention.

Business Abuse Controls

Some sensitive workflows need additional anti-automation or anti-abuse controls beyond generic rate limiting.

API Security

Server-Side Request Forgery - SSRF

Attacker Supplies URL โ†’ Application Accepts
Application โ†’ Server Makes Request
Server Request โ†’ Internal / Trusted Destination

SSRF occurs when an application makes network requests to destinations influenced by an attacker without adequately restricting what the server may access.

Allow Expected Destinations

Restrict outbound requests to required hosts/protocols where feasible.

Validate Resolved Destination

Consider redirects, DNS behavior and alternate address representations.

Network Egress Controls

Limit what application workloads can reach.

Protect Metadata / Internal Services

Do not assume internal endpoints are safe merely because they are not Internet-facing.

API Inventory & Version Management

An organization cannot secure an API it does not know still exists.

Inventory

Track exposed APIs, owners, versions and environments.

Retire Old Versions

Remove obsolete endpoints rather than leaving forgotten attack surface indefinitely.

Documentation

Maintain enough current interface documentation for developers and security teams to understand expected behavior.

Environment Separation

Avoid accidentally exposing development, debug or test endpoints to production users.

Authentication Consistency

Ensure legacy versions do not bypass modern authentication requirements.

Monitoring

Detect traffic to deprecated or unknown interfaces so hidden dependencies can be identified before shutdown.

๐Ÿ”„ Third-Party APIs Are Untrusted Input Too Your server receiving the data does not make the data trustworthy

Applications often trust partner or vendor APIs more than end-user input.

That trust can be misplaced if the upstream service is compromised, misconfigured or returns unexpected data.

Validate Schema Bound Sizes Handle Timeouts Use TLS Correctly Verify Authentication Do Not Concatenate Returned Data Into Commands
Trust relationships should be explicit. External service responses still require safe processing.
Official 8.5 Topic

What Makes a Good Secure Coding Standard?

Specific

Rules should describe an observable coding requirement rather than vague advice such as 'be careful with input'.

Actionable

Developers should know which secure pattern or approved API to use.

Language / Framework Aware

Standards should reflect the technology being used; C memory rules differ from JavaScript output-encoding rules.

Testable

Code review, linting, SAST or tests should be able to verify important rules where practical.

Risk-Based

Prioritize rules that prevent serious and likely weakness classes relevant to the organisation.

Maintainable

Update standards when languages, frameworks, threat patterns and platform capabilities change.

Integrated

Reference the standard in developer tooling, pull-request checks, training and reusable components.

Owned

Someone must be accountable for maintaining the secure-coding rules and approved patterns.

Standard vs Guideline

Standard

Defines mandatory or required coding rules within the organisation.

Example

Database queries containing untrusted values must use the approved parameterized-query interface.

Guideline

Provides recommended practices, patterns or implementation advice.

Example

Prefer framework-provided contextual encoding helpers rather than manual escaping.

The exact terminology varies between organisations, but CISSP expects you to understand that secure development needs defined, repeatable coding expectations.
Secure Coding References

Where Organisations Get Coding Rules

OWASP Secure Coding Practices

Broad web/application coding checklist covering validation, encoding, authentication, sessions, access control, cryptography, errors, data protection, databases, files, memory and general practices.

SEI CERT Coding Standards

Language-specific secure coding rules for technologies such as C and C++.

CWE

Weakness taxonomy that helps map recurring implementation mistakes into categories.

NIST SSDF

High-level secure development framework that recommends using secure coding practices and reviewing/analyzing code.

Framework Guidance

Secure patterns published by language, framework and platform maintainers can supplement organisational rules.

Internal Lessons

Incidents, vulnerabilities and recurring defects should feed back into organisation-specific secure-coding standards.

Secure Coding Strategy

Do Not Make Every Developer Reinvent Authentication

Eighty microservices each contain separately written: JWT validation, role checks and session logic.

A vulnerability is fixed in 47 services but missed in the others.

Where appropriate, use centrally maintained, reviewed security libraries, frameworks and platform services so fixes can be applied consistently.

Secure Coding Design Memory Aid

VALIDATETrust data only after checks
SEPARATEKeep code and data distinct
ENCODEProtect the output context
AUTHORIZECheck every protected action
LIMITBound resources and privileges
PROTECTSecrets and cryptographic keys
FAIL SAFEDo not turn errors into access
LOG SAFELYEvidence without leaking secrets
REUSEPrefer reviewed security components
Official 8.5 Topic

Software-Defined Security

ISC2 lists software-defined security as an 8.5 topic but does not provide examples in the exam outline.

A useful way to understand the concept is: security policy and enforcement can be represented, configured and changed through software and APIs rather than being tied only to fixed hardware or manual configuration.

Security as Code

Security configuration and policy can be version-controlled, reviewed and deployed like other code.

Policy as Code

Machine-readable policy can drive automated authorization, compliance or configuration decisions.

Software-Defined Networking

Programmable controllers and APIs can create network segmentation and policy dynamically.

Cloud Security Controls

Security groups, workload policies, identity rules and service configuration can be managed programmatically.

Infrastructure as Code

Security-relevant infrastructure settings can be defined and reviewed before automated deployment.

Dynamic Enforcement

Software can apply context-aware security decisions based on identity, workload, resource or runtime state.

These are explanatory examples of the broader idea. They should not be treated as additional official ISC2 8.5 sub-bullets.

Security as Code - Why It Helps

Security Requirement โ†’ Machine-Readable Policy
Policy โ†’ Version Control
Change โ†’ Review + Test
Approved Policy โ†’ Automated Deployment
Deployment โ†’ Enforcement Point
Enforcement โ†’ Monitoring + Feedback
Consistency

The same reviewed policy can be applied repeatedly across many systems.

Traceability

Version control can show what changed, when and why.

Automation

Approved policy can be deployed rapidly without manual reconfiguration.

Testing

Policy behavior can be validated before broad deployment.

Scalability

Software-defined controls can support large dynamic cloud and microservice environments.

Rollback

Versioned configurations can support controlled reversal when changes fail.

โš™๏ธ Automation Amplifies Mistakes Too One policy bug can become 5,000 insecure systems
Change

A developer changes a network policy from: approved corporate ranges to all Internet addresses.

Automated deployment applies the change to thousands of workloads.

Software-defined security should use the same disciplines as secure software: least privilege, controlled change, peer review, testing, separation of duties, auditability and rollback.
๐Ÿค– Modern Consideration - AI-Assisted Coding Generated code still needs secure coding controls

AI-assisted development can increase productivity, but generated code can contain:

Insecure Patterns Invented APIs Outdated Examples Weak Error Handling Hard-Coded Secrets Unsafe Dependencies
Treat AI-generated code as development output - not as trusted security advice. Apply the same standards, review and testing required for human-written code.
๐Ÿง  45 CISSP Practice Scenarios Source weaknesses, APIs, coding practices and software-defined security
Scenario 1

A web form accepts a customer age of -900 and passes it directly to business logic.

Which secure-coding principle is missing?

Validate input against the application's expected type, range and business rules.

Scenario 2

A developer checks that an input contains only digits, then later concatenates it into a SQL statement.

Best secure-coding approach?

Use parameterized queries or prepared statements rather than relying on input validation alone to prevent SQL injection.

Scenario 3

User-supplied text is safely stored in the database but later rendered into HTML without context-appropriate encoding.

Which weakness may result?

Cross-site scripting - output should be encoded for the context in which it is rendered.

Scenario 4

An application removes the string '../' once from a file path but then processes a differently encoded traversal sequence.

What principle is relevant?

Canonicalize and validate paths carefully; naive sanitization is not a reliable substitute for safe path handling.

Scenario 5

A program builds an operating-system command by concatenating a filename supplied by a user.

Primary risk?

OS command injection.

Scenario 6

A service interprets user-controlled text as executable code.

Primary risk?

Code injection; do not treat untrusted data as executable instructions.

Scenario 7

A program copies attacker-controlled data into a fixed-size memory buffer without checking bounds.

Which source-level weakness?

Buffer overflow / out-of-bounds write.

Scenario 8

Code continues to use a pointer after the memory it references has already been freed.

Which weakness?

Use-after-free.

Scenario 9

Two threads check and then modify a security-sensitive file, allowing the state to change between the check and the use.

Which class of weakness?

Race condition / time-of-check to time-of-use weakness.

Scenario 10

An application deserializes an attacker-supplied object using an unsafe framework feature.

Primary concern?

Deserialization of untrusted data can trigger unintended object creation or code paths.

Scenario 11

A file-upload function trusts the filename extension and stores uploaded files inside an executable web directory.

Best security direction?

Validate content/type, rename safely, store outside executable paths where appropriate and apply strict authorization and processing controls.

Scenario 12

The application returns a full stack trace, SQL query and internal file path to an unauthenticated user.

Which coding practice is weak?

Error handling should avoid exposing sensitive internal details.

Scenario 13

Passwords, private keys and cloud tokens are hard-coded in source code.

Better practice?

Keep secrets out of source and retrieve them through appropriately protected secret-management mechanisms.

Scenario 14

A developer creates a custom encryption algorithm because it is shorter than using an approved library.

CISSP answer?

Use well-established, reviewed cryptographic libraries and approved algorithms rather than inventing cryptography.

Scenario 15

A security-sensitive operation accepts any authenticated user without checking whether that user is authorized for the specific action.

Which weakness?

Missing or incorrect authorization.

Scenario 16

A customer changes /accounts/123 to /accounts/124 and receives another customer's data.

Which API weakness?

Broken Object Level Authorization - BOLA / IDOR-style authorization failure.

Scenario 17

An API checks authentication at login but never validates object-level authorization on individual resource requests.

Best fix?

Perform authorization checks for each protected object/action, not only at initial authentication.

Scenario 18

An API accepts a JSON object containing an 'isAdmin' property and blindly maps every supplied property into the user record.

Which API concern?

Broken object property level authorization / mass-assignment-style weakness.

Scenario 19

An unauthenticated API endpoint can trigger thousands of expensive password-reset SMS messages per minute.

Which API risk?

Unrestricted resource consumption and abuse of costly business operations; apply appropriate limits and controls.

Scenario 20

A normal user discovers an undocumented administrative API endpoint and can invoke it.

Primary problem?

Broken function-level authorization plus poor API inventory/governance.

Scenario 21

An API fetches any URL supplied by the caller, including internal cloud metadata addresses.

Which risk?

Server-Side Request Forgery - SSRF.

Scenario 22

A service trusts data returned by a third-party API and passes it directly into a database query.

Which lesson?

External APIs are also untrusted input; validate, constrain and safely process their data.

Scenario 23

An API returns every field in a customer object, including internal risk flags not intended for the caller.

Which security issue?

Excessive data exposure / broken object property level authorization.

Scenario 24

An API token is placed in the URL query string and appears in browser history and proxy logs.

Better design?

Use protected authorization headers or another appropriate mechanism and avoid leaking secrets through URLs and logs.

Scenario 25

An API uses a predictable sequential identifier but enforces correct authorization on every request.

Is predictability alone the vulnerability?

Not necessarily. Predictable IDs increase discoverability, but the critical control is correct authorization.

Scenario 26

A developer assumes that HTTPS means request input does not need validation.

Correct principle?

TLS protects transport; it does not make untrusted application input trustworthy.

Scenario 27

A developer 'sanitizes' input by deleting apostrophes and assumes SQL injection is solved everywhere.

Better approach?

Use parameterized queries and context-appropriate controls; ad hoc sanitization is fragile.

Scenario 28

A template engine supports automatic contextual output encoding, but the developer disables it to render raw HTML from users.

Primary concern?

The developer has bypassed a safe default and may introduce XSS.

Scenario 29

An application performs authentication correctly but logs complete session tokens for troubleshooting.

Which secure-coding principle is violated?

Do not place sensitive authentication/session secrets in logs.

Scenario 30

A password-reset token is long and random but never expires and can be reused.

What else is needed?

Security-sensitive tokens should have lifecycle controls such as expiry and single-use semantics where appropriate.

Scenario 31

A security check fails because a dependency service is unavailable. The application responds by allowing the requested action.

Which design principle?

Fail securely - security-control failure should not silently become authorization.

Scenario 32

A service account used by the application has database administrator rights even though it only needs read access to two tables.

Which principle?

Least privilege.

Scenario 33

A developer catches every exception with one empty handler so the application never crashes.

Security problem?

Suppressing errors can hide security failures and leave the system in an unsafe or inconsistent state.

Scenario 34

An application accepts arbitrary regex supplied by users and evaluates it against very large input, causing extreme CPU use.

Which coding concern?

Resource-exhaustion / algorithmic complexity should be constrained.

Scenario 35

A C program increments a size value that wraps around before memory is allocated.

Which weakness family?

Integer overflow/wraparound can lead to incorrect allocation and memory-safety failures.

Scenario 36

A secure-coding rule says developers 'should be careful with input' but gives no testable requirement.

How can the standard improve?

Make rules specific, actionable and verifiable, with approved patterns or examples.

Scenario 37

A team copies the same authorization code into 80 services and fixes are applied inconsistently.

Better secure-coding strategy?

Use centrally maintained, reviewed security components or frameworks where appropriate rather than duplicating fragile security logic.

Scenario 38

Security policy is stored as version-controlled code, reviewed through pull requests and automatically deployed to enforcement points.

Which official 8.5 concept does this illustrate?

Software-defined security - security policy/enforcement represented and managed through software.

Scenario 39

A cloud firewall rule is generated automatically from code and a one-line change could expose every service to the Internet.

Main lesson?

Software-defined security enables consistency and automation, but code changes to security policy require the same strong review, testing and least-privilege controls.

Scenario 40

A policy-as-code rule is incorrect and automation deploys it consistently to 5,000 workloads.

What does this demonstrate?

Automation scales both correct and incorrect security decisions; validation and controlled change remain essential.

Scenario 41

An AI coding assistant generates a convenient authentication function copied into production without review.

CISSP secure-development response?

AI-generated code should be treated as untrusted development output and reviewed/tested against the same secure-coding standards as human-written code.

Scenario 42

A team eliminates a SQL injection finding but the same unsafe concatenation pattern remains in dozens of other modules.

Best mature response?

Fix the instance and address the insecure coding pattern systematically through standards, reusable controls, review and testing.

Scenario 43

Which four subtopics are explicitly listed in current CISSP 8.5?

Answer?

Source-code weaknesses and vulnerabilities, API security, secure coding practices, and software-defined security.

Scenario 44

What is the difference between a weakness and a vulnerability?

Best answer?

A weakness is a type of flaw or condition; a vulnerability is an instance in a real product that can be exploited or otherwise creates security exposure.

Scenario 45

Management asks for the central purpose of CISSP 8.5.

Best answer?

Define and apply coding rules and programmable security patterns that prevent common source-level and API weaknesses rather than relying only on finding vulnerabilities after software is built.

CISSP Exam Perspective

Recognise the Clue Words

Untrusted Input

Check type, length, range, format and meaning.

Input Validation

Data Used in SQL

Keep data separate from query syntax.

Parameterized Query

User Data Rendered to HTML

Protect the output context.

Output Encoding

User Input Builds Shell Command

Data becomes command syntax.

Command Injection

User Input Becomes Code

Data becomes executable logic.

Code Injection

../ or Encoded Path

File escapes intended directory.

Path Traversal

Fixed Buffer + Unchecked Length

Memory corruption.

Buffer Overflow

Memory Used After Free

Dangling lifetime.

Use-After-Free

Check Then Use

State changes between operations.

TOCTOU / Race Condition

Unsafe Object Deserialization

Untrusted object graph.

Deserialization Weakness

Hard-Coded Password / Key

Secret in source.

Secrets Management

Custom Encryption Algorithm

Do not invent crypto.

Approved Crypto Library

Full Stack Trace to User

Internal detail exposure.

Secure Error Handling

Authenticated But Not Authorized

Identity is not permission.

Authorization

Change Object ID

Access another user's object.

BOLA / IDOR

User Controls Object Properties

Sensitive field update.

Property-Level Authorization

Unlimited Expensive API Calls

DoS / financial abuse.

Resource Consumption

Hidden Admin Endpoint

Privileged function.

Function-Level Authorization

API Fetches User URL

Server makes attacker-chosen request.

SSRF

Old / Forgotten Endpoint

Unknown attack surface.

API Inventory

Third-Party API Response

External data is untrusted.

Unsafe API Consumption

Security Rules Stored as Code

Programmable enforcement.

Software-Defined Security

Security Policy in Pull Request

Versioned security configuration.

Policy / Security as Code

Generated Code

Source origin does not remove review need.

Apply Same Secure Coding Standard
โš ๏ธ Common CISSP Mistakes Secure coding is about precise controls, not slogans
Validation โ‰  Sanitization

Validation determines whether input satisfies expected rules. Sanitization transforms data. They solve different problems and should not be used interchangeably.

Input Validation โ‰  SQL Injection Defense by Itself

Parameterized queries or equivalent safe APIs should keep untrusted data separate from SQL syntax.

Sanitization โ‰  Universal Security Filter

A transformation safe for one context may be unsafe in another.

Output Encoding โ‰  Input Validation

Encoding protects data when it enters a specific output context; validation checks whether input is acceptable.

Escaping HTML โ‰  Safe SQL

Security controls are context-specific.

Authentication โ‰  Authorization

Knowing who a user is does not determine what that user is permitted to do.

Random Object ID โ‰  Authorization

Unpredictable identifiers can reduce guessing but do not replace authorization checks.

HTTPS โ‰  Secure API

TLS protects data in transit but does not fix authorization, injection, business-logic or resource-abuse flaws.

API Gateway โ‰  Complete API Security

Gateways can enforce useful controls, but application-specific authorization and business logic still require secure implementation.

Rate Limiting โ‰  Authorization

Limiting request volume does not determine whether a caller is permitted to perform the action.

No Error Message โ‰  Secure Error Handling

The application should fail safely and preserve useful internal diagnostic evidence without disclosing sensitive details to users.

Logging Everything โ‰  Secure Logging

Logs can expose passwords, tokens, personal data and cryptographic material if developers do not control content.

Home-Grown Crypto โ‰  Innovation

Cryptographic algorithms and protocols are easy to get wrong; use established, reviewed mechanisms.

Hashing โ‰  Encryption

Hashing is generally one-way; encryption is reversible with the appropriate key.

Encoding โ‰  Encryption

Base64 and similar encodings do not provide confidentiality.

Hard-Coded Secret โ‰  Configuration

Secrets embedded in source are difficult to rotate safely and may persist in repository history.

Prepared Statement โ‰  Complete Input Security

Parameterized SQL protects query structure, but business validation and authorization are still necessary.

Memory-Safe Language โ‰  Vulnerability-Free

Memory safety reduces important classes of defects but not authorization, injection, logic or configuration weaknesses.

Static Analysis Clean โ‰  Secure Code

Testing tools can miss logic and design flaws; secure coding standards remain necessary.

CWE โ‰  CVE

CWE describes weakness types. CVE identifies specific publicly disclosed vulnerabilities.

OWASP Top 10 โ‰  Coding Standard

OWASP risk lists help prioritize awareness; a secure-coding standard should provide concrete rules and approved patterns.

Copy-Pasted Security Code โ‰  Reuse Done Well

Prefer reviewed, centrally maintained security libraries and frameworks where appropriate.

Fail Open โ‰  User Friendly

Security-control failures should not silently grant access unless the risk and design explicitly justify that behavior.

Software-Defined Security โ‰  Automatically Secure

Programmable controls can propagate secure or insecure policy at machine speed.

8.5 โ‰  8.2

8.2 secures the development ecosystem and performs AppSec testing. 8.5 focuses on coding rules, source-level weaknesses, API security and software-defined security.

Quick Reference

If you see...Think...
Type / length / range / format checksInput Validation
Data separated from SQL syntaxParameterized Query
User data placed into HTML safelyContextual Output Encoding
Attacker input changes SQL syntaxSQL Injection
Attacker input changes OS commandOS Command Injection
Attacker input becomes executable codeCode Injection
../ escapes intended directoryPath Traversal
Unchecked write beyond bufferOut-of-Bounds Write / Buffer Overflow
Reference after memory releasedUse-After-Free
State changes between check and useRace / TOCTOU
Unsafe attacker-controlled object graphInsecure Deserialization
Secret embedded in repositoryHard-Coded Credential
Internal stack trace shown externallyInformation Exposure / Error Handling
User authenticated but cannot access objectAuthorization
Changing object ID accesses another recordBOLA / IDOR
Sensitive property can be modifiedProperty-Level Authorization
Unlimited expensive requestsResource Consumption / Rate Controls
Privileged API endpoint callable by ordinary userFunction-Level Authorization
Server fetches attacker-chosen URLSSRF
Forgotten API version still exposedAPI Inventory Management
Trusting third-party API blindlyUnsafe API Consumption
Security policy stored/versioned as codeSoftware-Defined Security
Security configuration automatically deployedSecurity / Policy as Code
Weakness taxonomyCWE
Specific disclosed vulnerabilityCVE

Four Official 8.5 Topics

SOURCEWeaknesses and vulnerabilities in code
APISecure machine-facing interfaces
PRACTICERules developers consistently follow
SOFTWARE-DEFINEDSecurity expressed and enforced through software

8.5 Master Memory Aid

VALIDATEAccept only expected input
SEPARATEKeep instructions and data apart
ENCODEProtect output contexts
AUTHENTICATEKnow the caller
AUTHORIZECheck every protected action
LIMITBound privilege and resources
PROTECTSecrets, sessions and keys
FAIL SAFESecurity failures do not grant access
STANDARDISEUse approved patterns
AUTOMATE CAREFULLYSoftware-defined security still needs review

Treat data as data, enforce authorization everywhere, make the secure pattern the easy pattern.

The Secure Coding Leader's Questions

INPUT?Which data is untrusted?
VALIDATE?What properties should that data have?
INTERPRETER?Could data become SQL, commands, code or markup?
OUTPUT?Is data encoded for the destination context?
AUTHN?How is caller identity established?
AUTHZ?Is every object/function/property access checked?
MEMORY?Can bounds or object lifetime be violated?
SECRETS?Are reusable credentials outside source and logs?
CRYPTO?Are approved algorithms and libraries used correctly?
ERROR?Does failure preserve security without leaking internals?
RESOURCE?Can attackers consume unbounded compute, storage or money?
API?Which endpoints exist and who owns them?
STANDARD?Are secure coding rules specific and testable?
REUSE?Can a reviewed security component replace repeated custom logic?
SOFTWARE-DEFINED?Are programmable security policies reviewed and tested like code?
Domain 8 Complete

Software Development Security - The Whole Picture

ObjectiveCore QuestionThink...
8.1When and how does security enter development?Secure SDLC
8.2Which development technologies and tests must be secured?Ecosystem + AppSec testing
8.3How do we know software security actually works?Evidence + risk + mitigation
8.4What if somebody else built or operates it?Acquired software + third parties
8.5How should implementation avoid predictable weaknesses?Secure coding + APIs + programmable security

Domain 8 Memory

8.1 - LIFECYCLEBuild security in
8.2 - ECOSYSTEMSecure the factory
8.3 - EFFECTIVENESSProve it works
8.4 - ACQUISITIONManage external trust
8.5 - CODEImplement securely

Key Takeaways

CISSP 8.5 is: Define and apply secure coding guidelines and standards.

The current ISC2 outline explicitly includes four areas: security weaknesses and vulnerabilities at the source-code level, API security, secure coding practices and software-defined security.

The central principle is: prevent predictable implementation weaknesses by giving developers safe, repeatable patterns rather than relying only on testing after the code is written.

A weakness is a type of software flaw or unsafe condition.

A vulnerability is a weakness present in a real product or system in circumstances that create exploitable or meaningful security exposure.

CWE is a taxonomy of weakness types.

CVE identifies specific publicly disclosed vulnerabilities.

Secure coding begins with understanding trust boundaries and untrusted data.

Input should be validated against the application's expected type, length, range, format and business meaning.

Client-side validation improves usability but cannot be trusted as the only security control because the client is outside the server's trust boundary.

Validation, sanitization and output encoding are different.

Validation asks: is this input acceptable?

Sanitization transforms data to remove or alter unwanted content.

Output encoding asks: how should this data be represented safely in this exact destination context?

There is no universal sanitization step that makes arbitrary input safe for SQL, HTML, JavaScript, shell commands, URLs and every other interpreter.

Injection occurs when untrusted data changes the intended meaning of instructions.

SQL injection should normally be prevented by keeping query structure and untrusted values separate through parameterized queries or equivalent safe database APIs.

Removing apostrophes from input is not a robust general SQL-injection strategy.

OS command injection occurs when user-controlled data changes an operating-system command.

Avoid invoking shell commands with attacker-controlled text where safer APIs exist.

Code injection occurs when attacker-controlled data becomes executable code.

Treat untrusted input as data - not instructions.

XSS is fundamentally an output-context problem.

Untrusted data rendered into HTML, JavaScript, CSS, URLs or other contexts requires appropriate context-sensitive handling.

Framework auto-escaping and contextual encoding should normally remain enabled.

Content Security Policy can provide useful defense in depth but does not replace correct output handling.

Path traversal occurs when attacker-controlled path elements cause access outside the intended directory.

Canonicalization and safe path construction matter because the same path may have multiple textual representations.

File uploads should be treated as untrusted content.

Validate size and expected type, control storage location and permissions, and avoid automatically executing uploaded content.

Memory-safety weaknesses include out-of-bounds access, buffer overflow and use-after-free.

Safer languages and bounds-aware APIs can eliminate or reduce important classes of memory corruption.

But: memory-safe language โ‰  vulnerability-free application.

Authorization, injection, business logic and cryptographic misuse remain possible.

Integer overflow, truncation and signed/unsigned conversion can corrupt security logic and memory-allocation calculations.

Validate numeric ranges before sensitive arithmetic and use safe language mechanisms where available.

Race conditions occur when security assumptions change between operations on shared state.

Time-of-check-to-time-of-use is a classic example: the state checked may no longer be the state used.

Unsafe deserialization can transform attacker-controlled data into dangerous internal object state or code paths.

Prefer constrained data formats and explicit schemas over arbitrary executable object graphs when possible.

Authentication and authorization are different.

Authentication answers: who are you?

Authorization answers: what are you allowed to do?

A user should be authorized for the specific object, function and relevant properties being accessed.

Session and reset tokens are security credentials.

Generate them unpredictably, protect them from disclosure and implement appropriate expiry, invalidation and single-use semantics.

Applications should fail securely.

An authorization-service error should not automatically mean: "allow the request."

Error handling should protect internal information while preserving useful diagnostic evidence for authorized operators.

Stack traces, database errors, file paths and sensitive configuration should not be exposed indiscriminately to users.

Logging is part of secure coding.

Record useful security events without placing passwords, private keys, full session tokens or other reusable secrets in logs.

Secrets should not be hard-coded into source.

Use protected secret-management or workload-identity mechanisms so credentials can be scoped, rotated and revoked independently of application source.

Cryptography should use approved, well-established algorithms, protocols and libraries.

Do not invent cryptography to save development effort.

Correct cryptographic algorithms can still be used insecurely when keys, nonces, randomness, protocol versions or certificate validation are handled incorrectly.

API security is explicitly part of 8.5.

APIs expose business functions and data across trust boundaries.

Every protected API request should consider identity, object authorization, function authorization, property authorization, input validation, resource use and output data.

Broken Object Level Authorization occurs when a caller can manipulate an object identifier and access a resource they do not own or are not authorized to use.

Therefore: knowing an object identifier โ‰  authorization.

Random identifiers can make guessing harder but must not replace authorization checks.

Object property authorization controls which fields a caller may read or modify.

Function-level authorization controls whether the caller may invoke a privileged operation.

API resource consumption should be bounded.

Attackers can abuse CPU, memory, database connections, storage, email/SMS services, third-party API fees and expensive compute operations.

Rate limits, quotas, size limits, timeouts and business-flow controls can reduce these risks.

SSRF occurs when a server makes attacker-influenced requests to destinations the attacker should not be able to reach through that server.

Restrict outbound destinations and combine application validation with network-level egress controls where appropriate.

API inventory matters.

Forgotten, debug and obsolete endpoints can become unmanaged attack surface.

Retire unused API versions and monitor use of deprecated interfaces.

Third-party API responses should also be treated as untrusted data.

A trusted business partner can still be compromised or return malformed and malicious data.

HTTPS protects transport.

It does not make API input trustworthy and does not solve authorization or business logic.

A secure coding standard should be specific, actionable, technology-aware, testable, maintainable and owned.

Vague advice such as: "validate input carefully" is less useful than a rule describing exactly which validation and safe APIs are required.

Secure coding rules should be integrated into code review, developer training, automated analysis and reusable frameworks where practical.

Developers should not reimplement complex security mechanisms independently in every service if a well-maintained, reviewed shared component is suitable.

Central security libraries can improve consistency and make future remediation easier.

Software-defined security is also explicitly part of 8.5.

ISC2 does not provide examples in the current exam outline.

The useful concept is that security policy and enforcement can be expressed, orchestrated and changed through software and APIs.

Examples can include security-as-code, policy-as-code, programmable network policy, cloud security configuration and infrastructure-as-code security controls.

These examples illustrate the concept; they are not additional official 8.5 bullets.

Software-defined security can improve consistency, auditability, version control and automated deployment.

But: automation โ‰  correctness.

An insecure policy can be deployed to thousands of systems more quickly than a human administrator could misconfigure them manually.

Security policy code therefore requires controlled change, review, testing, least privilege, auditability and rollback.

AI-generated code should be treated like other externally generated development output.

It should follow the same secure coding standards, review and testing as human-written source.

Remember the complete Domain 8 sequence:

8.1 = integrate security through the lifecycle.
8.2 = secure the development ecosystem and perform AppSec testing.
8.3 = assess whether software security is effective.
8.4 = assess security impact of acquired software.
8.5 = define and apply secure coding guidelines and standards.

The central CISSP principle for 8.5 is:

treat all external data as untrusted until validated, keep data separate from executable instructions, authorize every protected operation, use proven security libraries and patterns, make secure behavior the default, and review programmable security controls with the same discipline as application code.

๐Ÿ“š Sources & Further Reading Current secure coding, API and software-defined security references