Threat Response: IndexCX High Priority Path Guidance

Threat Response: IndexCX High Priority Path Guidance

IndexCX allows you to define critical locations that IndexCX should monitor for changes and update file data for in as near to real time as possible. These critical locations are called High Priority Paths (HPPs) and this document will lead you through some best practices for identifying what HPPs to configure in your environment and the basics of assigning specific HPPs per profile.

First, it is important to understand how IndexCX works - it is a dedicated Tanium Client process that walks files at rest on disk to keep track of file attributes, metadata and hashes. It makes that data quickly searchable with little to no impact on the endpoint. This allows you to search, at Tanium speed and scale, for things like list all files, anywhere on disk, with password in the name or show all files that have an MD5 or SHA256 hash of de458.... or even what new binaries have been added to my endpoints in the last week? Without Index, these types of dynamic searches are impossible or significantly degrade endpoint performance.

IndexCX is a critical part of Threat Response’s overall endpoint detection, investigation, and alerting strategy. It provides the ability to efficiently search files at rest on disk while the RecorderCX, Detect Engine, and Incident Response content provide alerting and visibility based on real time system activity, an endpoint’s historical activity, live artifacts on disk and in memory, and even file content.

IndexCX is specifically designed with low resource utilization in mind – especially across environments that share resources such as virtual server or desktop infrastructure environments. The IndexCX process waits in the background for a module to give it a list of paths to analyze. It will not use more than 2.5% of the total CPU available on an endpoint and keeps disk IO to a minimum when hashing files. You can change how frequently the slow and steady background walk is performed based on how often you want file data updated. You can also define High Priority Paths (HPPs) for those directories where you require more frequent updates. Until the various file systems build in instant file hashing and fuzzy file searching, IndexCX is the best way to balance your need for updated and flexible file data against any resource constraints you may have on your endpoints. Legacy Index was a step in the right direction and the re-engineering of IndexCX builds on that to drastically improves performance and gives you the ability to check all endpoint files against all malicious hashes while eliminating common errors, such incomplete indexing, dropped journals, and index not updating while systems were out of communication with the Tanium Server. The combination of IndexCX and RecorderCX give you performant long term indexing and hashing, while monitoring and updating critical locations as they change.

The THR service setting Index Scan Frequency can be considered the worst-case scenario of how long a file can go without being checked to see if it needs re-indexing/hashing. IndexCX reduces endpoint load by being smart about the differential between path scans – typically only re-indexing/hashing files that have been added or modified since the previous scan. This low and slow scan defaults to a very resource cautious re-scan of every 7 days, however many customers update this setting to 2 or 3 days with no noticeable impact. Do not be afraid to experiment with this setting – moving it up gradually as desired.

Since instant indexing and hashing isn’t possible, but there is a need for specific endpoint locations to have updated data as quickly as possible, IndexCX is designed with High Priority Paths (HPPs). These give you the ability to configure what paths you want to be prioritized and updated as quickly as possible. To keep the file meta and hash data as current, IndexCX updates file data in HPPs using two methods: (1) IndexCX subscribes to the Tanium RecorderCX process and whenever a file in an HPP is created or modified it will immediately tell IndexCX that this file needs to be updated, and (2) all HPPs are re-scanned every 24 hours (by default) as a backstop – just in case the recorder isn’t enabled. This backstop timeframe can be adjusted in the THR service using the High Priority Path Scanning for Index Configurations setting.

So, what HPPs do you configure? What paths should a customer watch more often than others? This varies from customer to customer, but there are four priority locations to consider when your security team is saying “I want every change re-indexed and hashed immediately!” while your virtual endpoint team is saying “no - because we have no CPU or disk IO to spare.” As a good starting point, think about what files would most likely be changed as the initial part of an attack? Integrity Monitor watches your system and application binaries and configs, Comply will audit your security policies to make sure no-one has made changes there, and Reveal can identify files with sensitive information - so where does that leave us as the best places to use High Priority Paths?

  • User Writeable Directories – Intruders most often get footholds in an environment by exploiting users – for example phishing, watering-hole, and exploiting non-admin applications. As a result, user-writeable directories are where the initial malware config, reconnaissance, or staging files are most likely to be located. Unless your application is running as root or administrator, almost all application exploits that write to disk require writing to a non-privileged path. The nice thing is many of these paths will be consistent across OSs. A quick google search will provide several examples of utilities, powershell scripts, and find commands to help you locate these. See Reference.

  • Path Exceptions for Security Tools – This list will be unique to each customer, and some testing will be warranted, but it is a good idea to gather lists of any directories that are excluded by your security tools. First, because of the improvements in IndexCX, you will likely find you no longer need most of your Tanium Legacy Index exclusions – so take the opportunity to review those. Second, see what directories you are excluding from tools like AppLocker or your anti-virus that make sense to prioritize for indexing.

  • Tanium Data feeding Reputation – IndexCX combines with Tanium Reputation to not only search endpoints for tens of thousands hashes per second (while staying under 1% CPU utilization) it allows you to check critical endpoint files against 3 rd party reputation providers. Reputation data is used to enhance Tanium data and investigations by visually calling out known malicious hashes. For example, most customers will use Tanium to collect the MD5 hash of all autorun files and check them once or twice a day against known malicious hashes against their reputation provider of choice. Finding the common paths for these files make good High Priority Paths. See Reference.

  • Integrity Monitor Configs - While HPPs are not going to take the place of file Integrity Monitoring (IM), we can also look to these configurations for ideas. These also provide another good example of the flexibility of Tanium’s IndexCX and HPPs – we can specify directories but exclude specific file extensions such as .log or .db.

  • While IndexCX significantly decreases the need for exceptions, if you have database or software build directories that continually have thousands of files created or updated, performance testing of the endpoint would be wise before adding those paths as an HPP. Don’t worry if you need to exclude such directories for performance reasons - this is exactly why Threat Response never relies on one single detection method but can also alert based on system activity in real time, historical activity, live artifacts on disk and in memory, and even file content.

