cve-enrichment
Enriches CVE indicators with reputation data from multiple integrations and outputs a consolidated CVEEnrichment object. This script exclusively supports indicators of type CVE and will automatically create the indicator in TIM if it is not already exists.
python · Aggregated Scripts
Details
| ID | cve-enrichment |
|---|---|
| Language | python |
| From Version | 8.0.0 |
| Docker Image | demisto/python3:3.12.13.10116658 |
| Tags | basescript |
README
Enriches CVE indicators with reputation data from multiple integrations and outputs a consolidated CVEEnrichment object. This script exclusively supports indicators of type CVE and will automatically create the indicator in TIM if it is not already exists.
Note: This script is supported in Cortex XSOAR 8.0 and later, and in Cortex XSIAM.
Script Data
| Name | Description |
|---|---|
| Script Type | python3 |
| Tags | basescript |
| Cortex XSOAR Version | 8.0.0 |
Used In
This script is used in the following playbooks and scripts.
- CVEEnrichment-Test
Inputs
| Argument Name | Description |
|---|---|
| cve_list | A comma-separated list of CVEs to enrich. |
| external_enrichment | Whether to call external integrations for enrichment. - ‘true’: enrich using enabled external integrations (e.g., CIRCL CVE Search, CVE Search v2). - ‘false’: use only existing TIM data; skip external integrations. If the ‘brands’ argument is provided, this flag is ignored and enrichment is run only on the brands provided. |
| verbose | Whether to retrieve a human-readable entry for every command; if false, only the final result is summarized and error entries are suppressed. |
| brands | A list of integration brands to run enrichment against. Example: `“CIRCL CVE Search, CVE Search v2”`. - If provided, only the selected brands are used. - If left empty, the script runs enrichment on all enabled integrations, depending on the `external_enrichment` flag. To see the available brands for the `cve` command, run: `!ProvidesCommand command=cve`. |
| additional_fields | When set to true, the output will also include an `AdditionalFields` object for each of the indicator result. `AdditionalFields` contains all fields returned by TIM or the integrations that are not part of the standard output keys: `ID`, `Brand`, `CVSS`, `Description`, `Published`. When set to false, only the standard keys are returned. |
Outputs
| Path | Description | Type |
|---|---|---|
| CVEEnrichment.Value | The CVE. | string |
| CVEEnrichment.MaxCVSS | The max CVSS of the indicator. | number |
| CVEEnrichment.MaxCVSSRating | The max CVSS rating of the indicator. | string |
| CVEEnrichment.Results | List of all indicators found for the CVE. | array |
| CVEEnrichment.Status | The status of the indicator. | string |
| CVEEnrichment.Results.ID | The ID of the indicator. | string |
| CVEEnrichment.Results.Brand | The brand of the indicator. | string |
| CVEEnrichment.Results.CVSS | The CVSS of the indicator. | number |
| CVEEnrichment.Results.Description | The description of the indicator. | string |
| CVEEnrichment.Results.Published | The published date of the indicator. | string |
| CVEEnrichment.Results.Status | The status of the indicator: “Manual” if the score was changed manually, “Fresh” if modified within the last week, “Stale” if modified more than a week ago, and “None” if never modified. | string |
| CVEEnrichment.Results.ModifiedTime | The time the indicator was last modified. | Date |
| CVEEnrichment.Results.AdditionalFields | All fields extracted from the indicator other then the main keys (“ID”, “Brand”, “CVSS”, “Description”, “Published”, “CVSS”). | Object |
| CVEEnrichment.Results.AdditionalFields.Relationships.EntityA | The source of the relationship. | string |
| CVEEnrichment.Results.AdditionalFields.Relationships.EntityB | The destination of the relationship. | string |
| CVEEnrichment.Results.AdditionalFields.Relationships.Relationship | The name of the relationship. | string |
| CVEEnrichment.Results.AdditionalFields.Relationships.EntityAType | The type of the source of the relationship. | string |
| CVEEnrichment.Results.AdditionalFields.Relationships.EntityBType | The type of the destination of the relationship. | string |
| CVEEnrichment.Results.AdditionalFields.Modified | The timestamp of when the CVE was last modified. | Date |
import demistomock as demisto from CommonServerPython import * from CommonServerUserPython import * from AggregatedCommandApiModule import * def cve_enrichment_script( cve_list, external_enrichment: bool = False, verbose: bool = False, enrichment_brands: list[str] | None = None, additional_fields: bool = False, ) -> CommandResults: """ Enriches CVE data with information from various integrations. Args: cve_list (list[str]): A list of CVEs to enrich. external_enrichment (bool, optional): Whether to call external integrations for enrichment. Defaults to False. verbose (bool, optional): Whether to retrieve a human-readable entry for every command. When set to false, human-readable will only summarize the final result and suppress error entries from commands. enrichment_brands (list[str], optional): A list of integration brands to run enrichment against. Defaults to None. additional_fields (bool, optional): When set to true, the output will also include an `AdditionalFields` object for each of the indicator result. Returns: CommandResults: The enriched CVE data. """ cve_instances, extract_verbose = create_and_extract_indicators(cve_list, "cve") valid_inputs = [cve_instance.extracted_value for cve_instance in cve_instances if cve_instance.extracted_value] indicator_mapping = { "ID": "ID", "Brand": "Brand", "CVSS": "CVSS", "Description": "Description", "Published": "Published", } cve_indicator_schema = IndicatorSchema( type="cve", value_field="ID", context_path_prefix="CVE(", # add ( to prefix to distinct from CVESearch v2 integration context path context_output_mapping=indicator_mapping, ) # --- Batch 1: create indicators (BUILTIN) --- create_new_indicator_commands = [ Command( name="CreateNewIndicatorsOnly", args={"indicator_values": valid_inputs, "type": "CVE"}, command_type=CommandType.BUILTIN, context_output_mapping=None, ignore_using_brand=True, # never inject using-brand for server builtins ) ] # --- Batch 2: external enrichment per CVE --- enrich_indicator_commands = [ Command( name="enrichIndicators", args={"indicatorsValues": valid_inputs}, command_type=CommandType.EXTERNAL, ) ] # commands is a list of *batches* (each batch is list[Command]) commands: list[list[Command]] = [ create_new_indicator_commands, enrich_indicator_commands, ] cve_reputation = ReputationAggregatedCommand( brands=enrichment_brands or [], verbose=verbose, commands=commands, additional_fields=additional_fields, external_enrichment=external_enrichment, final_context_path="CVEEnrichment", args=demisto.args(), indicator_schema=cve_indicator_schema, indicator_instances=cve_instances, verbose_outputs=[extract_verbose], ) return cve_reputation.run() """ MAIN FUNCTION """ def main(): # pragma: no cover args = demisto.args() cve_list = argToList(args.get("cve_list")) external_enrichment = argToBoolean(args.get("external_enrichment", False)) verbose = argToBoolean(args.get("verbose", False)) brands = argToList(args.get("brands")) additional_fields = argToBoolean(args.get("additional_fields", False)) demisto.debug(f"Data list: {cve_list}") demisto.debug(f"Brands: {brands}") try: return_results( cve_enrichment_script( cve_list=cve_list, external_enrichment=external_enrichment, verbose=verbose, enrichment_brands=brands, additional_fields=additional_fields, ) ) except Exception as ex: return_error(f"Failed to execute !cve-enrichment. Error: {str(ex)}") """ ENTRY POINT """ if __name__ in ("__main__", "__builtin__", "builtins"): # pragma: no cover main()