Detection rules › Splunk

Package installation (Sysmon)

Group by
_time, host
Source
github.com/anvilogic-forge/armory

Some programming languages, like Python, come with an easy, more or less official method of installing dependencies for your projects. These installers are usually tied to public code repositories where anyone can freely upload code packages for others to use. The intent of this use case is to identify installation of packages, with common repositories using pip, gem and npm. Use case will be used to with additional threat identifiers to potentially identify Dependency confusion style attacks.

MITRE ATT&CK coverage

TacticTechniques
Command & ControlT1105 Ingress Tool Transfer

References

Event coverage

ProviderEventTitle
SysmonEvent ID 1Process creation

Rule body yaml

id: '5987.18207'
title: Package installation
description: 'Some programming languages, like Python, come with an easy, more or
  less official method of installing dependencies for your projects. These installers
  are usually tied to public code repositories where anyone can freely upload code
  packages for others to use. The intent of this use case is to identify installation
  of packages, with common repositories using pip, gem and npm. Use case will be used
  to with additional threat identifiers to potentially identify Dependency confusion
  style attacks. '
logic_format: Splunk
logic: '`get_endpoint_data` `get_endpoint_data_sysmon` ("EventCode=1" OR "<EventID>1<")
  (TERM(npm) OR TERM(pip) OR TERM(gem)) TERM(install) | regex process="(?i)install\s"
  | rex field=process "(?<reqs>(?i)requirements\.txt") | rex field=process "(?<extra>(?i)(\-{2}extra)?\-index\-url(\s+\S+)")
  | rex field=process "(?<source1>(?i)\-{2}source(\s+\S+)") | eval keywords=mvappend(reqs,
  extra, source1) | table _time, host, user, signature_id, process, process_*, parent_*,
  keyword | bin span=1s | stats values(*) as * by _time, host '
techniques:
- command-and-control:ingress tool transfer
technique_id: 
- T1105
data_category:
- Windows Sysmon
references:
- https://medium.com/@alex.birsan/dependency-confusion-4a5d60fec610

Stages and Predicates

Stage 1: search

`get_endpoint_data` `get_endpoint_data_sysmon` ("EventCode=1" OR "<EventID>1<") (TERM(npm) OR TERM(pip) OR TERM(gem)) TERM(install)

Stage 2: regex

| regex process="(?i)install\s"

Stage 3: eval

| rex field=process "(?<reqs>(?i)requirements\.txt")

Stage 4: eval

| rex field=process "(?<extra>(?i)(\-{2}extra)?\-index\-url(\s+\S+)")

Stage 5: eval

| rex field=process "(?<source1>(?i)\-{2}source(\s+\S+)")

Stage 6: eval

| eval keywords=mvappend(reqs, extra, source1)

Stage 7: table

| table _time, host, user, signature_id, process, process_*, parent_*, keyword

Stage 8: bucket

| bin span=1s

Stage 9: stats

| stats values(*) as * by _time, host

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
processregex_match
  • "(?i)install\s" corpus 3 (splunk 3)

Search terms

Bare-string tokens in the SPL search body. Splunk matches each token against _raw (the untyped raw event text) anywhere it appears, not against a specific field. These don't surface in the Indicators table because they aren't predicates on a known field.

StageTerm
1"EventCode=1"
1"<EventID>1<"
1TERM
1npm
1TERM
1pip
1TERM
1gem
1TERM
1install