KEO1 Cheatsheet
Secure Software Design
Download free PDFSecure development lifecycle
Security goals and SDLC phases
- **Confidentiality** prevents unauthorized disclosure; **integrity** protects against improper alteration or destruction; **availability** ensures timely, reliable access and use.
- **Planning** establishes business value, feasibility and scope. **Requirements** define functional needs, security objectives, privacy obligations and acceptance criteria.
- **Design** selects architecture, interfaces, trust boundaries and controls. **Implementation** builds the code; **testing** evaluates behavior and security; **deployment** releases the approved product.
- **Maintenance** handles vulnerabilities, patches and changing requirements. **End of life** retires services, revokes access and disposes of data under retention rules.
Agile security and developer readiness
- The **Agile Manifesto** values individuals and interactions, working software, customer collaboration and responding to change over processes and tools, comprehensive documentation, contract negotiation and following a plan.
- In an **agile SDL**, establish security ownership and primary security/privacy contacts once; repeat applicable checks each sprint. Schedule periodic **bucket requirements** and complete release security reviews.
- **Security training** teaches policy, threat recognition, secure coding and testing. Give new developers foundational instruction and maintain role-specific learning as technologies and risks change.
- Include security acceptance criteria in the **backlog** and **definition of done**. Peer review before merge checks coding patterns, defects and security assumptions.
Plans, evidence and release gates
- An **SDL project outline** assigns activities and responsibilities. A **product risk profile** summarizes security/privacy exposure. Maintain a **third-party component inventory** to track dependencies and updates.
- **Security test plans** define scope, techniques, schedule, environment and pass criteria. Execution records capture runs and retests; findings reports summarize vulnerabilities, severity, evidence and results.
- Keep **design security reviews**, updated threat models and **privacy implementation assessments** aligned with the implemented product. Remediation records identify owners, fixes and verification.
- Before shipping, perform a **final security review**, resolve or formally accept residual risks, and check privacy changes in a **final privacy review**. Review open-source licenses and required notices.
- Customer-facing security documentation should explain relevant assurance and security behavior without exposing exploit details. Coordinate disclosure and customer communication responsibilities.
Change management and post-release work
- **Change management** evaluates security impact, approves and tracks a change, tests it, deploys it and verifies the outcome. Preserve rollback plans and an audit trail.
- **Patch management** identifies affected components, prioritizes remediation, updates code or packages, tests compatibility and validates deployment. Installation management controls rollout and configuration.
- For **legacy code**, inventory assets and dependencies, assess policy gaps and prioritize remediation by risk. Acquired products also need assessment and integration into the security program.
- Maintain an **external vulnerability disclosure response process** for intake, triage, coordinated remediation and communication. Reassess controls as threats and operating environments change.
Threat modeling and risk
Assets, boundaries and threat status
- **Asset-centric** modeling starts with what must be protected. **Attacker-centric** modeling considers adversaries and goals; **application-centric** modeling follows architecture and data flows.
- Set the **scope**, decompose the target, identify assets and trust boundaries, document threats and weaknesses, then prioritize and select mitigations. Revisit the model after significant changes.
- A **threat** is a potential harmful event; a **vulnerability** is an exploitable weakness; **risk** combines likelihood and impact in context.
- **Unmitigated threats** lack effective defenses. Partially mitigated threats retain exposure; validate controls and record **residual risk** even after mitigation.
PASTA and DREAD
- **PASTA** is a risk-centered, seven-stage approach: define business objectives; define technical scope; decompose the application; analyze threats; analyze vulnerabilities and weaknesses; model attacks; analyze risk and impact.
- **Technical scope** captures infrastructure, technologies, interfaces and dependencies. **Application decomposition** maps components, data flows, entry points and trust boundaries.
- **Vulnerability analysis** collects and correlates exploitable weaknesses. **Attack modeling** builds plausible attack paths and examines exploit scenarios. Risk analysis connects technical exposure to business impact.
- **DREAD** considers Damage potential, Reproducibility, Exploitability, Affected users and Discoverability. Damage measures harm; exploitability measures the effort or conditions required to exploit.
STRIDE threats and control choices
- **Spoofing** impersonates an identity: use strong authentication, protected credentials and validated tokens. **Tampering** changes data: enforce integrity, protected transport and server-side validation.
- **Repudiation** disputes an action: use attributable, protected audit records. **Information disclosure** exposes data: apply authorization, encryption and data minimization.
- **Denial of service** disrupts availability: use resource limits, timeouts and resilient capacity. **Elevation of privilege** exceeds permissions: enforce least privilege and authorization boundaries.
- An **intercepting proxy** can inspect and modify browser requests and responses. Treat form fields and API parameters as attacker-controlled; hiding or validating a field in the browser does not secure it.
CVSS scores and prioritization
- **CVSS** expresses vulnerability severity on a 0.0-10.0 scale: **None 0.0**, **Low 0.1-3.9**, **Medium 4.0-6.9**, **High 7.0-8.9**, **Critical 9.0-10.0**.
- **Base metrics** describe intrinsic exploitability and impact. **Temporal metrics** reflect factors such as exploit maturity and remediation availability; **environmental metrics** adapt severity to the affected organization.
- Apply severity bands to the specific score being reported. A base score and its adjusted score can occupy different bands; label them clearly and preserve the metric vector.
- **Severity is not business risk**. Prioritize with exposure, asset importance, exploit evidence and compensating controls as well as the score.
Assurance, testing and review
BSIMM and SAMM maturity assessments
- **BSIMM** organizes observed software security activities into **Governance**, **Intelligence**, **SSDL Touchpoints** and **Deployment**. It benchmarks a program rather than certifying an application as secure.
- **Governance** covers strategy, metrics, policy and training. **Intelligence** covers attack models, security features/design and standards/requirements.
- **SSDL Touchpoints** covers architecture analysis, code review and security testing. **Deployment** covers penetration testing, environment configuration and vulnerability management.
- Classic **OpenSAMM** groups practices under Governance, Construction, Verification and Deployment. Its **Verification** function includes design review, code review and security testing.
- **OWASP SAMM** also uses Governance, Design, Implementation, Verification and Operations as business functions. Match terminology to the model in use; assess evidence and improve practices incrementally.
Static, dynamic, white box and black box
- **Static analysis** examines source or compiled artifacts without executing the target. Automated tools flag suspicious patterns but need triage and can miss context-dependent flaws.
- **Dynamic analysis** evaluates a running application. It reveals observable runtime behavior but depends on reachable paths, test data and environment.
- **White box testing** uses internal structure, logic and code paths. **Black box testing** evaluates inputs and outputs through exposed behavior. These describe visibility, while static/dynamic describes execution.
- **Integration testing** checks interactions among components, databases, servers and services. **User acceptance testing** checks business acceptance criteria; it does not replace security testing.
Scans, penetration tests and fuzzing
- **Vulnerability scanning** automates checks for known weaknesses, signatures and misconfiguration. **Penetration testing** uses authorized manual and automated attacks to assess exploitability and impact.
- **Fuzzing** supplies malformed, unexpected or random inputs to expose crashes, type errors and unsafe handling. **Property-based testing** generates cases to test stated invariants.
- **Fault injection** deliberately introduces failures to assess resilience and error paths. Binary analysis examines compiled artifacts; neither technique substitutes for testing external interfaces.
- Record reproducible findings and remediation recommendations. After a fix, **retest** the affected control and run regression checks for related functionality.
Manual review and data-flow tracing
- **Manual peer review** has someone other than the original author inspect code for errors, assumptions and security weaknesses. It adds context but requires skilled reviewer time.
- Set **review objectives**, survey the code and architecture, identify sensitive entry points and controls, then inspect implementation for security issues. Track findings and verify corrections.
- **Data-flow analysis** follows an input from its source through transformations to output or sensitive sinks. Check validation, trust transitions and handling before database, file or command use.
- **Control-flow analysis** follows branches, loops and execution paths. Look for bypasses, unsafe error handling and missing authorization on alternate paths.
Secure coding and application controls
Validate input and prevent injection
- **Validate all untrusted input on the server**, including API requests, hidden fields and uploaded metadata. Enforce expected types, lengths, ranges, formats and business rules; client checks improve usability.
- Prevent **SQL injection** with parameterized queries or safely bound prepared statements. Keep data separate from SQL syntax and restrict database privileges; validation alone is insufficient.
- For **XML external entity (XXE)** risks, disable external entity resolution and unnecessary DTD processing in the parser. Avoid untrusted external resource access and keep parsers updated.
- Prevent **cross-site scripting (XSS)** with context-appropriate output encoding and safe rendering APIs. Sanitize permitted rich HTML; input validation and output encoding serve different purposes.
Authentication, authorization and sessions
- **Authentication** establishes identity; **authorization** decides permitted actions. Check permissions on every protected resource and operation, including APIs and backend data access.
- Use a consistent **authorization component**, deny by default and **fail closed** if policy/configuration cannot be read. Enforce **least privilege** for users, services and database accounts.
- Apply **role-based access control** and resource ownership checks on the server. Public-computer download restrictions require permission and content controls; authentication alone does not prevent misuse.
- Use unpredictable **session identifiers**, secure cookie attributes, idle and absolute timeouts, and server-side session invalidation at logout. Clear application-owned sensitive client state when appropriate.
- Closing a browser window does not reliably end a session. Protect shared devices by expiring unattended sessions, avoiding persistent sensitive storage and requiring reauthentication for sensitive actions.
Protect data, files and API behavior
- Use **TLS** for sensitive data in transit and suitable encryption at rest. Storage encryption does not protect data after an authorized application decrypts it; minimize and mask returned fields.
- TLS protects transport, while an authorized endpoint or trusted testing proxy can see plaintext. Restrict sensitive responses with server-side authorization and avoid unnecessary caching or logging.
- For **file uploads**, authenticate and authorize users, allow only required file types, verify content and size, generate safe names and store uploads outside executable web paths.
- **Secure configuration** disables unnecessary services and limits exposed banners, debug output and error details. Keep components patched and protect administrative and configuration access.
- **API hardening** explicitly allows supported methods, validates payloads and returns controlled errors for unsupported or malformed requests. Do not let unexpected methods trigger unhandled exceptions.
- **Memory safety** includes bounds checks, safe APIs, correct allocation/free behavior and avoiding use-after-free. Treat exceptions as controlled failures and keep secrets out of diagnostics.
Privacy requirements and data handling
Privacy impact and lifecycle requirements
- A **privacy impact assessment** maps personal data collection, purposes, processing, recipients and risks. Assess identifiability, monitoring, ongoing transfers and unexpected changes to user settings.
- **Collection requirements** limit data to a defined purpose. **User controls** address notice, choices and preferences; **access requirements** cover appropriate access to personal information.
- **Data integrity requirements** keep personal information accurate and current. **Retention requirements** define how long it is needed and how it is securely deleted.
- **Third-party requirements** define protections when external processors or recipients handle personal information: permitted use, access, safeguards, onward sharing and responsibilities.
- Implement **data protection** through minimal disclosure, restricted printing/export, justified access to archives and protection of stored data. Removing visible PII alone does not remove privacy risk.
- Review implementation against documented commitments before release and after material changes. Do not assume **anonymous data** is safe without assessing linkability and reidentification risk.