Categories

TechTip: Microsoft Outlook rules for auto-forwarded messages

At some point, one of the managers in the organization decided to forward all announcements from a particular vendor to the entire team, as an FYI. This got a bit noisy, so I had to research how to create an Outlook Rule to automatically filter all auto-forwarded messages from this sender into a separate folder.

The answer is to create a rule that looks for the "X-MS-Exchange-Generated-Message-Source: Mailbox Rules Agent" message header. Do do this:
  1. Start the "Create rule..." wizard in your Outlook.
  2. On the first, "Select conditions" step, choose "with specific words in the message header".


  3. For the words, add "X-MS-Exchange-Generated-Message-Source: Mailbox Rules Agent" and click "Add", then "Ok".


  4. Add any other conditions you would like to match before taking the actions (e.g. the "Sender:" address on the message).
  5. Select the actions you would like to take on matching messages in the next step.
  6. Finish naming and creating your rule.
All future auto-forwarded messages matching your conditions will be filtered by this rule.

InfoSec: RegEx to Match Linux "Cover Your Tracks" Commands

There are a number of commands that may be used to conceal nefarious activity on a Linux system, mostly through removing or overwriting the shell history files and logon activities:

kill -9 $$
history -c 
export HISTFILESIZE=0 
export HISTSIZE=0 
unset HISTFILE
echo "" > /var/log/auth.log
ln /dev/null ~/.bash_history -sf
rm ~/.bash_history -rf
echo "" > ~/.bash_history
shred -zu ~/.bash_history

Here is a quick-and-dirty RegEx to match on these when hunting through your EDR or system logs:

((rm|ln|echo|shred).*\.bash_history.*)|((export|unset) HIST(FILE)?(SIZE=0)?)|(kill -9 \$\$)|(history -c)|(echo.*\/auth\.log)

Enjoy.

TechTip: "afterSentDocuments" folder under "My Documents"

Just a random bit of information that proved to be rather difficult to find online for some reason, so in the spirit of this blog I am sharing it just in case it helps save time for someone else.

"afterSentDocuments" folder under "My Documents"

The "afterSentDocuments" folder under "My Documents" (or just "Documents" for Windows 10 users) is created by the SentinelOne endpoint agent.


The contents of this folder actually come from an archive located in the SentinelOne Agent installation folder under "C:\Program Files\SentinelOne\Sentinel Agent x.x.x.x\afterSentDocuments.zip"


These are not malicious. While undocumented, they are used for some internal SentinelOne scanning/encryption mechanisms. Hope this helps.

InfoSec: Querying the Recorded Future API using PowerShell

Recorded Future has a great Connect API with many options to retrieve, search or download every type of IOCs they offer as part of their subscription. Unfortunately, as most API providers out there, they only publish the instructions for accessing the API using common tools/languages (e.g. cURL, Python).

If you have a need to query their API using PowerShell because, for example, you are looking to add reputation checks to your O365 PowerShell Online script (or if you just prefer PowerShell), this post will hopefully save you a few minutes figuring out how to pass the API key to their API in the Invoke-WebRequest cmdlet.

Unlike most SaaS providers that make their API available for consumption nowadays, Recorded Future is different in that it does not require a username to be provided for API authentication. All you need is the key. Then, add the following property to your Invoke-WebRequest cmdlet:

-Headers @{"X-RFToken" = "api_key_here" }

So, for example, if your API key was "827ccb0eea8a706c4c34a16891f84e7b" (not an actual API key), a command to download the Recorded Future hash risk list would be:

Invoke-WebRequest -Headers @{"X-RFToken" = "827ccb0eea8a706c4c34a16891f84e7b" } -Method GET -ContentType "application/json" -Uri "https://api.recordedfuture.com/v2/hash/risklist?format=csv%2Fsplunk&gzip=false&list=positiveMalwareVerdict" -OutFile "out.csv"

Where to Find the Recorded Future API Key


Once you have your subscription and access to Recorded Future, you can get (or, rather, create) your API key under Menu - User Settings:


