McAfee NSM Deprecated

Deprecated. Use McAfee NSM v2 integration instead.

Network Security · McAfee NSM

Details

IDMcAfee NSM
ProviderTrellix
CategoryNetwork Security
From Version5.0.0
Supported ModulesAgentix XSIAM

README

Overview


Use the McAfee NSM integration in Cortex XSOAR to retrieve information about sensors, domains, policies, alerts, and attacks in McAfee NSM.

This integration was integrated and tested with McAfee v9.1.

 

Configure McAfee NSM on Cortex XSOAR


  1. Navigate to Settings > Integrations > Servers & Services.
  2. Search for McAfee NSM.
  3. Click Add instance to create and configure a new integration instance.
    • Name: a textual name for the integration instance.
    • URL (for example: https://192.168.0.1:5000)
    • Username
    • Use system proxy settings
    • Trust any certificate (not secure)
  4. Click Test to validate the URLs, token, and connection.

Commands


You can execute these commands from the Cortex XSOAR CLI, as part of an automation, or in a playbook. After you successfully execute a command, a DBot message appears in the War Room with the command details.

  1. Get a list of sensors for a domain: nsm-get-sensors
  2. Get all domains: nsm-get-domains
  3. Get alerts: nsm-get-alerts
  4. Update alert information: nsm-update-alerts
  5. Get details for a single alert: nsm-get-alert-details
  6. Get IPS policies in a domain: nsm-get-ips-policies
  7. Get policy details for a single IPS policy: nsm-get-ips-policy-details
  8. Get all attack definitions: nsm-get-attacks

1. Get a list of sensors for a domain


Returns a list of sensors for a specified domain.

Base Command
nsm-get-sensors
Input
Argument Name Description Required
domainID The domain of the sensors. If blank, returns all sensors. Optional
 
Context Output
Path Type Description
NSM.Sensors.ID string Sensor ID
NSM.Sensors.Description string Sensor description
NSM.Sensors.DomainID string Sensor's domain ID
 
Command Example
!nsm-get-sensors domainID=0
Context Example
{
    "NSM": {
        "Sensors": {
            "Description": "MCAFEE-NETWORK-SECURITY-PLATFORM",
            "DomainID": 0,
            "ID": 1001,
            "IP Address": "192.168.1.109",
            "IPSPolicyID": 0,
            "Name": "VNSP1"
        }
    }
}
Human Readable Output

image

2. Get all domains


Returns all domains.

Base Command
nsm-get-domains
Input
Argument Name Description Required
domain Specific domain details. If blank, returns all domains. Optional
 
Context Output
Path Type Description
NSM.Domains.ID number Domain ID
NSM.Domains.Name string Domain name
 
Command Example
!nsm-get-domains domain=0
Context Example
{
    "NSM": {
        "Domains": {
            "ID": 0,
            "Name": "My Company"
        }
    }
}
Human Readable Output

image

3. Get alerts


Returns alerts according to query parameters.

Base Command
nsm-get-alerts
Input
Argument Name Description Required
time_period Time period Optional
start_time Start time in "mm/dd/yyyy HH:MM" format only. Used for custom time only. Optional
end_time End time in "mm/dd/yyyy HH:MM" format only. used for custom time only Optional
state Alert state Optional
search Search string in alert details Optional
filter Filter alert by fields. Example: "name:hello;direction:Inbound,Outbound;attackcount:>3,<4". Optional
 
Context Output
Path Type Description
NSM.Alerts.ID number Alert ID
NSM.Alerts.Name string Alert name
NSM.Alerts.State string Alert state (Acknowledged, Unacknowledged)
NSM.Alerts.CreatedTime string Alert creation time
NSM.Alerts.Assignee string Alert assignee
NSM.Alerts.AttackSeverity string Alert severity
NSM.Alerts.Application string The application associated with the alert
NSM.Alerts.EventResult unknown Event result
NSM.Alerts.Event unknown The event that triggered the alert
NSM.Alerts.Attack unknown Alert's attack
NSM.Alerts.Attacker unknown The attacker who committed the attack
NSM.Alerts.Target unknown The attack's target
NSM.Alerts.MalwareFile unknown Malware file used in the attack
 
Command Example
!nsm-get-alerts state=ANY

4. Update alert information


Update the state or the assignee of specified alerts.

Base Command
nsm-update-alerts
Input
Argument Name Description Required
state Alert state Optional
time_period Time period Optional
start_time Start time in "mm/dd/yyyy HH:MM" format only. Used for custom time only Optional
end_time End time in "mm/dd/yyyy HH:MM" format only. Used for custom time only Optional
new_state The new alert state Optional
new_assignee The new assignee Optional
search Search string in alert details Optional
filter Filter alert by fields. Example: "name:hello;direction:Inbound,Outbound;attackcount:>3,<4" Optional
 
Context Output
Path Type Description
NSM.Alerts.ID number Alert ID
NSM.Alerts.Name string Alert name
NSM.Alerts.State string Alert state (Acknowledged,Unacknowledged)
NSM.Alerts.CreatedTime string Alert creation time
NSM.Alerts.Assignee string Alert assignee
NSM.Alerts.AttackSeverity string Alert severity
NSM.Alerts.Application string The application associated with the alert
NSM.Alerts.EventResult unknown Event result
NSM.Alerts.Event unknown The event that triggered the alert
NSM.Alerts.Attack unknown Alert's attack
NSM.Alerts.Attacker unknown The attacker who committed the attack
NSM.Alerts.Target unknown The attack's Target
NSM.Alerts.MalwareFile unknown Malware file used in the attack
 
Command Example
!nsm-update-alerts start_time="10/10/2018 08:00" state=Acknowledged

5. Get details for a single alert


Returns details for a single, specified alert.

Base Command
nsm-get-alert-details
Input
Argument Name Description Required
alert_id Alert ID Required
sensor_id Sensor ID Required
 
Context Output
Path Type Description
NSM.Alerts.ID string Alert ID
NSM.Alerts.Name string Alert name
NSM.Alerts.State string Alert state (Acknowledged,Unacknowledged)
NSM.Alerts.CreatedTime date Alert creation time
NSM.Alerts.Assignee string Alert assignee
NSM.Alerts.Description string Alert description
NSM.Alerts.EventResult string Event result
NSM.Alerts.Event unknown Alert event
NSM.Alerts.Attack unknown Alert's attack
NSM.Alerts.Attacker unknown The attacker who committed the attack
NSM.Alerts.Target unknown The attack's target
NSM.Alerts.MalwareFile string Malware file used in the attack
NSM.Alerts.Details unknown Extra details
 
Command Example
!nsm-get-alert-details alert_id=0

6. Get IPS policies in a domain


Returns the IPS policies in a domain.

Base Command
nsm-get-ips-policies
Input
Argument Name Description Required
domain_id Domain ID Required
 
Context Output
Path Type Description
NSM.IPSPolicies.ID number IPS policy ID
NSM.IPSPolicies.Name string IPS policy name
NSM.IPSPolicies.DomainID number IPS policy domain ID
NSM.IPSPolicies.IsEditable boolean Whether you can edit the IPS policy
NSM.IPSPolicies.VisibleToChildren boolean Whether the IPS Policy is visible to domain's children
 
Command Example
!nsm-get-ips-policies domain_id=0
Context Example
{
    "NSM": {
        "IPSPolicies": [
            {
                "DomainID": 0,
                "ID": -1,
                "IsEditable": true,
                "Name": "Master Attack Repository",
                "VisibleToChildren": true
            },
            {
                "DomainID": 0,
                "ID": 0,
                "IsEditable": true,
                "Name": "Default Detection",
                "VisibleToChildren": true
            },
            {
                "DomainID": 0,
                "ID": 16,
                "IsEditable": true,
                "Name": "Default Exclude Informational",
                "VisibleToChildren": true
            },
            {
                "DomainID": 0,
                "ID": 17,
                "IsEditable": true,
                "Name": "Default Testing",
                "VisibleToChildren": true
            },
            {
                "DomainID": 0,
                "ID": 18,
                "IsEditable": true,
                "Name": "Default DoS and Reconnaissance Only",
                "VisibleToChildren": true
            },
            {
                "DomainID": 0,
                "ID": 19,
                "IsEditable": true,
                "Name": "Default Prevention",
                "VisibleToChildren": true
            }
        ]
    }
}
Human Readable Output

image

7. Get policy details for a single IPS policy


Returns policy details for the specified IPS policy.

Base Command
nsm-get-ips-policy-details
Input
Argument Name Description Required
policy_id IPS Policy ID Required
 
Context Output
Path Type Description
NSM.IPSPolicies.ID number IPS policy ID
NSM.IPSPolicies.Name string IPS policy Name
NSM.IPSPolicies.Description string IPS policy information
NSM.IPSPolicies.CreatedTime string Policy creation time
NSM.IPSPolicies.IsEditable boolean Whether you can edit the IPS policy
NSM.IPSPolicies.VisibleToChildren boolean Whether the IPS Policy is visible to domain's children
NSM.IPSPolicies.Version number IPS policy version
NSM.IPSPolicies.InboundRuleSet unknown Inbound rule set
NSM.IPSPolicies.OutboundRuleSet unknown Outbound rule set
NSM.IPSPolicies.ExploitAttacks unknown A list of exploit attacks related to the IPS Policy
 
Command Example
!nsm-get-ips-policy-details policy_id=0
Human Readable Output

image

8. Get all attack definitions


Returns all available attack definitions in McAfee NSM.

Base Command
nsm-get-attacks
Input
Argument Name Description Required
attack_id Particular attack ID Optional
 
Context Output
Path Type Description
NSM.Attacks.ID string Attack ID
NSM.Attacks.Name string Attack name
NSM.Attacks.Severity number Attack severity
NSM.Attacks.Direction string Attack direction
NSM.Attacks.Category string Attack category
 
Command Example
!nsm-get-attacks attack_id="0x00000100"
Context Example
{
    "NSM": {
        "Attacks": {
            "Category": "EXPLOIT",
            "Direction": null,
            "ID": "0x00000100",
            "Name": "IP: IP Fragment too Large",
            "Severity": 5
        }
    }
}
Human Readable Output

image

Troubleshooting


If you receive an 401 Unauthorized error, the user credentials may be incorrect.

Configuration parameters

  • url — URL (for example: https://192.168.0.1:5000) (required)
  • credentials — Username
  • proxy — Use system proxy settings
  • insecure — Trust any certificate (not secure)

Commands (8)

  • nsm-get-alert-details

    Get a single alert details

  • nsm-get-alerts

    Get alerts

  • nsm-get-attacks

    Get all available attack definitions in NSM

  • nsm-get-domains

    Get all domains

  • nsm-get-ips-policies

    Get IPS Policies in a domain

  • nsm-get-ips-policy-details

    Get the policy details for the specific IPS policy

  • nsm-get-sensors

    get a sensor list of a given domain

  • nsm-update-alerts

    Update state or assignee of alerts

var session_credentials = '';
var insecure = params.insecure;
// handle '/' at the end of the url
var base_url = params.url.slice(0, params.url.length - params.url.match('/*$')[0].length) + '/sdkapi/';
var proxy = params.proxy;

function sendRequest(method, url_suffix, headers, body, params) {
    // add default headers
    if (!("Accept" in headers)) {
        headers["Accept"] = ['application/vnd.nsm.v1.0+json', 'application/vnd.nsm.v2.0+json'];
    }
    if (!("Content-Type" in headers)) {
        headers['Content-Type'] = ['application/json'];
    }
    if (session_credentials !== '') {
        headers['NSM-SDK-API'] = [session_credentials];
    }

    var path = base_url + url_suffix;

    if(params){
        path += encodeToURLQuery(params);
    }

    var res = http(
        path,
        {
            Method: method,
            Headers: headers,
            Body: body,
        },
        insecure,
        proxy
    );

    if (res.StatusCode < 200 || res.StatusCode >= 300) {
        throw 'Request Failed.\nStatus code: ' + res.StatusCode + '.\nBody: ' + JSON.stringify(res) + '.';
    }

    return JSON.parse(res.Body);
}

function validateTimeArgs(time_period, start_time, end_time) {
    if (time_period === 'CUSTOM') {
        if ((start_time === undefined) || (end_time === undefined)) {
            return false;
        }
    }
    return true;
}

function attacks_to_entry(title, attacks) {
    return createEntry(attacks, {
        contextPath : 'NSM.Attacks(val.ID && val.ID === obj.ID)',
        title : title,
        data : [
            {to : 'ID', from : 'attackId'},
            {to : 'Name', from : 'name'},
            {to : 'Direction', from : 'DosDirection'},
            {to : 'Severity', from : 'Severity'},
            {to : 'Category', from : 'UiCategory'},
        ],
    },
    undefined, pascalToSpace);
}

function IPS_policies_to_entry(title, ips_policies) {
    return createEntry(ips_policies, {
        contextPath : 'NSM.IPSPolicies(val.ID && val.ID === obj.ID)',
        title : title,
        data : [
            {to : 'ID', from : 'policyId'},
            {to : 'Name', from : 'name'},
            {to : 'DomainID', from : 'DomainId'},
            {to : 'IsEditable', from : 'IsEditable'},
            {to : 'VisibleToChildren', from : 'VisibleToChild'},
        ],
    },
    undefined, pascalToSpace);
}

function IPS_policy_to_entry(title, ips_policy, policy_id) {
    ips_policy.ID = policy_id;
    return createEntry([ips_policy], {
        contextPath : 'NSM.IPSPolicies(val.ID && val.ID === obj.ID)',
        title : title,
        data : [
            {to : 'ID', from : 'ID'},
            {to : 'Name', from : 'PolicyName'},
            {to : 'Description', from : 'Description'},
            {to : 'CreatedTime', from : 'Timestamp'},
            {to : 'IsEditable', from : 'IsEditable'},
            {to : 'VisibleToChildren', from : 'IsVisibleToChildren'},
            {to : 'Version', from : 'VersionNum'},
            {to : 'InboundRuleSet', from : 'InboundRuleSet'},
            {to : 'OutboundRuleSet', from : 'OutboundRuleSet'},

            {to : 'ExploitAttacks', from : 'AttackCategory.ExpolitAttackList', humanReadable : false},
        ],
    },
    undefined, pascalToSpace);
}

function alerts_to_entry(title, alerts) {
    return createEntry(alerts, {
        contextPath : 'NSM.Alerts(val.ID && val.ID === obj.ID)',
        title : title,
        data : [
            {to : 'ID', from : 'event.alertId'},
            {to : 'Name', from : 'name'},
            {to : 'State', from : 'alertState'},
            {to : 'CreatedTime', from : 'event.time'},
            {to : 'Assignee', from : 'assignTo'},
            {to : 'AttackSeverity', from : 'attackSeverity'},
            {to : 'Application', from : 'application'},
            {to : 'EventResult', from : 'event.result'},
            {to : 'SensorID', from : 'detection.deviceId'},

            {to : 'Event', from : 'event', humanReadable : false},
            {to : 'Event.domain', from : 'detection.domain', humanReadable : false},
            {to : 'Event.interface', from : 'detection.interface', humanReadable : false},
            {to : 'Event.device', from : 'detection.device', humanReadable : false},
            {to : 'Attack', from : 'attack', humanReadable : false},
            {to : 'Attacker', from : 'attacker', humanReadable : false},
            {to : 'Target', from : 'target', humanReadable : false},
            {to : 'MalwareFile', from : 'malwareFile', humanReadable : false},

        ],
    },
    undefined, pascalToSpace);
}

function alert_to_entry(title, alert) {
    /// single alert object has different structure than the alerts of alerts_to_entry.
    var context = {
        ID : alert.summary.event.alertId,
        Name : alert.name,
        State : alert.alertState,
        CreatedTime : alert.summary.event.time,
        Assignee : alert.assignTo,
        Description : alert.description.definition,
        EventResult : alert.summary.event.result,
        Attack : {
            attackCategory : alert.description.attackCategory,
            attackSubCategory : alert.description.attackSubCategory,
            nspId : alert.description.reference.nspId, // no human readable
        },
        Protocols : alert.description.protocals,

        // no human readable
        SensorID : alert.summary.event.deviceId,
        Event : alert.summary.event,
        Attacker : alert.summary.attacker,
        Target : alert.summary.target,
        MalwareFile : alert.details.malwareFile,
        Details : alert.details,
    };

    var headers = ['ID', 'Name', 'Attack Category', 'Attack SubCategory', 'Description', 'State', 'Assignee', 'CreatedTime', 'EventResult', 'Comments'];
    var md = {
        ID : alert.summary.event.alertId,
        Name : alert.name,
        State : alert.alertState,
        CreatedTime : alert.summary.event.time,
        Assignee : alert.assignTo,
        Description : alert.description.definition,
        EventResult : alert.summary.event.result,
        'Attack Category' : alert.description.attackCategory,
        'Attack SubCategory' : alert.description.attackSubCategory,
        Comments : alert.description.comments.comments,
    };
    var links = alert.description.reference.additionInfo.split('<BR>');
    for (var i in links) {
        links[i] = '[{0}]({0})'.format(links[i]);
    }

    var reference = {
        CVE : alert.description.reference.cveId,
        Microsoft : alert.description.reference.microsoftId,
        'Intruvert ID' : alert.description.reference.nspId,
        'Additional Info' : links.join('<br>'),
    };

    var entry = {
        Type: entryTypes.note,
        Contents: alert,
        ContentsFormat: formats.json,
        ReadableContentsFormat: formats.markdown,
        HumanReadable : (tableToMarkdown(title, md, headers) +
            tableToMarkdown('Reference', reference) +
            tableToMarkdown('Platform Affected', {Protocols : alert.description.protocals})
        ),
        EntryContext : {
        'NSM.Alerts(val.ID && val.ID === obj.ID)' : createContext(context),
        },
    };
    return entry;
}

function domains_to_entry(title, domains) {
    return createEntry(domains, {
        contextPath : 'NSM.Domains(val.ID && val.ID === obj.ID)',
        title : title,
        data : [
            {to : 'ID', from : 'DomainDescriptor.id'},
            {to : 'Name', from : 'DomainDescriptor.name'},
        ],
    },
    undefined, pascalToSpace);
}

function sensors_to_entry(title, sensors) {
    return createEntry(sensors, {
        contextPath : 'NSM.Sensors(val.ID && val.ID === obj.ID)',
        title : title,
        data : [
            {to : 'ID', from : 'sensorId'},
            {to : 'Name', from : 'name'},
            {to : 'Description', from : 'Description'},
            {to : 'DomainID', from : 'DomainID'},
            {to : 'IPSPolicyID', from : 'IPSPolicyID'},
            {to : 'IP Address', from : 'sensorIPAddress'},
        ],
    },
    undefined, pascalToSpace);
}

function login() {
    var cmd_url = "session";
    var credentials = btoa(params.credentials.identifier + ':' + params.credentials.password);
    var headers = {'NSM-SDK-API' : [credentials]};
    var res = sendRequest("GET", cmd_url, headers, '');

    // store current credentials
    session_credentials = btoa(res.session + ':' + res.userId);
    return res;
}

function get_attacks(attack_id) {
    var cmd_url, res;
    if (attack_id) {
        if (attack_id.match('^0x[0-9A-Fa-f]{8}$') === null) {
            throw 'Error! Attack ID must be formated as 32-bit hexadecimal number. for example: 0x1234BEEF';
        }

        cmd_url = 'attack/' + attack_id;
    } else {
        cmd_url = 'attacks';
    }

    res = sendRequest('GET', cmd_url, {}, '');
    if (attack_id) {
        return attacks_to_entry('Attack ' + attack_id, [res.AttackDescriptor]);
    } else {
        return attacks_to_entry(res.AttackDescriptorDetailsList.length + ' Attacks', res.AttackDescriptorDetailsList);
    }
}

function get_IPS_policies(domain_id) {
    var cmd_url = 'domain/' + domain_id + '/ipspolicies';
    var res = sendRequest('GET', cmd_url, {}, '');

    return IPS_policies_to_entry(res.PolicyDescriptorDetailsList.length + ' IPS Policies', res.PolicyDescriptorDetailsList);
}

function get_IPS_policy_details(policy_id) {
    var cmd_url = 'ipspolicy/' + policy_id;
    var res = sendRequest('GET', cmd_url, {}, '');

    return IPS_policy_to_entry('IPS Policy ' + policy_id, res.PolicyDescriptor, policy_id);
}

function get_sensors(domain_id) {
    var cmd_url = 'sensors';
    if (domain_id !== undefined) {
        cmd_url += '?domain=' + domain_id;
    }
    var res = sendRequest('GET', cmd_url, {}, '');

    return sensors_to_entry('Sensors', res.SensorDescriptor);
}

function get_domains(domain_id) {
    var cmd_url = 'domain';
    if (domain_id) {
        cmd_url += '/' + domain_id;
    }
    var res = sendRequest('GET', cmd_url, {}, '');

    if (domain_id) {
        return domains_to_entry('Domain ' + domain_id, [res]);
    } else {
        return domains_to_entry((res.length || '') + ' Domains', [res]);
    }
}

function all_alerts_url(state, time_period, start_time, end_time, search, filter) {
    var cmd_url = 'alerts';
    var cmd_args = {};

    if (state) {
        cmd_args.alertstate = state;
    }

    if (time_period) {
        cmd_args.timeperiod = time_period;
        if (time_period === 'CUSTOM') {
            cmd_args.starttime = start_time;
            cmd_args.endtime = end_time;
        }
    }

    if (search) {
        cmd_args.search = search;
    }

    if (filter) {
        cmd_args.filter = filter;
    }

    return cmd_url + encodeToURLQuery(cmd_args);
}

function get_alerts(state, time_period, start_time, end_time, search, filter) {
    var cmd_url = all_alerts_url(state, time_period, start_time, end_time, search, filter);
    var res = sendRequest('GET', cmd_url, {}, '');

    return alerts_to_entry('Showing ' + res.retrievedAlertsCount + '/' + res.totalAlertsCount + ' Alerts', res.alertsList);
}

function update_alerts(state, time_period, start_time, end_time, search, filter, new_state, new_assignee) {
    var cmd_url = all_alerts_url(state, time_period, start_time, end_time, search, filter);
    if ((new_state === undefined) && (new_assignee === undefined)) {
        throw 'Error! You must specify a new alert state or a new assignee';
    }

    var query = {};
    if (new_state) {
        query.alertState = new_state;
    }
    if (new_assignee) {
        query.assignTo = new_assignee;
    }
    query = JSON.stringify(query);

    var res = sendRequest('PUT', cmd_url, {}, query);
    if (res.status === -1) {
        throw 'Error! Failed to update alerts.';
    }

    return get_alerts(state, time_period, start_time, end_time);
}

function get_alert_details(alert_id, sensor_id) {
    var cmd_url = 'alerts/' + alert_id;
    var query_params = {
        'sensorId': sensor_id
    };
    var res = sendRequest('GET', cmd_url, {}, '', query_params);
    return alert_to_entry('Alert ' + res.name, res);
}

function get_ntba_monitors() {
    var cmd_url = 'ntbamonitors';
    var res = sendRequest('GET', cmd_url, {}, '');

    return res;
}

function get_events(nba_id, hash, duration) {
    var cmd_url = nba_id + '/endpointintelligence/' + hash + '/events?duration=' + duration;
    var res = sendRequest('GET', cmd_url, {}, '');

    return res.eventList;
}

login();
switch (command) {
    case 'nsm-get-sensors':
        return get_sensors(args.domainID);

    case 'nsm-get-domains':
        return get_domains(args.domain);

    case 'nsm-get-alerts':
        if (!validateTimeArgs(args.time_period, args.start_time, args.end_time)) {
            throw 'Error! In CUSTOM mode, You must specify both start time and end time';
        }
        return get_alerts(args.state, args.time_period, args.start_time, args.end_time, args.search, args.filter);
    case 'nsm-get-alert-details':
        return get_alert_details(args.alert_id, args.sensor_id);
    case 'nsm-update-alerts':
        if (!validateTimeArgs(args.time_period, args.start_time, args.end_time)) {
            throw 'Error! In CUSTOM mode, You must specify both start time and end time';
        }
        return update_alerts(args.state, args.time_period, args.start_time, args.end_time, args.search, args.filter, args.new_state, args.new_assignee);

    case 'nsm-get-attacks':
        return get_attacks(args.attack_id);

    case 'nsm-get-ips-policies':
        return get_IPS_policies(args.domain_id);
    case 'nsm-get-ips-policy-details':
        return get_IPS_policy_details(args.policy_id);

    case 'test-module':
        return 'ok';
    default:
        break;
}