Now, once you have a list of potential locations we need to add them as HPP filters. Let's say you have the following directories:

  1. C:\$Recycle.Bin

  2. C:\Windows\Tasks

  3. C:\Windows\SysWOW64\Tasks

  4. C:\Windows\System32\Tasks

  5. C:\Windows\SysWOW64\com\dmp

  6. C:\Windows\System32\com\dmp

A few easy steps will turn them into HPP filters. These filters use the same syntax as other Tanium filters so please make sure to review Reference: Manage high-priority paths for an overview of the syntax. Key items to note are:

  • You must use a “file.path starts with” clause

  • You must escape any backslashes (i.e. “C:\Windows” becomes “C:\\Windows”)

After the initial starts with filter, you can use additional contains and ends with filters.

Create filters under Threat Response > Management > Filters > Create > High Priority Path. For individual paths you create a single filter. For example, adding the Recycle Bin to your HPPs would mean creating the following filter:

file.path starts with 'C:\\$Recycle.Bin'


1

When you have related paths, you can combine them into a single filter such as:

file.path starts with 'C:\\Windows' AND

(file.path contains '\\Tasks' OR file.path contains '\\com\\dmp')

You can type this text into the filter builder’s Text Editor tab or build using the Filter Builder:


2

For a more complex example, if we take one of the Integrity Monitor (IM) rules for /root, we see that IM specifically excludes files with the following extensions *.log, *.db, *.tmp, and *.state. For this we would combine the file.path starts with and file.path ends with NOT conditions.

file.path starts with '/root' AND file.path ends with NOT '.db' AND file.path ends with NOT '.log' AND file.path ends with NOT '.state' AND file.path ends with NOT '.tmp'

or


3

Finally, to round out our basic examples, the ends with filter is a good way to only watch specific extensions. If you have a group of endpoints where you specifically want to keep a close eye on the Windows drivers, you can write the following filter:

file.path starts with 'C:\\Windows\System32’ AND file.path ends with '.sys'

Note:

Once your High Priority Path filters are created you will need to: (a) apply them to correct Threat Response Index Configurations and (b) deploy any related profiles to enable these HPPs on your endpoints.

IndexCX is a powerful tool designed to give you the ability to perform flexible file meta data and file hash searches across your enterprise at the speed and scale of Tanium. Just as no single detection method is complete unto itself, IndexCX integrates with the Tanium Recorder, Detect Engine, and Reputation Module to enhance Tanium’s detection and hunting capabilities. High Priority Paths make IndexCX a flexible and configurable tool that allows you to balance how frequently you update file and hash data against your endpoint resource capacity.

Reference

Importable Common High Priority Paths (Windows): See attached file, Windows_Common_HPP_Filters.json.

Importable Common High Priority Paths (Linux): See attached file, Linux_Common_HPP_Filters.json.

Importable Common High Priority Paths (Mac): See attached file, Mac_Common_HPP_Filters.json.

Tanium Autorun Details

  • Windows: Run Get AutoRun Program Details from all machines and review the Entry Location, Image Path, and Lauch String columns.

  • Linux: Run Get Linux AutoRuns from all machines and review the Path and Executable columns.

  • Mac: Run Get Mac AutoRuns from all machines and review the Path and Executable columns.

User-Writable Paths

Here are some starting points for identifying user writeable paths in your environment. No endorsement is implied - use at your own risk. If attempting to run these across a lot of systems simultaneously, know that no vetting has been done to ensure domain lookups and walking network shares is prohibited.

Windows

Linux/Mac

Quick and Dirty

(with rolled up directories to make it easier to correlate)

Mac/Linux - World-Writable

find / -type d -perm +o=w | xargs -I {} python -c "import os;l = ['/'.join('{}'.split(os.sep)[0:i]) for i in range(len('{}'.split(os.sep)))][2:];print('\n'.join(l))" | sort | uniq -c | tee /tmp/world-writeable

Linux – Non root owned, group is not root and writable by user or group

find / -type d \! -user root –group root \( -perm -g+w -or -perm -o+w \) | xargs -I {} python -c "import os;l = ['/'.join('{}'.split(os.sep)[0:i]) for i in range(len('{}'.split(os.sep)))][2:];print('\n'.join(l))" | sort | uniq -c | tee /tmp/lin-non-root-usergroup-writeable

Mac – Non root owned, group not admin or wheel and writable by user or group

find / -type d \! -user root \! -group admin \! -group wheel \( -perm -g+w -or -perm -o+w \) | xargs -I {} python -c "import os;l = ['/'.join('{}'.split(os.sep)[0:i]) for i in range(len('{}'.split(os.sep)))][2:];print('\n'.join(l))" | sort | uniq -c | tee /tmp/mac-non