Click on "API Access" and use the "Generate New API Token" link to create a key, which will then be displayed in the list below (again, this isn't an actual API key):


Recorded Future API Documentation


Better than documentation, Recorded Future has a fantastic Connect API explorer page where you can, after plugging your API key in the top-right corner of the page, test all available API commands:


This page can be accessed at https://api.recordedfuture.com/v2/

A Note on Licensing


As expected, every API query uses up one usage "credit", but it should be noted that some of the queries (like the hash risk list used in the above examples) use up 5 credits per use. This can add up quickly when you're developing/testing something.

However, the Recorded Future's handy browser extension does not eat up your API credits.

Troubleshooting


If you get the following error, you need to add this to your code, to force the Invoke-WebRequest cmdlet to use TLS1.2:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

Error:

Invoke-WebRequest : The underlying connection was closed: An unexpected error occurred on a send.
At line:1 char:1
+ Invoke-WebRequest -Headers @{"X-RFToken" = "827ccb0eea8a706c4c34a16891f84e7b...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc
   eption
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand


Enjoy!

InfoSec: Online resources and tools for network forensics and cyber threat hunting

Following is a list of free online resources that I have found to be indispensable in the daily network troubleshooting and information security forensic investigations. I will keep updating this list as I remember of or discover more useful tools, but certainly feel free to contribute in the comments if you have any favorites that are not listed here. Last updated on 1/20/2019.


IP/MAC


IP Address Locator
http://www.geobytes.com/ipLocator.htm

By far the best and most accurate geolocating service - will tell you where the IP address is located geographically, what time zone it is located in and whether or not it is a proxy.

Mass Country of Origin Lookup
https://www.infobyip.com/ipbulklookup.php

Great tool for checking the sources of a DDoS attack - will take a list of IP addresses, one per line and return the IP, domain, location, ISP and ASN for each.

MAC Address Lookup
http://www.coffer.com/mac_find

Utility for searching the IEEE MAC address assignment database - quick way to identify what type of device is located at the MAC address in question.

What's My IP
http://www.whatismyip.com/

As the name implies, shows you what your public IP address (and its geolocation) is.

WolframAlpha Subnet Calculator
http://www.wolframalpha.com/input/?i=address+range

Very flexible IP subnet calculator, lets you calculate IP address ranges based on number of addresses needed, subnet mask bits or numeric subnet masks.

TechZoom IP Calculator
http://www.techzoom.net/tools/network-ip-calculator.en


Another handy multi-purpose IP address calculator, has ability to calculate subnets and convert IP address masks into individual address lists. Also includes IP and domain name checkers.


DNS

Robtex DNS Lookup
https://www.robtex.com/

Extremely comprehensive "DNS Lookup" site that goes way beyond just DNS lookups. Can be used to lookup BGP routing and AS information for IP addresses, for example.

DNS Analyzer
http://www.intodns.com

Amazingly detailed DNS information reporter and status analyzer. Will show a slew of details about a specified domain name, including but not limited to NS, SOA, MX and WWW records, reverse records, duplicate records, et cetera, and warn you of any configuration that does not follow the best practices.

DNSDigger
http://www.dnsdigger.com/

Great tool for finding other hosts/servers on the subnet of the domain name in question. The only drawback is that it does not offer a reverse lookup option (enter the IP address range, get the domain names of all the servers), but this can be partially remediated by doing a reverse search in cached Google results: http://www.google.com/#hl=en&q=site%3Adnsdigger.com+66.102.13.103

URLQuery
http://urlquery.net/

Similar to DNSDigger, another great tool for looking up domain names for the IP addresses that may show up in your IPS logs. Again, you can leverage Google's cache if needed: http://www.google.com/search?&q=66.235.180.91+site%3Aurlquery.net Note: this site can be reported as malicious by reputation services such as WOT, perhaps due to links to malicious domain information contained within. Proceed with caution.

ViewDNS IP/DNS Toolkit
http://viewdns.info/


Handy multi-tool website that can perform a variety of tasks, such as looking up WhoIs information, DNS resolution, host traceroute, etc.

DNSStuff Toolkit
https://tools.dnsstuff.com/

Similar toolset to the one above, but with a much wider range of tools. Kind of like a Swiss-army knife of IP an DNS address tools.

Email


Email Header Analyzer
https://mxtoolbox.com/EmailHeaders.aspx

Convenient tool to quickly analyze email headers. Breaks down all the flags into a convenient, easy to read table and calculates delivery delays (with graph) for each hop. Has a link on the bottom to "forget" the header details when you're done with them.

Reputation Databases


Web Of Trust
http://www.mywot.com/

"Crowd-sourced" web reputation service which works by letting its users rank sites they visit in four categories. May contain false positives but is most likely to have ratings for more obscure sites.

McAfee TrustedSource
https://www.trustedsource.org/

Great tool for checking web reputation of a specific domain name. TrustedSource databases are used by McAfee GTI and many spam filtering vendors, so if your emails stop getting to their destination - good place to check whether your SMTP server has been blacklisted. Will also show any recent increases in outgoing email activity, so it could be handing for spotting first signs of infection.

McAfee Website Reputation Database
http://www.siteadvisor.com

Another site by McAfee, which complements the TrustedSource IP and domain name reputation database. Will show any harmful files and behaviours (such as exposed user email addresses, etc), linked websites and annoyances, along with user-contributed feedback (useful for identifying spammer or phishing websites).

Norton Safe Web
http://safeweb.norton.com/

Similar to McAfee Site Advisor but will contain specific malware names and locations.

BlueCoat WebPulse Site Checker
http://sitereview.bluecoat.com

This one isn't extremely useful as it does not provide much detail, but can be used to verify how BlueCoat categorizes a specific site in their database. This database is also used across all BlueCoat proxy and web-content filtering appliances.

VirusTotal URL Checker
https://www.virustotal.com/#url

The popular multi-antivirus online file scanner, now owned by Google, has added the ability to scan provided URLs against over 50 different URL reputation services. Has ability for users to rank the URL "maliciousness" and provide comments. Great resources for quickly gauging if an address is safe.You can also use their "Search" tab to view Passive DNS history collected in previous lookups of the domain.

ThreatStop
https://www.threatstop.com/checkip

Crowdsourced searchable database of active and historical threats for IP addresses and domain names. A bit annoying in that on the first check, it asks you to receive and click an email link.

Endpoint Forensics


Windows Registry Cheat Sheet
https://www.dfir.training/resources/downloads/windows-registry

Massive crowd-sourced cheat sheet of key Windows Registry locations.

Network Forensics


RiskIQ Community (formerly PassiveTotal)
https://community.riskiq.com

Not to be confused with VirusTotal, PassiveTotal (which has now been acquired by RiskIQ) is a fantastic tool for searching current and historical information on IP addresses and domain names. The free community tier does give you a limited number of lookups per day, but this tool is fantastic for looking up historical WhoIs records, passive DNS records, current DNS records, and other available information.

Mnemonic PassiveDNS
https://passivedns.mnemonic.no/

Another great open PassiveDNS repository. No registration required.

hpHosts
http://hosts-file.net/

Crowdsourced "host file" - community built database of IP address and domain name resolutions and reputations. Can be really, really slow to load for the first time, don't give up.

Port Information Lookup
https://isc.sans.edu/port.html?port=

Invaluable tool for port information lookup, powered by the voluntary contributions to the SANS ISC log database. Will show both legitimate and malicious services (backdoors, trojans) that most often use the port, any CVEs associated with it, as well as any recent statistical increase in port activity worldwide. A must have in the arsenal of any network forensic investigator.

SpeedGuide Port Information Lookup
http://www.speedguide.net/port.php

Another excellent port information look-up tool. Does not have the same trending details as the one above, but often has a lot more details about the possible applications utilizing the port, including user-contributed comments.

Open Port Check Tool
http://canyouseeme.org/

Quick and easy utility for checking whether a port is open on the public IP address you're coming from. Will also show you your public IP address, so it can be used instead of the above tool.

Shodan
https://www.shodan.io/

"Search engine for the internet of things". Basically a huge online database of worldwide Nmap scan results. Lets you search for IP address, ranges, organizations, ports or keywords and returns anything that matches and could be seen connected to the public internet in the past few weeks.

Censys
https://censys.io/

Basically the same thing as Shodan, but also shows a pretty map. In my experience the results are not nearly as complete as Shodan.

ZoomEye
https://www.zoomeye.org/

Another Shodan alternative.


Log Analysis

Windows Security Log Events
http://www.ultimatewindowssecurity.com/securitylog/encyclopedia

A very extensive repository of Windows security log event IDs, failure codes and fields.

Event ID Information
http://www.eventid.net

A searchable event ID database, containing event ID descriptions from various sources and applications.

Avaya/Nortel Trace Analyzer
http://sharontools.com/tools/NortelDiagnostic/NortelDiagnostic.php

Shows the Nortel Passport (Avaya ERS) 8600/8800 trace file as a sortable table, helps to determine what is causing high CPU load and allows you to see a sortable table of MAC addresses, IP addresses and Ports.

Malware Analysis

VirusTotal
https://www.virustotal.com

Perhaps the most well-known multi-antivirus online scanning tool, now owned by Google and offering even a desktop-client for right-click uploading of suspicious files. Scans the files with dozens of various antivirus clients and has a user-contributed rating and comments system.

MetaScan
https://www.metadefender.com/#!/scan-file

Very similar to VirusTotal, with fewer antivirus engines but allows for a larger file size. Does not have the same community feedback mechanisms, but handy for double-checking VirusTotal or those cases where you need to scan a file just bigger than its 64Mb limit.

Payload Security Hybrid Analysis
https://www.hybrid-analysis.com/

Free malware analysis service powered by the VxStream Sandbox, which can be used to detonate executables, Office, PDF and APK files up to 180 Mb in size in a sandbox environment.

Browser Sandbox
https://www.browserling.com/

This isn't exactly a malware analysis sandbox, but it does offer the capability to open a website in a virtual browser. Very handy when a lab environment isn't available and you need to check what a suspicious URL looks like when opened.

Malpedia
https://malpedia.caad.fkie.fraunhofer.de/

Online encyclopedia of malware families.

Sucuri Site Check
https://sitecheck.sucuri.net/

Quick scanner for known website vulnerabilities and embedded malware. Will try to sell you the Sucuri WAF every time you run it, but can be handy in identifying/confirming site compromises and seeing exactly where the injected code is.


JavaScript Deobfuscator
http://deobfuscatejavascript.com/

Very effective JavaScript deobfuscator - saves you time figuring out what the final code looks like in obfuscated JavaScript payloads.

Malware Domain List
https://www.malwaredomainlist.com/mdl.php

Searchable database of known malware/C&C domains and IP addresses.

Cyber Chef
https://gchq.github.io/CyberChef/


A proverbial swiss army knife of parsing, decoding and converting just about anything you can think of.


Miscellaneous

Website Status Checker
http://downforeveryoneorjustme.com/

If you run into a website that will not load from your network, and you're wondering if it's something to be concerned about or the website is really down for everyone - the above site is a very quick and easy way to verify that.

Website Redirect Tracer
http://www.wheregoes.com/retracer.php

Most malicious spam/phishing campaigns nowadays use multiple redirects between the link included in the email, and the final payload page. This will trace and show you all the redirect URLs, without opening the final malicious destination.

Hex to ASCII to HEX Converter
http://www.dolcevie.com/js/converter.html

Very simple and easy to use HEX to ASCII and ASCII to HEX converter.

RegEx Composers
http://www.regexr.com/
https://regex101.com/#javascript


Great tools for composing and testing Regular Expressions (RegEx).