Secure Software Systems Engineering Guide
Secure Software Systems Engineering Guide
“The level of confidence that software is free from vulnerabilities, either intentionally
designed into the software or accidentally inserted at any time during its life cycle, and that
the software functions in the intended manner.”
Objective: The ability to trust that software will remain dependable under all circumstances,
with a justified level of confidence.
Software reliability,
Software safety, and
Software security.
3|Page
Software security is a key part of software assurance. It focuses on building strong, reliable
programs that can resist attacks, limit damage if something goes wrong, and recover
quickly. Secure software should work as expected, be as free from exploitable flaws as
possible, and follow clear standards.
In practice, this means designing software to spot harmful inputs, recognize attack patterns,
and respond in a way that protects the system. If an attack does succeed, the software
should still provide at least a basic level of service and then fully recover. Achieving this
requires balancing strong security with time, cost, and project constraints.
Shifts Left on Security: Software assurance "shifts left" on the security timeline, meaning
it moves security considerations to the earliest possible stages of development. It's much
cheaper and easier to fix a design flaw than to patch vulnerability in a deployed system.
Proactive Vulnerability Management: Rather than just reacting to discovered
vulnerabilities, SwA uses a range of techniques to proactively find them. This includes:
Threat Modeling: Analyzing the system's design to identify potential threats and
vulnerabilities before any code is written. This helps developers and architects build
security controls from the beginning.
Static and Dynamic Analysis: Using automated tools to scan source code (static analysis)
and running applications (dynamic analysis) to find common weaknesses, like buffer
overflows, injection flaws, and insecure configurations.
Code Reviews and Peer Inspections: Developers manually review each other's code to
spot logical errors and security flaws that automated tools might miss.
Secure Coding Practices: SwA enforces the use of secure coding standards and
guidelines. This training and oversight help developers avoid common pitfalls that lead to
vulnerabilities, such as improper input validation, poor error handling, and weak
cryptographic implementations.
Dependency Management: Modern applications rely heavily on third-party libraries and
components. SwA includes practices to manage these dependencies by ensuring they are
up-to-date and free from known vulnerabilities.
Continuous Monitoring and Improvement: The process doesn't end at deployment. SwA
involves continuous monitoring of the application for new vulnerabilities and emerging
threats. It also fosters a culture of continuous improvement, where lessons learned from
incidents or new findings are fed back into the development process.
4|Page
- Secure Coding Practices – Use safe libraries, validate inputs.
Key Principles of Software Security:
a. Secure by Design – Security considered from the start.
b. Least Privilege – Users/programs get only the permissions they need.
(Ex: Marketing Department User can’t access HR files, Backup Program cannot
modify the original database apart from copying)
c. Defense in Depth – Multiple security layers.
d. Fail Securely – Systems should fail in a safe way.
e. Regular Updates – Patch vulnerabilities quickly.
5|Page
“The threat (source of danger) is often a person intending to do harm, using one or
more malicious software agents such as stealing data, disrupting operations, or
gaining unauthorized access.”
Operational attacks – Hackers use known software flaws that are not fixed (unpatched)
to attack systems.
Example: A buffer overflow in a browser lets hackers run their own malicious code on a
user’s computer.
Targeted weaknesses – Attackers usually go after the “entry points” of software like web
applications, databases, or operating systems.
Example: SQL injection in a website login form to steal all usernames and passwords.
Malware: Malware or malicious software is a general term used to describe software that
is harmful. It includes various subtypes: Viruses, Worms, Trojans, Ransomware, and
Spyware.
Software insecurity stems from various sources, primarily falling into three categories:
design flaws, coding errors, and misconfigurations. These vulnerabilities can be
introduced at any stage of the software development lifecycle.
Design Flaws
Insecure design is a fundamental source of software insecurity. If security isn't considered
from the very beginning, the software's architecture may be built on faulty assumptions,
making it inherently vulnerable, even if the code itself is bug-free.
Lack of Threat Modeling: Without systematically identifying potential threats and their
impact during the design phase, developers may fail to implement necessary security
controls, leaving the system exposed to predictable attacks.
Poor Security Architecture: This includes a failure to apply principles like least privilege
or defense in depth. An application might grant excessive permissions to a user or
6|Page
component, or it might rely on a single security control that, if bypassed, leads to a total
compromise.
Coding Errors
These are the most common source of vulnerabilities, often resulting from a lack of secure
coding practices or developer inexperience.
Input Validation Failures: This is a classic vulnerability. If an application doesn't
properly validate, filter, or sanitize user input, an attacker can inject malicious code.
Common examples include SQL injection (manipulating a database query) and
Cross-Site Scripting (XSS) (injecting malicious scripts into a web page).
Memory Management Errors: Languages like C and C++ require manual memory
management, which can lead to vulnerabilities like buffer overflows. This occurs
when a program tries to write more data into a memory buffer than it can hold,
overwriting adjacent memory and potentially allowing an attacker to execute
arbitrary code.
Insecure Cryptography: Improper use of encryption, such as using weak
algorithms, hard-coding cryptographic keys, or failing to protect sensitive data at
rest and in transit, can lead to data exposure.
As software grows in size and complexity; exploitable weaknesses will always exist,
even with secure processes.
7|Page
BENEFITS OF DETECTING SOFTWARE SECURITY DEFECTS EARLY
ROI & Cost of Security: Limited ROI data exists for fixing security flaws, but studies
show reducing defects (including security flaws) early in the SDLC leads to huge cost
savings. Fixing defects late (after release) can cost 60–100 times more than fixing them
during design.
Common Mistake: Organizations often cut quality and security practices to save time
or money, but this leads to more defects, longer schedules, and higher costs. Skipping
quality assurance during requirements, design, and testing is one of the worst decisions.
Defect Impact on Schedule: Projects with fewer defects finish faster. Poor quality
causes delays, schedule overruns, and even project cancellations (about 50% of canceled
projects cite poor quality). IBM and Capers Jones studies confirm this.
95% Defect Removal Rule: Projects that remove ≥95% of defects before release
achieve the shortest schedules, lowest cost, and highest user satisfaction. If more than
5% of defects remain, the software becomes vulnerable, costly, and delayed.
Schedule Pressure = More Defects: Excessive deadline pressure makes developers cut
corners, leading to 4× more defects. This causes rework that takes more time than the
original development.
Error-Prone Modules: A small number of modules (20% of code) cause most errors
(80%). These modules are complex, rushed, and poorly tested, and they cost 2–4× more
per function point than normal modules.
Defect Prevention Saves Time & Cost:
Reworking defective requirements, design, and code makes up 40–50% of total
project cost.
Every 1 hour spent on prevention saves 3–10 hours of repair later.
Requirements errors are especially costly: fixing them after release can cost 50–
200× more than fixing them early.
Proactively addressing quality and security early in the SDLC ensures faster
schedules, lower costs, fewer defects, and more secure software. Neglecting this leads to
delays, high expenses, and insecure products.
We now see some of the key project management and software engineering
practices to aid in accomplishing secure software.
Achieving adequate software security is not just about regulations or best practices—it
depends on the specific product, system, or service and what needs protection.
Organizations must:
Identify what value and assets must be protected, and why.
Consider the consequences if assets are not protected and how much disruption can
be tolerated.
Understand and manage residual risk (risk left after mitigation).
Develop an implementable and enforceable security strategy based on these
insights.
Since no system can protect everything, stakeholder input is crucial to determine risk
tolerance and resilience. Security as part of risk management means assessing:
What could go wrong,
How likely it is,
What impact it will have, and
What actions reduce likelihood and impact to acceptable levels.
I. Risk Identification
a. Find possible threats, vulnerabilities, and weaknesses.
b. Example: “Our login module is vulnerable to brute force attacks.”
II. Risk Assessment / Analysis
a. Determine likelihood (chance of happening) and impact (damage if it
happens).
b. Example: High likelihood + high impact = critical risk.
III. Risk Mitigation / Control
a. Take actions to reduce risks (design fixes, coding standards, patching,
extra security controls).
b. Example: Add rate-limiting and account lockout for login attempts.
IV. Risk Monitoring
a. Continuously track risks and check if mitigation is effective.
b. Example: Run penetration tests, monitor logs, review new vulnerabilities.
V. Risk Communication / Reporting
a. Share results with stakeholders (developers, managers, executives).
9|Page
b. Example: “We reduced X% of vulnerabilities; residual risk remains in Y
module.”
Software security is not just about testing at the end—it must be integrated into every phase of the
development life cycle. These practices are often called security touchpoints.
1. Requirements Phase
Define security requirements alongside functional requirements.
Use abuse/misuse cases (what could go wrong) to identify threats early.
Example: Require user authentication, data encryption, and access control policies.
2. Design / Architecture Phase
Perform architectural risk analysis → check for insecure design patterns, weak
protocols, poor trust boundaries.
Apply threat modeling → identify assets, attackers, threats, and mitigations.
Example: Use secure design principles (least privilege, defense-in-depth).
3. Implementation / Coding Phase
Enforce secure coding standards (e.g., OWASP, CERT).
Use static code analysis tools to detect vulnerabilities like buffer overflows,
injection flaws.
Example: Validate all inputs, use parameterized queries instead of string
concatenation in SQL.
4. Testing Phase
Create security test plans (risk-based testing, not just functional).
Perform code reviews, penetration testing, and fuzz testing.
Example: Try injecting malicious inputs to ensure the system rejects them.
5. Deployment & Operations Phase
Apply configuration management to avoid insecure defaults.
Ensure patch management for vulnerabilities after release.
Perform ongoing monitoring, audits, and incident response.
Example: Apply OS and library security updates, log suspicious activities.
6. Maintenance & Feedback Phase
Gather feedback from users, bug reports, and attack data.
10 | P a g e
Continuously update threat models and risk assessments.
Example: If a new attack pattern emerges, re-test the system for resilience.
Software Security:
Concept / Discipline: The field of practices, methods, and activities aimed at
protecting software from threats, vulnerabilities, and attacks.
Focus: How to design, develop, and maintain software to make it resilient against
security risks.
Example: Applying secure coding practices, threat modeling, input validation,
encryption, and security testing.
Software security is understood within the broader context of software assurance, which
involves three key qualities:
Secure Software:
End Product / Result: A software system that actually demonstrates security
properties.
Focus: The quality of the software itself – being trustworthy, predictable under
attack, and free from exploitable weaknesses.
Example: A banking app that prevents unauthorized access, protects sensitive data,
and continues working safely even under attempted attacks.
The properties by which security characteristics can be described. These properties consist
of
(1) a set of core properties whose presence (or absence) are the ground truth that
makes software secure (or not) and
(2) a set of influential properties that do not directly make software secure but do
make it possible to characterize how secure software is.
11 | P a g e
Core Property Meaning Example Attack / Violation
SQL Injection – attacker extracts
Protects data, assets, and behavior from
Confidentiality private information from
unauthorized access.
database.
Prevents unauthorized or unintended Cross-Site Scripting (XSS) –
Integrity modification of code, data, modifies web app behavior;
configuration, or behavior. Tampering with logs.
Ensures software/services are usable by
Denial of Service (DoS) or XSS
Availability authorized users when needed; blocks
causing service disruption.
unauthorized use.
Records and tracks all security-relevant Log deletion or manipulation to
Accountability
actions with attribution. hide malicious actions.
Buffer overflow with log
Non- Prevents denial of actions performed;
alteration – attacker denies
repudiation enforces accountability.
responsibility.
Definition:
A log is a file or data stream that stores time-stamped information about events, actions, or
states in a system, application, or network.
Examples of Logs:
System logs – record OS events (startup, shutdown, errors).
Application logs – record software activity (user logins, data access, errors).
Security logs – record authentication attempts, access control decisions, firewall
actions.
Audit logs – track sensitive or security-relevant operations (e.g., financial
transactions, configuration changes).
12 | P a g e
Short Answer Questions
9. Give one example of a confidentiality attack.
Answer: SQL Injection used to steal sensitive data from a database.
10. If an attacker deletes security logs, which two properties are violated?
Answer: Accountability and Integrity.
11. Why is Availability important?
Answer: It ensures that authorized users can access the system or service whenever
needed.
MEMORY-BASED ATTACKS
These attacks bypass traditional antivirus solutions that scan for file signatures. They work
by injecting or exploiting code within legitimate processes, often using vulnerabilities in
software or legitimate administrative tools like PowerShell (a powerful tool for automation
and system management very useful for admins, but also abused by attackers.). Attackers
can then gain control over the system to steal data, such as passwords or encryption keys, or
disrupt operations.
1. Initial Access
The attacker first needs a way into the system.
Common methods:
o Phishing → sending fake emails with malicious links or attachments.
o Exploiting vulnerabilities → taking advantage of weaknesses in software
(like unpatched applications).
Think of this like a thief finding an unlocked window or tricking you into opening
the door.
13 | P a g e
4. Code Injection and Execution
The attacker must execute their code inside memory. They use techniques like:
Buffer Overflow
o A memory buffer has a limited size (like a glass of water).
o If the attacker pours too much data, it “spills” into nearby memory areas.
o This lets them overwrite instructions and make the system run their own
code.
Heap Spraying
o The “heap” is a memory region where programs store data.
o Attackers fill it with malicious patterns (shellcode).
o If a vulnerability misdirects the program’s execution, it’s very likely to land
on the attacker’s code, which then runs.
6. Evasion of Detection
Traditional antivirus tools mainly scan files on disk for known malware signatures.
Since memory-based attacks avoid writing files to disk, they leave fewer traces.
This makes them harder to detect and stop.
It’s like a thief who leaves no footprints because they only walk on air.
14 | P a g e
Detect data exfiltration attempts (sensitive data leaving the network).
Unusual outbound connections to unknown IPs or domains can be a clue.
6. Use EDR/XDR Tools
Modern Endpoint Detection & Response (EDR) tools watch memory, scripts, and
system calls.
They use behavior-based detection, not just signature scanning.
They are called low-level attacks because they exploit vulnerabilities at the foundation of
program execution—memory and CPU control—rather than the higher-level logic of the
software.
Low-level means they directly manipulate raw memory addresses, CPU registers, and
execution flow.
Stack and heap are fundamental parts of the process memory layout, managed at a level
close to the hardware.
Background: Memory Layout in a Process
When a program runs, its memory is divided into different regions:
Stack → Stores local variables, function parameters, and return addresses (LIFO -
15 | P a g e
Last In First Out structure).
Heap → Stores dynamically allocated memory (malloc, new, etc.), grows as needed
during execution.
Code/Text Segment → Stores the actual program instructions.
Data Segment → Stores global/static variables.
Both stack and heap are crucial for program execution, but their dynamic and flexible
nature makes them prime targets for low-level attacks.
16 | P a g e