diff --git a/backend/src/api/app.ts b/backend/src/api/app.ts index b9e4e99fd..0bbd3242f 100644 --- a/backend/src/api/app.ts +++ b/backend/src/api/app.ts @@ -290,11 +290,8 @@ authenticatedRoute.delete('/api-keys/:keyId', handlerToExpress(apiKeys.del)); authenticatedRoute.post('/search', handlerToExpress(search.search)); authenticatedRoute.post('/search/export', handlerToExpress(search.export_)); authenticatedRoute.get('/cpes/:id', handlerToExpress(cpes.get)); -authenticatedRoute.get('/cves/:cve_uid', handlerToExpress(cves.get)); -authenticatedRoute.get( - '/cves/name/:cve_name', - handlerToExpress(cves.getByName) -); +authenticatedRoute.get('/cves/:id', handlerToExpress(cves.get)); +authenticatedRoute.get('/cves/name/:name', handlerToExpress(cves.getByName)); authenticatedRoute.post('/domain/search', handlerToExpress(domains.list)); authenticatedRoute.post('/domain/export', handlerToExpress(domains.export_)); authenticatedRoute.get('/domain/:domainId', handlerToExpress(domains.get)); diff --git a/backend/src/api/cpes.ts b/backend/src/api/cpes.ts index 565c4c9dd..dd7a825a6 100644 --- a/backend/src/api/cpes.ts +++ b/backend/src/api/cpes.ts @@ -1,4 +1,4 @@ -import { ProductInfo, connectToDatabase } from '../models'; +import { Cpe, connectToDatabase } from '../models'; import { wrapHandler, NotFound } from './helpers'; // TODO: Join cves to cpe get method @@ -20,20 +20,19 @@ import { wrapHandler, NotFound } from './helpers'; */ export const get = wrapHandler(async (event) => { const connection = await connectToDatabase(); - const repository = connection.getRepository(ProductInfo); - const id = event.pathParameters?.id; - if (!id) { - return NotFound; - } - const productInfo = await repository.findOne(id); - if (!productInfo) { + const cpe = await Cpe.createQueryBuilder('cpe') + .leftJoinAndSelect('cpe.cves', 'cve') + .where('cpe.id = :id', { id: id }) + .getOne(); + + if (!cpe) { return NotFound; } return { statusCode: 200, - body: JSON.stringify(productInfo) + body: JSON.stringify(cpe) }; }); diff --git a/backend/src/api/cves.ts b/backend/src/api/cves.ts index b7415c5ff..f6bcef6a0 100644 --- a/backend/src/api/cves.ts +++ b/backend/src/api/cves.ts @@ -1,37 +1,34 @@ import { Cve, connectToDatabase } from '../models'; -import { wrapHandler } from './helpers'; +import { NotFound, wrapHandler } from './helpers'; -// TODO: Add test for joining product_info +// TODO: Add test for joining cpe table // TODO: Create CveFilters and CveSearch classes to handle filtering and pagination of additional fields /** * @swagger - * /cves/{cve_uid}: + * /cves/{id}: * get: * description: Retrieve a CVE by ID. * tags: * - CVEs * parameters: * - in: path - * name: cve_uid + * name: id * required: true * schema: * type: string */ export const get = wrapHandler(async (event) => { await connectToDatabase(); - const cve_uid = event.pathParameters?.cve_uid; + const id = event.pathParameters?.id; const cve = await Cve.createQueryBuilder('cve') - .leftJoinAndSelect('cve.product_info', 'product_info') - .where('cve.cve_uid = :cve_uid', { cve_uid: cve_uid }) + .leftJoinAndSelect('cve.cpes', 'cpe') + .where('cve.id = :id', { id: id }) .getOne(); if (!cve) { - return { - statusCode: 404, - body: JSON.stringify(Error) - }; + return NotFound; } return { @@ -44,13 +41,13 @@ export const get = wrapHandler(async (event) => { /** * @swagger * - * /cves/name/{cve_name}: + * /cves/name/{name}: * get: * description: Retrieve a single CVE record by its name. * tags: * - CVE * parameters: - * - name: cve_name + * - name: name * in: path * required: true * schema: @@ -58,18 +55,15 @@ export const get = wrapHandler(async (event) => { */ export const getByName = wrapHandler(async (event) => { await connectToDatabase(); - const cve_name = event.pathParameters?.cve_name; + const name = event.pathParameters?.name; const cve = await Cve.createQueryBuilder('cve') - .leftJoinAndSelect('cve.product_info', 'product_info') - .where('cve.cve_name = :cve_name', { cve_name }) + .leftJoinAndSelect('cve.cpes', 'cpe') + .where('cve.name = :name', { name: name }) .getOne(); if (!cve) { - return { - statusCode: 404, - body: JSON.stringify(Error) - }; + return NotFound; } return { diff --git a/backend/src/models/connection.ts b/backend/src/models/connection.ts index 1b289c460..ec8c8cd35 100644 --- a/backend/src/models/connection.ts +++ b/backend/src/models/connection.ts @@ -12,7 +12,7 @@ import { ApiKey, SavedSearch, OrganizationTag, - ProductInfo, + Cpe, Cve } from '.'; @@ -27,7 +27,7 @@ const connectDb = async (logging?: boolean) => { password: process.env.DB_PASSWORD, database: process.env.DB_NAME, entities: [ - ProductInfo, + Cpe, Cve, Domain, Service, diff --git a/backend/src/models/cpe.ts b/backend/src/models/cpe.ts new file mode 100644 index 000000000..ac18be70b --- /dev/null +++ b/backend/src/models/cpe.ts @@ -0,0 +1,31 @@ +import { + Entity, + PrimaryGeneratedColumn, + Column, + ManyToMany, + BaseEntity, + Unique +} from 'typeorm'; +import { Cve } from './cve'; + +@Entity() +@Unique(['name', 'version', 'vendor']) +export class Cpe extends BaseEntity { + @PrimaryGeneratedColumn('uuid') + id: string; + + @Column() + name: string; + + @Column() + version: string; + + @Column() + vendor: string; + + @Column() + lastSeenAt: Date; + + @ManyToMany(() => Cve, (cve) => cve.cpes) + cves: Cve[]; +} diff --git a/backend/src/models/cve.ts b/backend/src/models/cve.ts index 3240e012e..4eda5fd25 100644 --- a/backend/src/models/cve.ts +++ b/backend/src/models/cve.ts @@ -2,121 +2,116 @@ import { Entity, PrimaryGeneratedColumn, Column, - CreateDateColumn, - UpdateDateColumn, ManyToMany, BaseEntity, JoinTable, Unique } from 'typeorm'; -import { ProductInfo } from './product-info'; +import { Cpe } from './cpe'; //TODO: Refactor column names to camelCase to match the rest of the codebase? @Entity() -@Unique(['cve_name']) +@Unique(['name']) export class Cve extends BaseEntity { @PrimaryGeneratedColumn('uuid') - cve_uid: string; //TODO: Refactor to id to match other UUIDs? + id: string; @Column({ nullable: true }) - cve_name: string; + name: string; - @CreateDateColumn() - published_date: Date; + @Column({ nullable: true }) + publishedAt: Date; - @UpdateDateColumn() - last_modified_date: Date; + @Column({ nullable: true }) + modifiedAt: Date; @Column({ nullable: true }) - vuln_status: string; + status: string; @Column({ nullable: true }) description: string; @Column({ nullable: true }) - cvss_v2_source: string; + cvssV2Source: string; @Column({ nullable: true }) - cvss_v2_type: string; + cvssV2Type: string; @Column({ nullable: true }) - cvss_v2_version: string; + cvssV2Version: string; @Column({ nullable: true }) - cvss_v2_vector_string: string; + cvssV2VectorString: string; @Column({ nullable: true }) - cvss_v2_base_score: string; + cvssV2BaseScore: string; @Column({ nullable: true }) - cvss_v2_base_severity: string; + cvssV2BaseSeverity: string; @Column({ nullable: true }) - cvss_v2_exploitability_score: string; + cvssV2ExploitabilityScore: string; @Column({ nullable: true }) - cvss_v2_impact_score: string; + cvssV2ImpactScore: string; @Column({ nullable: true }) - cvss_v3_source: string; + cvssV3Source: string; @Column({ nullable: true }) - cvss_v3_type: string; + cvssV3Type: string; @Column({ nullable: true }) - cvss_v3_version: string; + cvssV3Version: string; @Column({ nullable: true }) - cvss_v3_vector_string: string; + cvssV3VectorString: string; @Column({ nullable: true }) - cvss_v3_base_score: string; + cvssV3BaseScore: string; @Column({ nullable: true }) - cvss_v3_base_severity: string; + cvssV3BaseSeverity: string; @Column({ nullable: true }) - cvss_v3_exploitability_score: string; + cvssV3ExploitabilityScore: string; @Column({ nullable: true }) - cvss_v3_impact_score: string; + cvssV3ImpactScore: string; @Column({ nullable: true }) - cvss_v4_source: string; + cvssV4Source: string; @Column({ nullable: true }) - cvss_v4_type: string; + cvssV4Type: string; @Column({ nullable: true }) - cvss_v4_version: string; + cvssV4Version: string; @Column({ nullable: true }) - cvss_v4_vector_string: string; + cvssV4VectorString: string; @Column({ nullable: true }) - cvss_v4_base_score: string; + cvssV4BaseScore: string; @Column({ nullable: true }) - cvss_v4_base_severity: string; + cvssV4BaseSeverity: string; @Column({ nullable: true }) - cvss_v4_exploitability_score: string; + cvssV4ExploitabilityScore: string; @Column({ nullable: true }) - cvss_v4_impact_score: string; + cvssV4ImpactScore: string; @Column('simple-array', { nullable: true }) weaknesses: string[]; @Column('simple-array', { nullable: true }) - reference_urls: string[]; - - @Column('simple-array', { nullable: true }) - cpe_list: string[]; + references: string[]; - @ManyToMany(() => ProductInfo, (product_info) => product_info.cve, { + @ManyToMany(() => Cpe, (cpe) => cpe.cves, { cascade: true }) @JoinTable() - product_info: ProductInfo[]; + cpes: Cpe[]; } diff --git a/backend/src/models/index.ts b/backend/src/models/index.ts index 84acd5e45..310cfb768 100644 --- a/backend/src/models/index.ts +++ b/backend/src/models/index.ts @@ -1,6 +1,6 @@ export * from './domain'; export * from './cve'; -export * from './product-info'; +export * from './cpe'; export * from './service'; export * from './connection'; export * from './vulnerability'; diff --git a/backend/src/models/product-info.ts b/backend/src/models/product-info.ts deleted file mode 100644 index 8df42b09c..000000000 --- a/backend/src/models/product-info.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { - Entity, - PrimaryGeneratedColumn, - Column, - ManyToMany, - BaseEntity, - Unique -} from 'typeorm'; -import { Cve } from './cve'; - -//TODO: Refactor column names to camelCase to match the rest of the codebase? -//TODO: Refactor table name to product or cpe for brevity? -@Entity() -@Unique(['cpe_product_name', 'version_number', 'vender']) -export class ProductInfo extends BaseEntity { - @PrimaryGeneratedColumn('uuid') - id: string; - - @Column() - cpe_product_name: string; - - @Column() - version_number: string; - - @Column() - vender: string; - - @Column() - last_seen: Date; - - @ManyToMany((type) => Cve, (cve) => cve.product_info) - cve: Cve[]; -} diff --git a/backend/src/tasks/cve-sync.ts b/backend/src/tasks/cve-sync.ts index 2f5ca5f69..a33f25e99 100644 --- a/backend/src/tasks/cve-sync.ts +++ b/backend/src/tasks/cve-sync.ts @@ -1,10 +1,8 @@ -import { ProductInfo, Cve } from '../models'; +import { Cpe, Cve } from '../models'; import axios from 'axios'; -import { CommandOptions } from './ecs-client'; import saveCpesToDb from './helpers/saveCpesToDb'; import saveCvesToDb from './helpers/saveCvesToDb'; import { plainToClass } from 'class-transformer'; -import * as c from 'wappalyzer/technologies/c.json'; interface CpeProduct { cpe_product_name: string; @@ -12,39 +10,38 @@ interface CpeProduct { vender: string; } interface CveEntry { - cve_uid: string; - cve_name: string; - published_date: string; - last_modified_date: string; - vuln_status: string; - description: string; - cvss_v2_source: string; - cvss_v2_type: string; - cvss_v2_version: string; - cvss_v2_vector_string: string; - cvss_v2_base_score: number; - cvss_v2_base_severity: string; - cvss_v2_exploitability_score: number; - cvss_v2_impact_score: number; - cvss_v3_source: string; - cvss_v3_type: string; - cvss_v3_version: string; - cvss_v3_vector_string: string; - cvss_v3_base_score: number; - cvss_v3_base_severity: string; - cvss_v3_exploitability_score: number; - cvss_v3_impact_score: number; - cvss_v4_source: string; - cvss_v4_type: string; - cvss_v4_version: string; - cvss_v4_vector_string: string; - cvss_v4_base_score: number; - cvss_v4_base_severity: string; - cvss_v4_exploitability_score: number; - cvss_v4_impact_score: number; + cve_uid?: string | null; + cve_name: string | null; + published_date?: string | null; + last_modified_date?: string | null; + vuln_status?: string | null; + description?: string | null; + cvss_v2_source?: string | null; + cvss_v2_type?: string | null; + cvss_v2_version?: string | null; + cvss_v2_vector_string?: string | null; + cvss_v2_base_score?: number | null; + cvss_v2_base_severity?: string | null; + cvss_v2_exploitability_score?: number | null; + cvss_v2_impact_score?: number | null; + cvss_v3_source?: string | null; + cvss_v3_type?: string | null; + cvss_v3_version?: string | null; + cvss_v3_vector_string?: string | null; + cvss_v3_base_score?: number | null; + cvss_v3_base_severity?: string | null; + cvss_v3_exploitability_score?: number | null; + cvss_v3_impact_score?: number | null; + cvss_v4_source?: string | null; + cvss_v4_type?: string | null; + cvss_v4_version?: string | null; + cvss_v4_vector_string?: string | null; + cvss_v4_base_score?: number | null; + cvss_v4_base_severity?: string | null; + cvss_v4_exploitability_score?: number | null; + cvss_v4_impact_score?: number | null; weaknesses: string[]; reference_urls: string[]; - cpe_list: string[]; vender_product: { [key: string]: CpeProduct[] }; } interface CvssEndpointResponse { @@ -71,7 +68,7 @@ const fetchCveData = async (page: number) => { }, data: { page: page, - per_page: 200 + per_page: 100 // Tested with 150 and 200 but this results in 502 errors on certain pages with a lot of CPEs } }); if (response.status >= 200 && response.status < 300) { @@ -111,7 +108,7 @@ async function main() { let page = 1; let total_pages = 2; - while (done == false) { + while (!done) { let taskRequest = await fetchCveData(page); console.log(`Fetching page ${page} of page ${total_pages}`); await new Promise((r) => setTimeout(r, 1000)); @@ -126,61 +123,7 @@ async function main() { console.log(`Task completed successfully for page: ${page}`); const cveArray = taskRequest?.result?.data || []; //TODO, change this to CveEntry[] - - for (const cve of cveArray) { - const cpeArray: ProductInfo[] = []; - for (const vender in cve.vender_product) { - for (const product of cve.vender_product[vender]) { - cpeArray.push( - plainToClass(ProductInfo, { - cpe_product_name: product.cpe_product_name, - version_number: product.version_number, - vender: product.vender, - last_seen: new Date(Date.now()) - }) - ); - } - } - const ids: string[] = await saveCpesToDb(cpeArray); - //SAVE CVE TO DATABASE - const cvesId: string = await saveCvesToDb( - plainToClass(Cve, { - cve_name: cve.cve_name, - published_date: new Date(cve.published_date), - last_modified_date: new Date(cve.last_modified_date), - vuln_status: cve.vuln_status, - description: cve.description, - cvss_v2_source: cve.cvss_v2_source, - cvss_v2_type: cve.cvss_v2_type, - cvss_v2_version: cve.cvss_v2_version, - cvss_v2_vector_string: cve.cvss_v2_vector_string, - cvss_v2_base_score: cve.cvss_v2_base_score, - cvss_v2_base_severity: cve.cvss_v2_base_severity, - cvss_v2_exploitability_score: cve.cvss_v2_exploitability_score, - cvss_v2_impact_score: cve.cvss_v2_impact_score, - cvss_v3_source: cve.cvss_v3_source, - cvss_v3_type: cve.cvss_v3_type, - cvss_v3_version: cve.cvss_v3_version, - cvss_v3_vector_string: cve.cvss_v3_vector_string, - cvss_v3_base_score: cve.cvss_v3_base_score, - cvss_v3_base_severity: cve.cvss_v3_base_severity, - cvss_v3_exploitability_score: cve.cvss_v3_exploitability_score, - cvss_v3_impact_score: cve.cvss_v3_impact_score, - cvss_v4_source: cve.cvss_v4_source, - cvss_v4_type: cve.cvss_v4_type, - cvss_v4_version: cve.cvss_v4_version, - cvss_v4_vector_string: cve.cvss_v4_vector_string, - cvss_v4_base_score: cve.cvss_v4_base_score, - cvss_v4_base_severity: cve.cvss_v4_base_severity, - cvss_v4_exploitability_score: cve.cvss_v4_exploitability_score, - cvss_v4_impact_score: cve.cvss_v4_impact_score, - weaknesses: cve.weaknesses, - reference_urls: cve.reference_urls, - cpe_list: cve.cpe_list - }), - ids - ); - } + await saveToDb(cveArray); total_pages = taskRequest?.result?.total_pages || 1; const current_page = taskRequest?.result?.current_page || 1; if (current_page >= total_pages) { @@ -200,3 +143,59 @@ async function main() { export const handler = async (CommandOptions) => { await main(); }; + +export const saveToDb = async (cveArray: CveEntry[]) => { + for (const cve of cveArray) { + const cpeArray: Cpe[] = []; + for (const vender in cve.vender_product) { + for (const product of cve.vender_product[vender] as CpeProduct[]) { + cpeArray.push( + plainToClass(Cpe, { + name: product.cpe_product_name, + version: product.version_number, + vendor: product.vender, + lastSeenAt: new Date(Date.now()) + }) + ); + } + } + const ids: string[] = await saveCpesToDb(cpeArray); + //SAVE CVE TO DATABASE + await saveCvesToDb( + plainToClass(Cve, { + name: cve.cve_name, + publishedAt: new Date(cve.published_date!), + modifiedAt: new Date(cve.last_modified_date!), + status: cve.vuln_status, + description: cve.description, + cvssV2Source: cve.cvss_v2_source, + cvssV2Type: cve.cvss_v2_type, + cvssV2Version: cve.cvss_v2_version, + cvssV2VectorString: cve.cvss_v2_vector_string, + cvssV2BaseScore: cve.cvss_v2_base_score, + cvssV2BaseSeverity: cve.cvss_v2_base_severity, + cvssV2ExploitabilityScore: cve.cvss_v2_exploitability_score, + cvssV2ImpactScore: cve.cvss_v2_impact_score, + cvssV3Source: cve.cvss_v3_source, + cvssV3Type: cve.cvss_v3_type, + cvssV3Version: cve.cvss_v3_version, + cvssV3VectorString: cve.cvss_v3_vector_string, + cvssV3BaseScore: cve.cvss_v3_base_score, + cvssV3BaseSeverity: cve.cvss_v3_base_severity, + cvssV3ExploitabilityScore: cve.cvss_v3_exploitability_score, + cvssV3ImpactScore: cve.cvss_v3_impact_score, + cvssV4Source: cve.cvss_v4_source, + cvssV4Type: cve.cvss_v4_type, + cvssV4Version: cve.cvss_v4_version, + cvssV4VectorString: cve.cvss_v4_vector_string, + cvssV4BaseScore: cve.cvss_v4_base_score, + cvssV4BaseSeverity: cve.cvss_v4_base_severity, + cvssV4ExploitabilityScore: cve.cvss_v4_exploitability_score, + cvssV4ImpactScore: cve.cvss_v4_impact_score, + weaknesses: cve.weaknesses, + references: cve.reference_urls + }), + ids + ); + } +}; diff --git a/backend/src/tasks/helpers/saveCpesToDb.ts b/backend/src/tasks/helpers/saveCpesToDb.ts index 7d5463f46..999fecdfc 100644 --- a/backend/src/tasks/helpers/saveCpesToDb.ts +++ b/backend/src/tasks/helpers/saveCpesToDb.ts @@ -1,27 +1,25 @@ -import { connectToDatabase, ProductInfo } from '../../models'; +import { connectToDatabase, Cpe } from '../../models'; -export default async (cpes: ProductInfo[]): Promise => { +export default async (cpes: Cpe[]): Promise => { await connectToDatabase(); console.log('Saving CPEs to database'); const ids: string[] = []; for (const cpe of cpes) { try { const id: string = ( - await ProductInfo.createQueryBuilder() + await Cpe.createQueryBuilder() .insert() .values(cpe) .returning('id') .onConflict( - `("cpe_product_name", "version_number", "vender")DO UPDATE SET "last_seen" = now()` + `("name", "version", "vendor")DO UPDATE SET "lastSeenAt" = now()` ) .execute() ).identifiers[0].id; ids.push(id); } catch (error) { console.log(`Error saving CPE to database: ${error}`); - console.log( - `CPE: ${cpe.cpe_product_name} ${cpe.version_number} ${cpe.vender}` - ); + console.log(`CPE: ${cpe.name} ${cpe.version} ${cpe.vendor}`); } } return ids; diff --git a/backend/src/tasks/helpers/saveCvesToDb.ts b/backend/src/tasks/helpers/saveCvesToDb.ts index b75d9f7e7..dd9eba9b3 100644 --- a/backend/src/tasks/helpers/saveCvesToDb.ts +++ b/backend/src/tasks/helpers/saveCvesToDb.ts @@ -1,25 +1,60 @@ -import { connectToDatabase, ProductInfo, Cve } from '../../models'; +import { connectToDatabase, Cpe, Cve } from '../../models'; -export default async (cves: Cve, cpeIds: string[]): Promise => { +export default async (cve: Cve, cpeIds: string[]): Promise => { await connectToDatabase(); - console.log('Saving Cves to database'); + console.log(`Saving ${cve.name} to database`); try { const id: string = ( await Cve.createQueryBuilder() .insert() - .values(cves) - .returning('cve_uid') - .onConflict(`("cve_name")DO UPDATE SET "last_modified_date" = now()`) //todo this might not be the same + .values(cve) + .returning('id') + .orUpdate(cveFieldsToUpdate, ['name'], { + skipUpdateIfNoValuesChanged: true + }) .execute() - ).identifiers[0].cve_uid; - await ProductInfo.createQueryBuilder() - .relation(Cve, 'product_info') - .of(id) - .add(cpeIds); - return id; + ).identifiers[0].id; + if (id) { + await Cpe.createQueryBuilder().relation(Cve, 'cpes').of(id).add(cpeIds); + return id; + } + console.log(`${cve.name} is already up to date.`); + return ''; } catch (error) { - console.log(`Error saving CVE to database: ${error}`); - console.log(`CVE: ${cves.cve_name}`); + console.log(`Error saving ${cve.name} to database: ${error}`); return ''; } }; + +const cveFieldsToUpdate = [ + 'publishedAt', + 'modifiedAt', + 'status', + 'description', + 'cvssV2Source', + 'cvssV2Type', + 'cvssV2Version', + 'cvssV2VectorString', + 'cvssV2BaseScore', + 'cvssV2BaseSeverity', + 'cvssV2ExploitabilityScore', + 'cvssV2ImpactScore', + 'cvssV3Source', + 'cvssV3Type', + 'cvssV3Version', + 'cvssV3VectorString', + 'cvssV3BaseScore', + 'cvssV3BaseSeverity', + 'cvssV3ExploitabilityScore', + 'cvssV3ImpactScore', + 'cvssV4Source', + 'cvssV4Type', + 'cvssV4Version', + 'cvssV4VectorString', + 'cvssV4BaseScore', + 'cvssV4BaseSeverity', + 'cvssV4ExploitabilityScore', + 'cvssV4ImpactScore', + 'weaknesses', + 'references' +]; diff --git a/backend/src/tasks/sample_data/cves.json b/backend/src/tasks/sample_data/cves.json new file mode 100644 index 000000000..7141a99a3 --- /dev/null +++ b/backend/src/tasks/sample_data/cves.json @@ -0,0 +1,1082 @@ +[ + { + "cve_uid": "", + "cve_name": "CVE-2017-15906", + "published_date": "2017-10-26T08:29:00.220Z", + "last_modified_date": "2024-02-14T22:42:27.316Z", + "vuln_status": "Modified", + "description": "The process_open function in sftp-server.c in OpenSSH before 7.6 does not properly prevent write operations in readonly mode, which allows attackers to create zero-length files.", + "cvss_v2_source": "nvd@nist.gov", + "cvss_v2_type": "Primary", + "cvss_v2_version": "2.0", + "cvss_v2_vector_string": "AV:N/AC:L/Au:N/C:N/I:P/A:N", + "cvss_v2_base_score": 5, + "cvss_v2_base_severity": "MEDIUM", + "cvss_v2_exploitability_score": 10, + "cvss_v2_impact_score": 2.9, + "cvss_v3_source": "nvd@nist.gov", + "cvss_v3_type": "Primary", + "cvss_v3_version": "3.1", + "cvss_v3_vector_string": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N", + "cvss_v3_base_score": 5.3, + "cvss_v3_base_severity": "MEDIUM", + "cvss_v3_exploitability_score": 3.9, + "cvss_v3_impact_score": 1.4, + "cvss_v4_source": null, + "cvss_v4_type": null, + "cvss_v4_version": null, + "cvss_v4_vector_string": null, + "cvss_v4_base_score": null, + "cvss_v4_base_severity": null, + "cvss_v4_exploitability_score": null, + "cvss_v4_impact_score": null, + "weaknesses": [ + "CWE-732" + ], + "reference_urls": [ + "http://www.securityfocus.com/bid/101552", + "https://access.redhat.com/errata/RHSA-2018:0980", + "https://cert-portal.siemens.com/productcert/pdf/ssa-412672.pdf", + "https://github.com/openbsd/src/commit/a6981567e8e215acc1ef690c8dbb30f2d9b00a19", + "https://lists.debian.org/debian-lts-announce/2018/09/msg00010.html", + "https://security.gentoo.org/glsa/201801-05", + "https://security.netapp.com/advisory/ntap-20180423-0004/", + "https://www.openssh.com/txt/release-7.6", + "https://www.oracle.com/security-alerts/cpujan2020.html" + ], + "vender_product": { + "company": [ + { + "cpe_product_name": "oncommand_unified_manager_core_package", + "version_number": "-", + "vender": "netapp" + }, + { + "cpe_product_name": "storage_replication_adapter_for_clustered_data_ontap", + "version_number": "*", + "vender": "netapp" + }, + { + "cpe_product_name": "solidfire", + "version_number": "-", + "vender": "netapp" + }, + { + "cpe_product_name": "enterprise_linux_server_aus", + "version_number": "7.6", + "vender": "redhat" + }, + { + "cpe_product_name": "enterprise_linux_server_aus", + "version_number": "7.7", + "vender": "redhat" + }, + { + "cpe_product_name": "enterprise_linux_desktop", + "version_number": "7.0", + "vender": "redhat" + }, + { + "cpe_product_name": "virtual_storage_console", + "version_number": "9.6", + "vender": "netapp" + }, + { + "cpe_product_name": "data_ontap_edge", + "version_number": "-", + "vender": "netapp" + }, + { + "cpe_product_name": "enterprise_linux_eus", + "version_number": "7.7", + "vender": "redhat" + }, + { + "cpe_product_name": "enterprise_linux_server_tus", + "version_number": "7.6", + "vender": "redhat" + }, + { + "cpe_product_name": "openssh", + "version_number": "*", + "vender": "openssh" + }, + { + "cpe_product_name": "cn1610", + "version_number": "-", + "vender": "netapp" + }, + { + "cpe_product_name": "steelstore_cloud_integrated_storage", + "version_number": "-", + "vender": "netapp" + }, + { + "cpe_product_name": "enterprise_linux_eus", + "version_number": "7.6", + "vender": "redhat" + }, + { + "cpe_product_name": "enterprise_linux_server_tus", + "version_number": "7.7", + "vender": "redhat" + }, + { + "cpe_product_name": "hci_management_node", + "version_number": "-", + "vender": "netapp" + }, + { + "cpe_product_name": "enterprise_linux_server", + "version_number": "7.0", + "vender": "redhat" + }, + { + "cpe_product_name": "cloud_backup", + "version_number": "-", + "vender": "netapp" + }, + { + "cpe_product_name": "enterprise_linux_workstation", + "version_number": "7.0", + "vender": "redhat" + }, + { + "cpe_product_name": "storage_replication_adapter_for_clustered_data_ontap", + "version_number": "9.6", + "vender": "netapp" + }, + { + "cpe_product_name": "virtual_storage_console", + "version_number": "*", + "vender": "netapp" + }, + { + "cpe_product_name": "sun_zfs_storage_appliance_kit", + "version_number": "8.8.6", + "vender": "oracle" + }, + { + "cpe_product_name": "clustered_data_ontap", + "version_number": "-", + "vender": "netapp" + }, + { + "cpe_product_name": "cn1610_firmware", + "version_number": "-", + "vender": "netapp" + }, + { + "cpe_product_name": "vasa_provider_for_clustered_data_ontap", + "version_number": "*", + "vender": "netapp" + }, + { + "cpe_product_name": "debian_linux", + "version_number": "8.0", + "vender": "debian" + }, + { + "cpe_product_name": "active_iq_unified_manager", + "version_number": "-", + "vender": "netapp" + } + ] + } + }, + { + "cve_uid": "", + "cve_name": "CVE-2018-15473", + "published_date": "2018-08-18T00:29:00.223Z", + "last_modified_date": "2024-02-14T22:50:19.257Z", + "vuln_status": "Analyzed", + "description": "OpenSSH through 7.7 is prone to a user enumeration vulnerability due to not delaying bailout for an invalid authenticating user until after the packet containing the request has been fully parsed, related to auth2-gss.c, auth2-hostbased.c, and auth2-pubkey.c.", + "cvss_v2_source": "nvd@nist.gov", + "cvss_v2_type": "Primary", + "cvss_v2_version": "2.0", + "cvss_v2_vector_string": "AV:N/AC:L/Au:N/C:P/I:N/A:N", + "cvss_v2_base_score": 5, + "cvss_v2_base_severity": "MEDIUM", + "cvss_v2_exploitability_score": 10, + "cvss_v2_impact_score": 2.9, + "cvss_v3_source": "nvd@nist.gov", + "cvss_v3_type": "Primary", + "cvss_v3_version": "3.1", + "cvss_v3_vector_string": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", + "cvss_v3_base_score": 5.3, + "cvss_v3_base_severity": "MEDIUM", + "cvss_v3_exploitability_score": 3.9, + "cvss_v3_impact_score": 1.4, + "cvss_v4_source": null, + "cvss_v4_type": null, + "cvss_v4_version": null, + "cvss_v4_vector_string": null, + "cvss_v4_base_score": null, + "cvss_v4_base_severity": null, + "cvss_v4_exploitability_score": null, + "cvss_v4_impact_score": null, + "weaknesses": [ + "CWE-362" + ], + "reference_urls": [ + "http://www.openwall.com/lists/oss-security/2018/08/15/5", + "http://www.securityfocus.com/bid/105140", + "http://www.securitytracker.com/id/1041487", + "https://access.redhat.com/errata/RHSA-2019:0711", + "https://access.redhat.com/errata/RHSA-2019:2143", + "https://bugs.debian.org/906236", + "https://cert-portal.siemens.com/productcert/pdf/ssa-412672.pdf", + "https://github.com/openbsd/src/commit/779974d35b4859c07bc3cb8a12c74b43b0a7d1e0", + "https://lists.debian.org/debian-lts-announce/2018/08/msg00022.html", + "https://psirt.global.sonicwall.com/vuln-detail/SNWLID-2018-0011", + "https://security.gentoo.org/glsa/201810-03", + "https://security.netapp.com/advisory/ntap-20181101-0001/", + "https://usn.ubuntu.com/3809-1/", + "https://www.debian.org/security/2018/dsa-4280", + "https://www.exploit-db.com/exploits/45210/", + "https://www.exploit-db.com/exploits/45233/", + "https://www.exploit-db.com/exploits/45939/", + "https://www.oracle.com/security-alerts/cpujan2020.html" + ], + "vender_product": { + "company": [ + { + "cpe_product_name": "ubuntu_linux", + "version_number": "14.04", + "vender": "canonical" + }, + { + "cpe_product_name": "ontap_select_deploy", + "version_number": "-", + "vender": "netapp" + }, + { + "cpe_product_name": "vasa_provider", + "version_number": "*", + "vender": "netapp" + }, + { + "cpe_product_name": "enterprise_linux_desktop", + "version_number": "7.0", + "vender": "redhat" + }, + { + "cpe_product_name": "enterprise_linux_server", + "version_number": "6.0", + "vender": "redhat" + }, + { + "cpe_product_name": "enterprise_linux_desktop", + "version_number": "6.0", + "vender": "redhat" + }, + { + "cpe_product_name": "data_ontap_edge", + "version_number": "-", + "vender": "netapp" + }, + { + "cpe_product_name": "service_processor", + "version_number": "-", + "vender": "netapp" + }, + { + "cpe_product_name": "scalance_x204rna", + "version_number": "-", + "vender": "siemens" + }, + { + "cpe_product_name": "ubuntu_linux", + "version_number": "18.04", + "vender": "canonical" + }, + { + "cpe_product_name": "data_ontap", + "version_number": "-", + "vender": "netapp" + }, + { + "cpe_product_name": "ubuntu_linux", + "version_number": "16.04", + "vender": "canonical" + }, + { + "cpe_product_name": "openssh", + "version_number": "*", + "vender": "openssh" + }, + { + "cpe_product_name": "cn1610", + "version_number": "-", + "vender": "netapp" + }, + { + "cpe_product_name": "steelstore_cloud_integrated_storage", + "version_number": "-", + "vender": "netapp" + }, + { + "cpe_product_name": "enterprise_linux_workstation", + "version_number": "6.0", + "vender": "redhat" + }, + { + "cpe_product_name": "oncommand_unified_manager", + "version_number": "*", + "vender": "netapp" + }, + { + "cpe_product_name": "aff_baseboard_management_controller", + "version_number": "-", + "vender": "netapp" + }, + { + "cpe_product_name": "storage_replication_adapter", + "version_number": "*", + "vender": "netapp" + }, + { + "cpe_product_name": "enterprise_linux_server", + "version_number": "7.0", + "vender": "redhat" + }, + { + "cpe_product_name": "cloud_backup", + "version_number": "-", + "vender": "netapp" + }, + { + "cpe_product_name": "enterprise_linux_workstation", + "version_number": "7.0", + "vender": "redhat" + }, + { + "cpe_product_name": "virtual_storage_console", + "version_number": "*", + "vender": "netapp" + }, + { + "cpe_product_name": "scalance_x204rna_firmware", + "version_number": "*", + "vender": "siemens" + }, + { + "cpe_product_name": "sun_zfs_storage_appliance_kit", + "version_number": "8.8.6", + "vender": "oracle" + }, + { + "cpe_product_name": "debian_linux", + "version_number": "9.0", + "vender": "debian" + }, + { + "cpe_product_name": "clustered_data_ontap", + "version_number": "-", + "vender": "netapp" + }, + { + "cpe_product_name": "cn1610_firmware", + "version_number": "-", + "vender": "netapp" + }, + { + "cpe_product_name": "fas_baseboard_management_controller", + "version_number": "-", + "vender": "netapp" + }, + { + "cpe_product_name": "debian_linux", + "version_number": "8.0", + "vender": "debian" + } + ] + } + }, + { + "cve_uid": "", + "cve_name": "CVE-2018-15919", + "published_date": "2018-08-28T13:29:00.207Z", + "last_modified_date": "2024-02-14T22:50:28.245Z", + "vuln_status": "Analyzed", + "description": "Remotely observable behaviour in auth-gss2.c in OpenSSH through 7.8 could be used by remote attackers to detect existence of users on a target system when GSS2 is in use. NOTE: the discoverer states 'We understand that the OpenSSH developers do not want to treat such a username enumeration (or \"oracle\") as a vulnerability.'", + "cvss_v2_source": "nvd@nist.gov", + "cvss_v2_type": "Primary", + "cvss_v2_version": "2.0", + "cvss_v2_vector_string": "AV:N/AC:L/Au:N/C:P/I:N/A:N", + "cvss_v2_base_score": 5, + "cvss_v2_base_severity": "MEDIUM", + "cvss_v2_exploitability_score": 10, + "cvss_v2_impact_score": 2.9, + "cvss_v3_source": "nvd@nist.gov", + "cvss_v3_type": "Primary", + "cvss_v3_version": "3.0", + "cvss_v3_vector_string": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", + "cvss_v3_base_score": 5.3, + "cvss_v3_base_severity": "MEDIUM", + "cvss_v3_exploitability_score": 3.9, + "cvss_v3_impact_score": 1.4, + "cvss_v4_source": null, + "cvss_v4_type": null, + "cvss_v4_version": null, + "cvss_v4_vector_string": null, + "cvss_v4_base_score": null, + "cvss_v4_base_severity": null, + "cvss_v4_exploitability_score": null, + "cvss_v4_impact_score": null, + "weaknesses": [ + "CWE-200" + ], + "reference_urls": [ + "http://seclists.org/oss-sec/2018/q3/180", + "http://www.securityfocus.com/bid/105163", + "https://security.netapp.com/advisory/ntap-20181221-0001/" + ], + "vender_product": { + "company": [ + { + "cpe_product_name": "ontap_select_deploy", + "version_number": "-", + "vender": "netapp" + }, + { + "cpe_product_name": "data_ontap_edge", + "version_number": "-", + "vender": "netapp" + }, + { + "cpe_product_name": "openssh", + "version_number": "*", + "vender": "openssh" + }, + { + "cpe_product_name": "cn1610", + "version_number": "-", + "vender": "netapp" + }, + { + "cpe_product_name": "cloud_backup", + "version_number": "-", + "vender": "netapp" + }, + { + "cpe_product_name": "cn1610_firmware", + "version_number": "-", + "vender": "netapp" + }, + { + "cpe_product_name": "steelstore", + "version_number": "-", + "vender": "netapp" + } + ] + } + }, + { + "cve_uid": "", + "cve_name": "CVE-2018-20685", + "published_date": "2019-01-11T03:29:00.377Z", + "last_modified_date": "2024-02-14T22:51:58.019Z", + "vuln_status": "Analyzed", + "description": "In OpenSSH 7.9, scp.c in the scp client allows remote SSH servers to bypass intended access restrictions via the filename of . or an empty filename. The impact is modifying the permissions of the target directory on the client side.", + "cvss_v2_source": "nvd@nist.gov", + "cvss_v2_type": "Primary", + "cvss_v2_version": "2.0", + "cvss_v2_vector_string": "AV:N/AC:H/Au:N/C:N/I:P/A:N", + "cvss_v2_base_score": 2.6, + "cvss_v2_base_severity": "LOW", + "cvss_v2_exploitability_score": 4.9, + "cvss_v2_impact_score": 2.9, + "cvss_v3_source": "nvd@nist.gov", + "cvss_v3_type": "Primary", + "cvss_v3_version": "3.1", + "cvss_v3_vector_string": "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:N", + "cvss_v3_base_score": 5.3, + "cvss_v3_base_severity": "MEDIUM", + "cvss_v3_exploitability_score": 1.6, + "cvss_v3_impact_score": 3.6, + "cvss_v4_source": null, + "cvss_v4_type": null, + "cvss_v4_version": null, + "cvss_v4_vector_string": null, + "cvss_v4_base_score": null, + "cvss_v4_base_severity": null, + "cvss_v4_exploitability_score": null, + "cvss_v4_impact_score": null, + "weaknesses": [ + "CWE-863" + ], + "reference_urls": [ + "http://www.securityfocus.com/bid/106531", + "https://access.redhat.com/errata/RHSA-2019:3702", + "https://cert-portal.siemens.com/productcert/pdf/ssa-412672.pdf", + "https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/scp.c.diff?r1=1.197&r2=1.198&f=h", + "https://github.com/openssh/openssh-portable/commit/6010c0303a422a9c5fa8860c061bf7105eb7f8b2", + "https://lists.debian.org/debian-lts-announce/2019/03/msg00030.html", + "https://security.gentoo.org/glsa/201903-16", + "https://security.gentoo.org/glsa/202007-53", + "https://security.netapp.com/advisory/ntap-20190215-0001/", + "https://sintonen.fi/advisories/scp-client-multiple-vulnerabilities.txt", + "https://usn.ubuntu.com/3885-1/", + "https://www.debian.org/security/2019/dsa-4387", + "https://www.oracle.com/technetwork/security-advisory/cpuapr2019-5072813.html", + "https://www.oracle.com/technetwork/security-advisory/cpuoct2019-5072832.html" + ], + "vender_product": { + "company": [ + { + "cpe_product_name": "ubuntu_linux", + "version_number": "14.04", + "vender": "canonical" + }, + { + "cpe_product_name": "m10-4s", + "version_number": "-", + "vender": "fujitsu" + }, + { + "cpe_product_name": "ontap_select_deploy", + "version_number": "-", + "vender": "netapp" + }, + { + "cpe_product_name": "scalance_x204rna_eec", + "version_number": "-", + "vender": "siemens" + }, + { + "cpe_product_name": "m12-1_firmware", + "version_number": "*", + "vender": "fujitsu" + }, + { + "cpe_product_name": "m10-4", + "version_number": "-", + "vender": "fujitsu" + }, + { + "cpe_product_name": "m12-2s", + "version_number": "-", + "vender": "fujitsu" + }, + { + "cpe_product_name": "enterprise_linux_eus", + "version_number": "8.6", + "vender": "redhat" + }, + { + "cpe_product_name": "element_software", + "version_number": "-", + "vender": "netapp" + }, + { + "cpe_product_name": "m12-2s_firmware", + "version_number": "*", + "vender": "fujitsu" + }, + { + "cpe_product_name": "enterprise_linux", + "version_number": "7.0", + "vender": "redhat" + }, + { + "cpe_product_name": "enterprise_linux_server_aus", + "version_number": "8.2", + "vender": "redhat" + }, + { + "cpe_product_name": "m12-2", + "version_number": "-", + "vender": "fujitsu" + }, + { + "cpe_product_name": "solaris", + "version_number": "10", + "vender": "oracle" + }, + { + "cpe_product_name": "enterprise_linux_eus", + "version_number": "8.1", + "vender": "redhat" + }, + { + "cpe_product_name": "scalance_x204rna", + "version_number": "-", + "vender": "siemens" + }, + { + "cpe_product_name": "ubuntu_linux", + "version_number": "18.04", + "vender": "canonical" + }, + { + "cpe_product_name": "ubuntu_linux", + "version_number": "16.04", + "vender": "canonical" + }, + { + "cpe_product_name": "openssh", + "version_number": "*", + "vender": "openssh" + }, + { + "cpe_product_name": "storage_automation_store", + "version_number": "-", + "vender": "netapp" + }, + { + "cpe_product_name": "m10-1_firmware", + "version_number": "*", + "vender": "fujitsu" + }, + { + "cpe_product_name": "m12-2_firmware", + "version_number": "*", + "vender": "fujitsu" + }, + { + "cpe_product_name": "enterprise_linux", + "version_number": "8.0", + "vender": "redhat" + }, + { + "cpe_product_name": "steelstore_cloud_integrated_storage", + "version_number": "-", + "vender": "netapp" + }, + { + "cpe_product_name": "enterprise_linux_eus", + "version_number": "8.2", + "vender": "redhat" + }, + { + "cpe_product_name": "enterprise_linux_server_tus", + "version_number": "8.2", + "vender": "redhat" + }, + { + "cpe_product_name": "enterprise_linux_server_tus", + "version_number": "8.4", + "vender": "redhat" + }, + { + "cpe_product_name": "winscp", + "version_number": "*", + "vender": "winscp" + }, + { + "cpe_product_name": "m10-4s_firmware", + "version_number": "*", + "vender": "fujitsu" + }, + { + "cpe_product_name": "cloud_backup", + "version_number": "-", + "vender": "netapp" + }, + { + "cpe_product_name": "scalance_x204rna_firmware", + "version_number": "*", + "vender": "siemens" + }, + { + "cpe_product_name": "m10-4_firmware", + "version_number": "*", + "vender": "fujitsu" + }, + { + "cpe_product_name": "debian_linux", + "version_number": "9.0", + "vender": "debian" + }, + { + "cpe_product_name": "scalance_x204rna_eec_firmware", + "version_number": "*", + "vender": "siemens" + }, + { + "cpe_product_name": "enterprise_linux_eus", + "version_number": "8.4", + "vender": "redhat" + }, + { + "cpe_product_name": "enterprise_linux_server_tus", + "version_number": "8.6", + "vender": "redhat" + }, + { + "cpe_product_name": "enterprise_linux_server_aus", + "version_number": "8.4", + "vender": "redhat" + }, + { + "cpe_product_name": "ubuntu_linux", + "version_number": "18.10", + "vender": "canonical" + }, + { + "cpe_product_name": "debian_linux", + "version_number": "8.0", + "vender": "debian" + }, + { + "cpe_product_name": "enterprise_linux_server_aus", + "version_number": "8.6", + "vender": "redhat" + }, + { + "cpe_product_name": "m10-1", + "version_number": "-", + "vender": "fujitsu" + }, + { + "cpe_product_name": "m12-1", + "version_number": "-", + "vender": "fujitsu" + } + ] + } + }, + { + "cve_uid": "", + "cve_name": "CVE-2019-6109", + "published_date": "2019-02-01T00:29:00.710Z", + "last_modified_date": "2024-02-14T23:02:10.030Z", + "vuln_status": "Modified", + "description": "An issue was discovered in OpenSSH 7.9. Due to missing character encoding in the progress display, a malicious server (or Man-in-The-Middle attacker) can employ crafted object names to manipulate the client output, e.g., by using ANSI control codes to hide additional files being transferred. This affects refresh_progress_meter() in progressmeter.c.", + "cvss_v2_source": "nvd@nist.gov", + "cvss_v2_type": "Primary", + "cvss_v2_version": "2.0", + "cvss_v2_vector_string": "AV:N/AC:H/Au:N/C:P/I:P/A:N", + "cvss_v2_base_score": 4, + "cvss_v2_base_severity": "MEDIUM", + "cvss_v2_exploitability_score": 4.9, + "cvss_v2_impact_score": 4.9, + "cvss_v3_source": "nvd@nist.gov", + "cvss_v3_type": "Primary", + "cvss_v3_version": "3.1", + "cvss_v3_vector_string": "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N", + "cvss_v3_base_score": 6.8, + "cvss_v3_base_severity": "MEDIUM", + "cvss_v3_exploitability_score": 1.6, + "cvss_v3_impact_score": 5.2, + "cvss_v4_source": null, + "cvss_v4_type": null, + "cvss_v4_version": null, + "cvss_v4_vector_string": null, + "cvss_v4_base_score": null, + "cvss_v4_base_severity": null, + "cvss_v4_exploitability_score": null, + "cvss_v4_impact_score": null, + "weaknesses": [ + "CWE-116" + ], + "reference_urls": [ + "http://lists.opensuse.org/opensuse-security-announce/2019-06/msg00058.html", + "https://access.redhat.com/errata/RHSA-2019:3702", + "https://cert-portal.siemens.com/productcert/pdf/ssa-412672.pdf", + "https://cvsweb.openbsd.org/src/usr.bin/ssh/progressmeter.c", + "https://cvsweb.openbsd.org/src/usr.bin/ssh/scp.c", + "https://lists.debian.org/debian-lts-announce/2019/03/msg00030.html", + "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/W3YVQ2BPTOVDCFDVNC2GGF5P5ISFG37G/", + "https://security.gentoo.org/glsa/201903-16", + "https://security.netapp.com/advisory/ntap-20190213-0001/", + "https://sintonen.fi/advisories/scp-client-multiple-vulnerabilities.txt", + "https://usn.ubuntu.com/3885-1/", + "https://www.debian.org/security/2019/dsa-4387", + "https://www.oracle.com/technetwork/security-advisory/cpuoct2019-5072832.html" + ], + "vender_product": { + "company": [ + { + "cpe_product_name": "ubuntu_linux", + "version_number": "14.04", + "vender": "canonical" + }, + { + "cpe_product_name": "m10-4s", + "version_number": "-", + "vender": "fujitsu" + }, + { + "cpe_product_name": "ontap_select_deploy", + "version_number": "-", + "vender": "netapp" + }, + { + "cpe_product_name": "scalance_x204rna_eec", + "version_number": "-", + "vender": "siemens" + }, + { + "cpe_product_name": "m12-1_firmware", + "version_number": "*", + "vender": "fujitsu" + }, + { + "cpe_product_name": "m10-4", + "version_number": "-", + "vender": "fujitsu" + }, + { + "cpe_product_name": "m12-2s", + "version_number": "-", + "vender": "fujitsu" + }, + { + "cpe_product_name": "enterprise_linux_eus", + "version_number": "8.6", + "vender": "redhat" + }, + { + "cpe_product_name": "element_software", + "version_number": "-", + "vender": "netapp" + }, + { + "cpe_product_name": "m12-2s_firmware", + "version_number": "*", + "vender": "fujitsu" + }, + { + "cpe_product_name": "enterprise_linux_server_aus", + "version_number": "8.2", + "vender": "redhat" + }, + { + "cpe_product_name": "m12-2", + "version_number": "-", + "vender": "fujitsu" + }, + { + "cpe_product_name": "fedora", + "version_number": "30", + "vender": "fedoraproject" + }, + { + "cpe_product_name": "enterprise_linux_eus", + "version_number": "8.1", + "vender": "redhat" + }, + { + "cpe_product_name": "scalance_x204rna", + "version_number": "-", + "vender": "siemens" + }, + { + "cpe_product_name": "ubuntu_linux", + "version_number": "18.04", + "vender": "canonical" + }, + { + "cpe_product_name": "ubuntu_linux", + "version_number": "16.04", + "vender": "canonical" + }, + { + "cpe_product_name": "openssh", + "version_number": "*", + "vender": "openssh" + }, + { + "cpe_product_name": "storage_automation_store", + "version_number": "-", + "vender": "netapp" + }, + { + "cpe_product_name": "m10-1_firmware", + "version_number": "*", + "vender": "fujitsu" + }, + { + "cpe_product_name": "m12-2_firmware", + "version_number": "*", + "vender": "fujitsu" + }, + { + "cpe_product_name": "enterprise_linux", + "version_number": "8.0", + "vender": "redhat" + }, + { + "cpe_product_name": "enterprise_linux_eus", + "version_number": "8.2", + "vender": "redhat" + }, + { + "cpe_product_name": "enterprise_linux_server_tus", + "version_number": "8.2", + "vender": "redhat" + }, + { + "cpe_product_name": "enterprise_linux_server_tus", + "version_number": "8.4", + "vender": "redhat" + }, + { + "cpe_product_name": "winscp", + "version_number": "*", + "vender": "winscp" + }, + { + "cpe_product_name": "m10-4s_firmware", + "version_number": "*", + "vender": "fujitsu" + }, + { + "cpe_product_name": "scalance_x204rna_firmware", + "version_number": "*", + "vender": "siemens" + }, + { + "cpe_product_name": "m10-4_firmware", + "version_number": "*", + "vender": "fujitsu" + }, + { + "cpe_product_name": "debian_linux", + "version_number": "9.0", + "vender": "debian" + }, + { + "cpe_product_name": "scalance_x204rna_eec_firmware", + "version_number": "*", + "vender": "siemens" + }, + { + "cpe_product_name": "enterprise_linux_eus", + "version_number": "8.4", + "vender": "redhat" + }, + { + "cpe_product_name": "enterprise_linux_server_tus", + "version_number": "8.6", + "vender": "redhat" + }, + { + "cpe_product_name": "enterprise_linux_server_aus", + "version_number": "8.4", + "vender": "redhat" + }, + { + "cpe_product_name": "ubuntu_linux", + "version_number": "18.10", + "vender": "canonical" + }, + { + "cpe_product_name": "debian_linux", + "version_number": "8.0", + "vender": "debian" + }, + { + "cpe_product_name": "enterprise_linux_server_aus", + "version_number": "8.6", + "vender": "redhat" + }, + { + "cpe_product_name": "m10-1", + "version_number": "-", + "vender": "fujitsu" + }, + { + "cpe_product_name": "m12-1", + "version_number": "-", + "vender": "fujitsu" + } + ] + } + }, + { + "cve_uid": "", + "cve_name": "CVE-2019-6110", + "published_date": "2019-02-01T00:29:00.807Z", + "last_modified_date": "2024-02-14T23:02:10.051Z", + "vuln_status": "Analyzed", + "description": "In OpenSSH 7.9, due to accepting and displaying arbitrary stderr output from the server, a malicious server (or Man-in-The-Middle attacker) can manipulate the client output, for example to use ANSI control codes to hide additional files being transferred.", + "cvss_v2_source": "nvd@nist.gov", + "cvss_v2_type": "Primary", + "cvss_v2_version": "2.0", + "cvss_v2_vector_string": "AV:N/AC:H/Au:N/C:P/I:P/A:N", + "cvss_v2_base_score": 4, + "cvss_v2_base_severity": "MEDIUM", + "cvss_v2_exploitability_score": 4.9, + "cvss_v2_impact_score": 4.9, + "cvss_v3_source": "nvd@nist.gov", + "cvss_v3_type": "Primary", + "cvss_v3_version": "3.1", + "cvss_v3_vector_string": "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N", + "cvss_v3_base_score": 6.8, + "cvss_v3_base_severity": "MEDIUM", + "cvss_v3_exploitability_score": 1.6, + "cvss_v3_impact_score": 5.2, + "cvss_v4_source": null, + "cvss_v4_type": null, + "cvss_v4_version": null, + "cvss_v4_vector_string": null, + "cvss_v4_base_score": null, + "cvss_v4_base_severity": null, + "cvss_v4_exploitability_score": null, + "cvss_v4_impact_score": null, + "weaknesses": [ + "CWE-838" + ], + "reference_urls": [ + "https://cert-portal.siemens.com/productcert/pdf/ssa-412672.pdf", + "https://cvsweb.openbsd.org/src/usr.bin/ssh/progressmeter.c", + "https://cvsweb.openbsd.org/src/usr.bin/ssh/scp.c", + "https://security.gentoo.org/glsa/201903-16", + "https://security.netapp.com/advisory/ntap-20190213-0001/", + "https://sintonen.fi/advisories/scp-client-multiple-vulnerabilities.txt", + "https://www.exploit-db.com/exploits/46193/" + ], + "vender_product": { + "company": [ + { + "cpe_product_name": "ontap_select_deploy", + "version_number": "-", + "vender": "netapp" + }, + { + "cpe_product_name": "scalance_x204rna_eec", + "version_number": "-", + "vender": "siemens" + }, + { + "cpe_product_name": "element_software", + "version_number": "-", + "vender": "netapp" + }, + { + "cpe_product_name": "scalance_x204rna", + "version_number": "-", + "vender": "siemens" + }, + { + "cpe_product_name": "openssh", + "version_number": "*", + "vender": "openssh" + }, + { + "cpe_product_name": "storage_automation_store", + "version_number": "-", + "vender": "netapp" + }, + { + "cpe_product_name": "winscp", + "version_number": "*", + "vender": "winscp" + }, + { + "cpe_product_name": "scalance_x204rna_firmware", + "version_number": "*", + "vender": "siemens" + }, + { + "cpe_product_name": "scalance_x204rna_eec_firmware", + "version_number": "*", + "vender": "siemens" + } + ] + } + } +] \ No newline at end of file diff --git a/backend/src/tasks/syncdb.ts b/backend/src/tasks/syncdb.ts index ebaf3c539..27738a5dd 100644 --- a/backend/src/tasks/syncdb.ts +++ b/backend/src/tasks/syncdb.ts @@ -5,16 +5,17 @@ import { Domain, Organization, OrganizationTag, - Scan, Vulnerability } from '../models'; import ESClient from './es-client'; import * as Sentencer from 'sentencer'; import * as services from './sample_data/services.json'; import * as cpes from './sample_data/cpes.json'; +import * as cves from './sample_data/cves.json'; import * as vulnerabilities from './sample_data/vulnerabilities.json'; import * as nouns from './sample_data/nouns.json'; import * as adjectives from './sample_data/adjectives.json'; +import { saveToDb } from './cve-sync'; import { sample } from 'lodash'; import { handler as searchSync } from './search-sync'; import { In } from 'typeorm'; @@ -50,6 +51,7 @@ export const handler: Handler = async (event) => { if (type === 'populate') { console.log('Populating the database with some sample data...'); + await saveToDb(cves); Sentencer.configure({ nounList: nouns, adjectiveList: adjectives, diff --git a/backend/src/tasks/test/cve-sync.test.ts b/backend/src/tasks/test/cve-sync.test.ts index 0525f300c..dc44ba9c1 100644 --- a/backend/src/tasks/test/cve-sync.test.ts +++ b/backend/src/tasks/test/cve-sync.test.ts @@ -1,6 +1,5 @@ -import { connect } from 'http2'; import * as nock from 'nock'; -import { connectToDatabase, Cve, ProductInfo, Scan } from '../../models'; +import { connectToDatabase, Cve, Cpe, Scan } from '../../models'; import { handler as cveSync } from '../cve-sync'; const taskResponse = { @@ -80,22 +79,22 @@ describe('cve-sync', () => { }); const checkCVE = async (cveName: string): Promise => { const cve = await Cve.findOne({ - where: { cve_name: cveName } + where: { name: cveName } }); expect(cve); - expect(cve?.cve_name).toEqual(cveName); - const uid = cve?.cve_uid || ''; - expect(uid).not.toEqual(''); - return uid; + expect(cve?.name).toEqual(cveName); + const id = cve?.id || ''; + expect(id).not.toEqual(''); + return id; }; const checkCPE = async (cpeName: string): Promise => { - const cpe = await ProductInfo.findOne({ - where: { cpe_product_name: cpeName } + const cpe = await Cpe.findOne({ + where: { name: cpeName } }); - expect(cpe?.vender).toEqual('testCompany'); - const uid = cpe?.id || ''; - expect(uid).not.toEqual(''); - return uid; + expect(cpe?.vendor).toEqual('testCompany'); + const id = cpe?.id || ''; + expect(id).not.toEqual(''); + return id; }; test('baseline', async () => { @@ -113,7 +112,7 @@ describe('cve-sync', () => { scanName: 'scanName', scanTaskId: 'scanTaskId' }); - const cveUID = await checkCVE('CVE-0000-0000'); - const cpeUID = await checkCPE('test_os'); + await checkCVE('CVE-0000-0000'); + await checkCPE('test_os'); }); }); diff --git a/backend/test/cpes.test.ts b/backend/test/cpes.test.ts index b2c1675e4..4651dfe64 100644 --- a/backend/test/cpes.test.ts +++ b/backend/test/cpes.test.ts @@ -1,21 +1,21 @@ import * as request from 'supertest'; import app from '../src/api/app'; -import { Organization, ProductInfo, connectToDatabase } from '../src/models'; +import { Organization, Cpe, connectToDatabase } from '../src/models'; import { createUserToken } from './util'; describe('cpes', () => { let connection; let organization: Organization; - let productInfo: ProductInfo; + let cpe: Cpe; beforeAll(async () => { connection = await connectToDatabase(); - productInfo = ProductInfo.create({ - last_seen: new Date(), - cpe_product_name: 'Test Product', - version_number: '1.0.0', - vender: 'Test Vender' + cpe = Cpe.create({ + lastSeenAt: new Date(), + name: 'Test Product', + version: '1.0.0', + vendor: 'Test Vender' }); - await productInfo.save(); + await cpe.save(); organization = Organization.create({ name: 'test-' + Math.random(), rootDomains: ['test-' + Math.random()], @@ -26,14 +26,14 @@ describe('cpes', () => { }); afterAll(async () => { - await ProductInfo.delete(productInfo.id); + await Cpe.delete(cpe.id); await connection.close(); }); describe('CPE API', () => { it('should return a single CPE by id', async () => { const response = await request(app) - .get(`/cpes/${productInfo.id}`) + .get(`/cpes/${cpe.id}`) .set( 'Authorization', createUserToken({ @@ -42,10 +42,8 @@ describe('cpes', () => { ) .send({}) .expect(200); - expect(response.body.id).toEqual(productInfo.id); - expect(response.body.cpe_product_name).toEqual( - productInfo.cpe_product_name - ); + expect(response.body.id).toEqual(cpe.id); + expect(response.body.name).toEqual(cpe.name); }); }); }); diff --git a/backend/test/cves.test.ts b/backend/test/cves.test.ts index b2d830f0c..fe8879494 100644 --- a/backend/test/cves.test.ts +++ b/backend/test/cves.test.ts @@ -3,7 +3,7 @@ import app from '../src/api/app'; import { Cve, Organization, connectToDatabase } from '../src/models'; import { createUserToken } from './util'; -// TODO: Add test for joining product_info +// TODO: Add test for joining cpes and implement data from sample_data/cpes.json describe('cves', () => { let connection; let cve: Cve; @@ -11,7 +11,7 @@ describe('cves', () => { beforeAll(async () => { connection = await connectToDatabase(); cve = Cve.create({ - cve_name: 'CVE-0001-0001' + name: 'CVE-0001-0001' }); await cve.save(); organization = Organization.create({ @@ -24,14 +24,14 @@ describe('cves', () => { }); afterAll(async () => { - await Cve.delete(cve.cve_uid); + await Cve.delete(cve.id); await Organization.delete(organization.id); await connection.close(); }); describe('CVE API', () => { - it('should return a single CVE by cve_name', async () => { + it('should return a single CVE by name', async () => { const response = await request(app) - .get(`/cves/name/${cve.cve_name}`) + .get(`/cves/name/${cve.name}`) .set( 'Authorization', createUserToken({ @@ -40,14 +40,14 @@ describe('cves', () => { ) .send({}) .expect(200); - expect(response.body.cve_uid).toEqual(cve.cve_uid); - expect(response.body.cve_name).toEqual(cve.cve_name); + expect(response.body.id).toEqual(cve.id); + expect(response.body.name).toEqual(cve.name); }); }); describe('CVE API', () => { - it('should return a single CVE by cve_uid', async () => { + it('should return a single CVE by id', async () => { const response = await request(app) - .get(`/cves/${cve.cve_uid}`) + .get(`/cves/${cve.id}`) .set( 'Authorization', createUserToken({ @@ -56,8 +56,8 @@ describe('cves', () => { ) .send({}) .expect(200); - expect(response.body.cve_uid).toEqual(cve.cve_uid); - expect(response.body.cve_name).toEqual(cve.cve_name); + expect(response.body.id).toEqual(cve.id); + expect(response.body.name).toEqual(cve.name); }); }); }); diff --git a/frontend/src/pages/Vulnerability/Vulnerability.tsx b/frontend/src/pages/Vulnerability/Vulnerability.tsx index b32c5a267..f46522bcc 100644 --- a/frontend/src/pages/Vulnerability/Vulnerability.tsx +++ b/frontend/src/pages/Vulnerability/Vulnerability.tsx @@ -23,7 +23,7 @@ import { getSeverityColor, getCVSSColor } from 'pages/Risk/utils'; import { useAuthContext } from 'context'; import { Cve as CveType, - ProductInfo as ProductInfoType, + Cpe as ProductInfoType, Vulnerability as VulnerabilityType } from 'types'; @@ -116,15 +116,15 @@ export const Vulnerability: React.FC = () => { if (!vulnerability) return <>No Vulnerabilities; - const groupedByVendor: GroupedByVendor = (cve?.product_info ?? []).reduce( + const groupedByVendor: GroupedByVendor = (cve?.cpes ?? []).reduce( (acc: GroupedByVendor, current: ProductInfoType) => { - const { vender, ...rest } = current; + const { vendor, ...rest } = current; // If the vendor exists, push the current object to its array - if (acc[vender]) { - acc[vender].push(rest); + if (acc[vendor]) { + acc[vendor].push(rest); } else { // Create a new array with the current object - acc[vender] = [rest]; + acc[vendor] = [rest]; } return acc; }, @@ -453,8 +453,8 @@ export const Vulnerability: React.FC = () => { fontWeight="regular" sx={{ verticalAlign: 'top' }} > - {cve?.cvss_v3_source != null - ? cve?.cvss_v3_source.split('@')[0].toUpperCase() + {cve?.cvssV3Source != null + ? cve?.cvssV3Source.split('@')[0].toUpperCase() : null} @@ -466,13 +466,11 @@ export const Vulnerability: React.FC = () => { display="inline" variant="subtitle2" sx={{ - backgroundColor: getCVSSColor( - Number(cve?.cvss_v3_base_score) - )[0] + backgroundColor: getCVSSColor(Number(cve?.cvssV3BaseScore))[0] }} > -   {cve?.cvss_v3_base_score}  - {getCVSSColor(Number(cve?.cvss_v3_base_score))[1]}   +   {cve?.cvssV3BaseScore}  + {getCVSSColor(Number(cve?.cvssV3BaseScore))[1]}   @@ -490,7 +488,7 @@ export const Vulnerability: React.FC = () => { fontWeight="regular" sx={{ overflowWrap: 'break-word' }} > - {cve?.cvss_v3_vector_string} + {cve?.cvssV3VectorString} @@ -518,8 +516,8 @@ export const Vulnerability: React.FC = () => { fontWeight="regular" sx={{ verticalAlign: 'top' }} > - {cve?.cvss_v2_source != null - ? cve?.cvss_v2_source.split('@')[0].toUpperCase() + {cve?.cvssV2Source != null + ? cve?.cvssV2Source.split('@')[0].toUpperCase() : null} @@ -531,13 +529,11 @@ export const Vulnerability: React.FC = () => { display="inline" variant="subtitle2" sx={{ - backgroundColor: getCVSSColor( - Number(cve?.cvss_v2_base_score) - )[0] + backgroundColor: getCVSSColor(Number(cve?.cvssV2BaseScore))[0] }} > -   {cve?.cvss_v2_base_score}  - {getCVSSColor(Number(cve?.cvss_v2_base_score))[1]}   +   {cve?.cvssV2BaseScore}  + {getCVSSColor(Number(cve?.cvssV2BaseScore))[1]}   @@ -549,7 +545,7 @@ export const Vulnerability: React.FC = () => { variant="caption" fontWeight="regular" > - {cve?.cvss_v2_vector_string} + {cve?.cvssV2VectorString} @@ -562,7 +558,7 @@ export const Vulnerability: React.FC = () => {
    {values.map((value, index) => ( -
  • {value.cpe_product_name}
  • +
  • {value.name}
  • ))}
