# yaml-language-server: $schema=../../schemas/dsomm-schema-implementation.json
---
Implementation:
Application Hardening:
App. Hardening Level 1 (50%):
uuid: b597928e-54d6-48a5-a806-8003dcd56aab
risk:
Using an insecure application might lead to a compromised application.
This might lead to total data theft or data modification.
measure: |
Following frameworks like the
* OWASP Application Security Verification Standard Level 1
* OWASP Mobile Application Security Verification Standard
in all applications provides a good baseline. Implement 50% of the recommendations.
difficultyOfImplementation:
knowledge: 2
time: 2
resources: 1
usefulness: 3
level: 1
description: |
To tackle the security of code developed in-house, OWASP offers an extensive collection of [Cheatsheets](https://cheatsheetseries.owasp.org/) demonstrating how to implement features securely. Moreover, the Security Knowledge Framework[1] offers an extensive library of code patterns spanning several programming languages. These patterns can be used to not only jumpstart the development process, but also do so securely.
[...]
### Planning aka Requirements Gathering & Analysis
The Requirements gathering process tries to answer the question: _"What is the system going to do?"_ At this stage, the [SAMM project](https://owaspsamm.org/model/) offers 3 distinct maturity levels covering both [in-house](https://owaspsamm.org/model/design/security-requirements/stream-a/) software development and [third party](https://owaspsamm.org/model/design/security-requirements/stream-b/) supplier security.

Organizations can use these to add solid security considerations at the start of the Software Development or Procurement process.
These general security considerations can be audited by using a subsection of the ASVS controls in section V1 as a questionnaire. This process attempts to ensure that every feature has concrete security considerations.
In case of internal development and if the organization maps Features to Epics, the [Security Knowledge Framework](https://securityknowledgeframework.org/) can be used to facilitate this process by leveraging its questionnaire function, shown below.
Source: [OWASP Project Integration](https://raw.githubusercontent.com/OWASP/www-project-integration-standards/master/writeups/owasp_in_sdlc/index.md)
implementation:
- $ref: src/assets/YAML/default/implementations.yaml#/implementations/owasp-asvs
- $ref: src/assets/YAML/default/implementations.yaml#/implementations/owasp-masvs
- $ref: src/assets/YAML/default/implementations.yaml#/implementations/apimaturity
- $ref: src/assets/YAML/default/implementations.yaml#/implementations/api-myths
references:
samm2:
- D-SR-A-2
iso27001-2017:
- Hardening is not explicitly covered by ISO 27001 - too specific
- 13.1.3
iso27001-2022:
- Hardening is not explicitly covered by ISO 27001 - too specific
- 8.22
comments: ""
Context-aware output encoding:
uuid: e1f37abb-d848-4a3a-b3df-65e91a89dcb7
description: |
**Input validation** stops malicious data from entering your system. \
**Output encoding** neutralizes malicious data before rendering to user, or the next system.
Input validation and output encoding work together. Apply both.
**Context-aware output encoding** encodes data differently, depending on its context. In the sample below the `{{bad_data}}` must be encoded differently, depending on its context, to render safe HTML.
```html
{{bad_data}}
Click me
```
risk:
If an attacker manages to slip though your input validation, the attacker may gain control over the user session or execute arbitrary actions.
measure: |
* Use modern secure frameworks such as React/Angular/Vue/Svelte. The default method here renders data in a safe way.
* Use established and well-maintained encoding libraries such as OWASP’s Java Encoder and Microsoft’s AntiXSS.
* Implement content security policies (CSP) to restrict the types of content that can be loaded and executed.
difficultyOfImplementation:
knowledge: 1
time: 2
resources: 1
usefulness: 3
level: 1
implementation:
- $ref: src/assets/YAML/default/implementations.yaml#/implementations/owasp-dom-xss-cheats
- $ref: src/assets/YAML/default/implementations.yaml#/implementations/cwe-838
- $ref: src/assets/YAML/default/implementations.yaml#/implementations/dompurify
references:
samm2:
- D-SR-A-1
iso27001-2017:
- Hardening is not explicitly covered by ISO 27001 - too specific
- 13.1.3
iso27001-2022:
- Hardening is not explicitly covered by ISO 27001 - too specific
- 8.22
comments: ""
Parametrization:
uuid: 00e91a8a-3972-4692-8679-674ab8547486
description: |
By concatenating strings from user input to build SQL queries, an attacker can manipulate the query to do other unintentional SQL commands as well.
This is called *SQL injection* but the principle applies to NoSql, and anywhere that your code is building commands that will be executed.
Pay attention to these two lines of code. They seem similar, but behave very differently.
* `sql.execute("SELECT * FROM table WHERE ID = " + id);`
* `sql.execute("SELECT * FROM table WHERE ID = ?", id);`
The second line is parameterized. The same principle applies to other types, such as command line execution, etc.
risk: |
Systems vulnerable to injections may lead to data breaches, loss of data,
unauthorized alteration of data, or complete database compromise or downtime.
This applies to SQL, NoSql, LDAP, XPath, email headers OS commands, etc.
measure: |
* Identify which of the types your application is using. Check that you use:
* Use _parametrized queries_ (or _prepared statements_)
* For database queries, you may also use:
* Use _stored procedures_ ()
* Use ORM (Object-Relational Mapping) tools that automatically handle input sanitization
difficultyOfImplementation:
knowledge: 1
time: 2
resources: 1
usefulness: 3
level: 1
implementation:
- $ref: src/assets/YAML/default/implementations.yaml#/implementations/owasp-parameterization-cheats
references:
samm2:
- D-SR-A-1
iso27001-2017:
- Hardening is not explicitly covered by ISO 27001 - too specific
- 13.1.3
iso27001-2022:
- Hardening is not explicitly covered by ISO 27001 - too specific
- 8.22
comments: ""
App. Hardening Level 1:
uuid: cf819225-30cb-4702-8e32-60225eedc33d
risk:
Using an insecure application might lead to a compromised application.
This might lead to total data theft or data modification.
measure: |
Following frameworks like the
* OWASP Application Security Verification Standard Level 1
* OWASP Mobile Application Security Verification Standard
in all applications provides a good baseline. Implement 95%-100% of the recommendations.
difficultyOfImplementation:
knowledge: 2
time: 2
resources: 1
usefulness: 4
level: 2
dependsOn:
- b597928e-54d6-48a5-a806-8003dcd56aab # App. Hardening Level 1 (50%)
description: |
To tackle the security of code developed in-house, OWASP offers an extensive collection of [Cheatsheets](https://cheatsheetseries.owasp.org/) demonstrating how to implement features securely. Moreover, the Security Knowledge Framework[1] offers an extensive library of code patterns spanning several programming languages. These patterns can be used to not only jump-start the development process, but also do so securely.
[...]
### Planning aka Requirements Gathering & Analysis
The Requirements gathering process tries to answer the question: _"What is the system going to do?"_ At this stage, the [SAMM project](https://owaspsamm.org/model/) offers 3 distinct maturity levels covering both [in-house](https://owaspsamm.org/model/design/security-requirements/stream-a/) software development and [third party](https://owaspsamm.org/model/design/security-requirements/stream-b/) supplier security.

Organizations can use these to add solid security considerations at the start of the Software Development or Procurement process.
These general security considerations can be audited by using a subsection of the ASVS controls in section V1 as a questionnaire. This process attempts to ensure that every feature has concrete security considerations.
In case of internal development and if the organization maps Features to Epics, the [Security Knowledge Framework](https://securityknowledgeframework.org/) can be used to facilitate this process by leveraging its questionnaire function, shown below.
Source: [OWASP Project Integration](https://raw.githubusercontent.com/OWASP/www-project-integration-standards/master/writeups/owasp_in_sdlc/index.md)
implementation:
- $ref: src/assets/YAML/default/implementations.yaml#/implementations/owasp-asvs
- $ref: src/assets/YAML/default/implementations.yaml#/implementations/owasp-masvs
- $ref: src/assets/YAML/default/implementations.yaml#/implementations/apimaturity
- $ref: src/assets/YAML/default/implementations.yaml#/implementations/api-myths
references:
samm2:
- D-SR-A-3
iso27001-2017:
- Hardening is not explicitly covered by ISO 27001 - too specific
- 13.1.3
iso27001-2022:
- Hardening is not explicitly covered by ISO 27001 - too specific
- 8.22
comments: ""
App. Hardening Level 2 (75%):
uuid: 03643ca2-03c2-472b-8e19-956bf02fe9b7
risk:
Using an insecure application might lead to a compromised application.
This might lead to total data theft or data modification.
measure: |
Following frameworks like the
* OWASP Application Security Verification Standard Level 2
* OWASP Mobile Application Security Verification Standard Level 2
Implement 75% of the recommendations.
difficultyOfImplementation:
knowledge: 3
time: 3
resources: 1
usefulness: 3
level: 3
implementation:
- $ref: src/assets/YAML/default/implementations.yaml#/implementations/owasp-asvs
- $ref: src/assets/YAML/default/implementations.yaml#/implementations/owasp-masvs
- $ref: src/assets/YAML/default/implementations.yaml#/implementations/api-myths
references:
samm2:
- D-SR-A-3
iso27001-2017:
- Hardening is not explicitly covered by ISO 27001 - too specific
- 13.1.3
iso27001-2022:
- Hardening is not explicitly covered by ISO 27001 - too specific
- 8.22
comments: ""
dependsOn:
- cf819225-30cb-4702-8e32-60225eedc33d # App. Hardening Level 1
App. Hardening Level 2:
uuid: ffe86caf-2fec-4630-b514-2db83983984d
risk:
Using an insecure application might lead to a compromised application.
This might lead to total data theft or data modification.
measure: |
Following frameworks like the
* OWASP Application Security Verification Standard Level 2
* OWASP Mobile Application Security Verification Standard Level 2
Implement 95%-100% of the recommendations.
difficultyOfImplementation:
knowledge: 3
time: 3
resources: 1
usefulness: 3
level: 4
implementation:
- $ref: src/assets/YAML/default/implementations.yaml#/implementations/owasp-asvs
- $ref: src/assets/YAML/default/implementations.yaml#/implementations/owasp-masvs
references:
samm2:
- D-SR-A-2
iso27001-2017:
- Hardening is not explicitly covered by ISO 27001 - too specific
- 13.1.3
iso27001-2022:
- Hardening is not explicitly covered by ISO 27001 - too specific
- 8.22
comments: ""
dependsOn:
- 03643ca2-03c2-472b-8e19-956bf02fe9b7 # App. Hardening Level 2 (75%)
App. Hardening Level 3:
uuid: 4cae98c2-4163-44ed-bb88-3c67c569533a
risk:
Using an insecure application might lead to a compromised application.
This might lead to total data theft or data modification.
measure: |
Following frameworks like the
* OWASP Application Security Verification Standard Level 3
* OWASP Mobile Application Security Verification Standard
Implement 95%-100% of the recommendations.
difficultyOfImplementation:
knowledge: 4
time: 4
resources: 2
usefulness: 4
level: 5
implementation:
- $ref: src/assets/YAML/default/implementations.yaml#/implementations/owasp-asvs
- $ref: src/assets/YAML/default/implementations.yaml#/implementations/owasp-masvs
references:
samm2:
- D-SR-A-3
iso27001-2017:
- Hardening is not explicitly covered by ISO 27001 - too specific
- 13.1.3
iso27001-2022:
- Hardening is not explicitly covered by ISO 27001 - too specific
- 8.22
dependsOn:
- ffe86caf-2fec-4630-b514-2db83983984d # App. Hardening Level 2
Secure headers:
uuid: 29318d60-18ce-4526-80ea-f5928e49f639
description: |
Essential headers:
- Content-Security-Policy: Define trusted sources for content
- Strict-Transport-Security: Enforce HTTPS connections
- X-Frame-Options: Prevent clickjacking attacks
- X-Content-Type-Options: Prevent MIME-type sniffing
- X-XSS-Protection: Enable browser's XSS filtering
- Referrer-Policy: Control information in the Referrer header
risk: |
Missing or misconfigured security headers can lead to various security vulnerabilities, e.g.:
- Cross-Site Scripting (XSS) due to missing Content Security Policy
- Clickjacking attacks due to missing X-Frame-Options
- Information disclosure through Server header exposure
- SSL/TLS downgrade attacks due to missing HSTS
- Cross-site scripting and injection due to missing security headers
measure: |
Implement and enforce security headers across all applications and services
Implementation Methods:
1. Reverse Proxy/Load Balancer: Configure at nginx/Apache level
2. Web Application: Implement in the application middleware
3. Service Mesh: Configure at the ingress controller level
4. Standard Docker Image: Use secure base images with preset headers
Remove or Secure:
- Server header: Hide server version information
- X-Powered-By: Remove technology stack information
difficultyOfImplementation:
knowledge: 2
time: 1
resources: 2
usefulness: 4
level: 3
implementation:
- $ref: src/assets/YAML/default/implementations.yaml#/implementations/owasp-secure-headers
references:
samm2:
- O-EM-A-2
iso27001-2017:
- Hardening is not explicitly covered by ISO 27001 - too specific
- 13.1.3
iso27001-2022:
- Hardening is not explicitly covered by ISO 27001 - too specific
- 8.22
openCRE:
- https://www.opencre.org/cre/620-421
Containers are running as non-root:
uuid: a86c1fbc-28fd-4610-89a3-a7f73acfe45f
risk: |-
There are various reasons to run a container as non-root. Samples are listed:
## Container Escape Vectors
- Root privileges significantly increase the chance of breaking container isolation
- Root access can be leveraged to exploit kernel vulnerabilities
- Compromised root containers provide attackers with maximum privileges inside the container
- Greater potential for escaping container boundaries to the host system
## Host System Vulnerabilities
Root containers can potentially:
- Mount sensitive host filesystems
- Access critical device files
- Modify host network settings
- Interact with host system processes
- Override security controls
## Resource Management Issues
Root privileges may allow containers to:
- Bypass resource quotas and limits
- Modify control group (cgroup) settings
- Interfere with other containers' resources
- Circumvent memory and CPU restrictions
Security Boundary Weakening
- Violates the principle of least privilege
- Provides unnecessary elevated permissions
- Expands the potential attack surface
- Increases the impact of a successful compromise
measure: |-
Containers are running as non-root. This can be enforced in the image itself or during runtime parameters
(e.g. `podman run --user [...]`).
difficultyOfImplementation:
knowledge: 2
time: 2
resources: 1
usefulness: 3
level: 2
implementation: []
references:
samm2:
- O-EM-A-1
iso27001-2017:
- Virtual environments are not explicitly covered by ISO 27001 - too specific
- 13.1.3
iso27001-2022:
- Virtual environments are not explicitly covered by ISO 27001 - too specific
- 8.22