8000 Added optional `mitigation` attribute to findings by Ilyesbdlala · Pull Request #1639 · secureCodeBox/secureCodeBox · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,7 @@ Demand for the scanner was low and AngularJS (1.x) has been officially [deprecat

➡️ [Reference: #1649](https://github.com/secureCodeBox/secureCodeBox/pull/1649)

### Renamed the scanners ssh-scan and sslyze `hint` to `mitigation`
We added a new attribute to the finding format called `mitigation` which is used to store information about how to mitigate the finding/issue. The `hint` attribute of the findings of the scanners `ssh-scan` and `sslyze` has been renamed to `mitigation` to be more consistent with the other scanners.

➡️ [Reference: #1639](https://github.com/secureCodeBox/secureCodeBox/pull/1639)
5 changes: 5 additions & 0 deletions parser-sdk/nodejs/findings-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@
"HIGH"
]
},
"mitigation": {
"description": "Contains a short description of how to mitigate the issue.",
"type": "string",
"nullable": true
},
"attributes": {
"description": "Attributes are not standardized. They differ from Scanner to Scanner.",
"type": "object"
Expand Down
1 change: 1 addition & 0 deletions scanners/ncrack/parser/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ function transformToFindings (ncrackrun, publicKey) {
location: `${portName}://${ipAddress}:${portid}`,
osi_layer: 'APPLICATION',
severity: 'HIGH',
mitigation: 'Use a more secure password or disable the service at ' + `${portName}://${ipAddress}:${portid}`,
attributes: {
port: portid,
ip_address: ipAddress,
Expand Down
109 changes: 56 additions & 53 deletions scanners/ncrack/parser/parser.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: Apache-2.0

const { parse } = require("./parser");
const {parse} = require("./parser");
const fs = require("fs");
const crypto = require("crypto");
const {
Expand Down Expand Up @@ -34,23 +34,24 @@ it("should return findings when ncrack found credentials", async () => {
await expect(validateParser(findings)).resolves.toBeUndefined();
const [finding, ...otherFindings] = findings;
expect(finding).toMatchInlineSnapshot(`
{
"attributes": {
"ip_address": "192.168.0.1",
"password": "aaf076d4fe7cfb63fd1628df91",
"port": "22",
"protocol": "tcp",
"service": "ssh",
"username": "root",
},
"category": "Discovered Credentials",
"description": "",
"location": "ssh://192.168.0.1:22",
"name": "Credentials for Service ssh://192.168.0.1:22 discovered via bruteforce.",
"osi_layer": "APPLICATION",
"severity": "HIGH",
}
`);
{
"attributes": {
"ip_address": "192.168.0.1",
"password": "aaf076d4fe7cfb63fd1628df91",
"port": "22",
"protocol": "tcp",
"service": "ssh",
"username": "root",
},
"category": "Discovered Credentials",
"description": "",
"location": "ssh://192.168.0.1:22",
"mitigation": "Use a more secure password or disable the service at ssh://192.168.0.1:22",
"name": "Credentials for Service ssh://192.168.0.1:22 discovered via bruteforce.",
"osi_layer": "APPLICATION",
"severity": "HIGH",
}
`);
expect(otherFindings.length).toBe(0);
});

Expand Down Expand Up @@ -79,41 +80,43 @@ it("should return findings when ncrack found two credentials scanning two servic
const findings = await parse(ncrackXML);
await expect(validateParser(findings)).resolves.toBeUndefined();
expect(findings).toMatchInlineSnapshot(`
[
{
"attributes": {
"ip_address": "192.168.0.2",
"password": "55994bcdabd8b0b69d4cb32919",
"port": "22",
"protocol": "tcp",
"service": "ssh",
"username": "root",
},
"category": "Discovered Credentials",
"description": "",
"location": "ssh://192.168.0.2:22",
"name": "Credentials for Service ssh://192.168.0.2:22 discovered via bruteforce.",
"osi_layer": "APPLICATION",
"severity": "HIGH",
},
{
"attributes": {
"ip_address": "192.168.0.1",
"password": "2a4707625af87d8d4302ad226d",
"port": "22",
"protocol": "tcp",
"service": "ssh",
"username": "root",
},
"category": "Discovered Credentials",
"description": "",
"location": "ssh://192.168.0.1:22",
"name": "Credentials for Service ssh://192.168.0.1:22 discovered via bruteforce.",
"osi_layer": "APPLICATION",
"severity": "HIGH",
},
]
`);
[
{
"attributes": {
"ip_address": "192.168.0.2",
"password": "55994bcdabd8b0b69d4cb32919",
"port": "22",
"protocol": "tcp",
"service": "ssh",
"username": "root",
},
"category": "Discovered Credentials",
"description": "",
"location": "ssh://192.168.0.2:22",
"mitigation": "Use a more secure password or disable the service at ssh://192.168.0.2:22",
"name": "Credentials for Service ssh://192.168.0.2:22 discovered via bruteforce.",
"osi_layer": "APPLICATION",
"severity": "HIGH",
},
{
"attributes": {
"ip_address": "192.168.0.1",
"password": "2a4707625af87d8d4302ad226d",
"port": "22",
"protocol": "tcp",
"service": "ssh",
"username": "root",
},
"category": "Discovered Credentials",
"description": "",
"location": "ssh://192.168.0.1:22",
"mitigation": "Use a more secure password or disable the service at ssh://192.168.0.1:22",
"name": "Credentials for Service ssh://192.168.0.1:22 discovered via bruteforce.",
"osi_layer": "APPLICATION",
"severity": "HIGH",
},
]
`);
});

it("should encrypt findings when a public key is set", async () => {
Expand Down
4 changes: 2 additions & 2 deletions scanners/ssh-scan/parser/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function createPolicyViolationFinding({
osi_layer: "NETWORK",
severity: "MEDIUM",
reference: {},
hint: recommendation,
mitigation: recommendation,
location: hostname || ipAddress,
attributes: {
hostname: hostname,
Expand Down Expand Up @@ -180,7 +180,7 @@ async function parse(fileContent) {
osi_layer: "APPLICATION",
severity: "INFORMATIONAL",
reference: {},
hint: "",
mitigation: null,
location: location,
attributes: {
hostname: host.hostname || null,
Expand Down
14 changes: 7 additions & 7 deletions scanners/ssh-scan/parser/parser.test.js
< B94A td id="diff-8f79bc165d3bfb2b3802b718995eed09fc3fbb6aa6b971a84c05779e3cf6d3e3L108" data-line-number="108" class="blob-num blob-num-context js-linkable-line-number">
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ test("ssh-scan parser parses a proper result to proper findings", async () => {
},
"category": "SSH Service",
"description": "SSH Service Information",
"hint": "",
"identified_at": "2019-10-03T16:28:09.000Z",
"location": "securecodebox.io",
"mitigation": null,
"name": "SSH Service",
"osi_layer": "APPLICATION",
"reference": {},
Expand All @@ -104,8 +104,8 @@ test("ssh-scan parser parses a proper result to proper findings", async () => {
},
"category": "SSH Policy Violation",
"description": "Deprecated / discouraged SSH key algorithms are used",
"hint": "Remove these key exchange algorithms: diffie-hellman-group14-sha1",
"location": "securecodebox.io",
"mitigation": "Remove these key exchange algorithms: diffie-hellman-group14-sha1",
"name": "Insecure SSH Key Algorithms",
"osi_layer": "NETWORK",
"reference": {},
Expand All @@ -124,8 +124,8 @@ test("ssh-scan parser parses a proper result to proper findings", async () => {
},
"category": "SSH Policy Violation",
"description": "Deprecated / discouraged SSH MAC algorithms are used",
"hint": "Remove these MAC algorithms: umac-64-etm@openssh.com, hmac-sha1-etm@openssh.com, umac-64@openssh.com, hmac-sha1",
"location": "securecodebox.io",
"mitigation": "Remove these MAC algorithms: umac-64-etm@openssh.com, hmac-sha1-etm@openssh.com, umac-64@openssh.com, hmac-sha1",
"name": "Insecure SSH MAC Algorithms",
"osi_layer": "NETWORK",
"reference": {},
Expand Down Expand Up @@ -198,9 +198,9 @@ test("ssh-scan parser parses a result without a hostname into proper findings",
},
"category": "SSH Service",
"description": "SSH Service Information",
"hint": "",
"identified_at": "2019-10-03T16:37:12.000Z",
"location": "192.168.42.42",
"mitigation": null,
"name": "SSH Service",
"osi_layer": "APPLICATION",
"reference": {},
Expand All @@ -216,8 +216,8 @@ test("ssh-scan parser parses a result without a hostname into proper findings",
},
"category": "SSH Policy Violation",
"description": "Deprecated / discouraged SSH key algorithms are used",
"hint": "Remove these key exchange algorithms: diffie-hellman-group14-sha1",
"location": "192.168.42.42",
"mitigation": "Remove these key exchange algorithms: diffie-hellman-group14-sha1",
"name": "Insecure SSH Key Algorithms",
"osi_layer": "NETWORK",
"reference": {},
Expand All @@ -236,8 +236,8 @@ test("ssh-scan parser parses a result without a hostname into proper findings",
},
"category": "SSH Policy Violation",
"description": "Deprecated / discouraged SSH MAC algorithms are used",
"hint": "Remove these MAC algorithms: umac-64-etm@openssh.com, hmac-sha1-etm@openssh.com, umac-64@openssh.com, hmac-sha1",
"location": "192.168.42.42",
"mitigation": "Remove these MAC algorithms: umac-64-etm@openssh.com, hmac-sha1-etm@openssh.com, umac-64@openssh.com, hmac-sha1",
"name": "Insecure SSH MAC Algorithms",
"osi_layer": "NETWORK",
"reference": {},
Expand All @@ -253,8 +253,8 @@ test("ssh-scan parser parses a result without a hostname into proper findings",
},
"category": "SSH Policy Violation",
"description": "Discouraged SSH authentication methods are used",
"hint": "Remove these authentication methods: password",
"location": "192.168.42.42",
"mitigation": "Remove these authentication methods: password",
"name": "Discouraged SSH authentication methods",
"osi_layer": "NETWORK",
"reference": {},
Expand Down
6 changes: 3 additions & 3 deletions scanners/sslyze/parser/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function generateInformationalServiceFinding(serverScanResult) {
identified_at: serverScanResult.identified_at,
category: "TLS Service Info",
severity: "INFORMATIONAL",
hint: null,
mitigation: null,
attributes: {
8EB7 tls_versions: getAllSupportedTlsVersions(serverScanResult),
cipher_suites: getAllAcceptedCipherSuites(serverScanResult),
Expand All @@ -141,7 +141,7 @@ function generateVulnerableTLSVersionFindings(serverScanResult) {
description: "The server uses outdated or insecure tls versions.",
identified_at: serverScanResult.identified_at,
severity: "MEDIUM",
hint: "Upgrade to a higher tls version.",
mitigation: "Upgrade to a higher tls version.",
attributes: {
outdated_version: tlsVersion,
},
Expand Down Expand Up @@ -197,7 +197,7 @@ function analyseCertificateDeployments(serverScanResult) {
description: findingTemplate.description,
identified_at: serverScanResult.identified_at,
severity: "MEDIUM",
hint: null,
mitigation: null,
attributes: {},
};
});
Expand Down
Loading
0