diff --git a/frontend/src/types/cpe.ts b/frontend/src/types/cpe.ts new file mode 100644 index 000000000..0db91b9bd --- /dev/null +++ b/frontend/src/types/cpe.ts @@ -0,0 +1,9 @@ +import { Cve } from './cve'; +export interface Cpe { + id: string; + name: string; + lastSeenAt: Date; + vendor?: string | any; + version: string; + cves: Cve[]; +} diff --git a/frontend/src/types/cve.ts b/frontend/src/types/cve.ts index 843ed718d..50b0182a1 100644 --- a/frontend/src/types/cve.ts +++ b/frontend/src/types/cve.ts @@ -1,37 +1,36 @@ -import { ProductInfo } from './product-info'; +import { Cpe } from './cpe'; export interface Cve { - cve_uid: string; - cve_name: string | null; + id: string; + name: string | null; description: string | null; - last_modified_date: Date; - published_date: Date; - vuln_status: string | null; - cvss_v2_source: string | null; - cvss_v2_type: string | null; - cvss_v2_version: string | null; - cvss_v2_vector_string: string | null; - cvss_v2_base_score: string | null; - cvss_v2_base_severity: string | null; - cvss_v2_exploitability_score: string | null; - cvss_v2_impact_score: string | null; - cvss_v3_source: string | null; - cvss_v3_type: string | null; - cvss_v3_version: string | null; - cvss_v3_vector_string: string | null; - cvss_v3_base_score: string | null; - cvss_v3_base_severity: string | null; - cvss_v3_exploitability_score: string | null; - cvss_v3_impact_score: string | null; - cvss_v4_source: string | null; - cvss_v4_type: string | null; - cvss_v4_version: string | null; - cvss_v4_vector_string: string | null; - cvss_v4_base_score: string | null; - cvss_v4_base_severity: string | null; - cvss_v4_exploitability_score: string | null; - cvss_v4_impact_score: string | null; - cpe_list: string[] | null; - reference_urls: string[] | null; + modifiedAt: Date; + publishedAt: Date; + status: string | null; + cvssV2Source: string | null; + cvssV2Type: string | null; + cvssV2Version: string | null; + cvssV2VectorString: string | null; + cvssV2BaseScore: string | null; + cvssV2BaseSeverity: string | null; + cvssV2ExploitabilityScore: string | null; + cvssV2ImpactScore: string | null; + cvssV3Source: string | null; + cvssV3Type: string | null; + cvssV3Version: string | null; + cvssV3VectorString: string | null; + cvssV3BaseScore: string | null; + cvssV3BaseSeverity: string | null; + cvssV3ExploitabilityScore: string | null; + cvssV3ImpactScore: string | null; + cvssV4Source: string | null; + cvssV4Type: string | null; + cvssV4Version: string | null; + cvssV4VectorString: string | null; + cvssV4BaseScore: string | null; + cvssV4BaseSeverity: string | null; + cvssV4ExploitabilityScore: string | null; + cvssV4ImpactScore: string | null; + references: string[] | null; weaknesses: string[] | null; - product_info: ProductInfo[]; + cpes: Cpe[]; } diff --git a/frontend/src/types/index.ts b/frontend/src/types/index.ts index 88f210a31..67b495b9b 100644 --- a/frontend/src/types/index.ts +++ b/frontend/src/types/index.ts @@ -1,5 +1,5 @@ import { SortingRule, Filters } from 'react-table'; -export * from './product-info'; +export * from './cpe'; export * from './cve'; export * from './domain'; export * from './vulnerability'; diff --git a/frontend/src/types/product-info.ts b/frontend/src/types/product-info.ts deleted file mode 100644 index 260e8ca82..000000000 --- a/frontend/src/types/product-info.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Cve } from './cve'; -export interface ProductInfo { - id: string; - cpe_product_name: string; - last_seen: Date; - vender?: string | any; - version_number: string; - cve: Cve[]; -}