Disk Flashcards
How should you run Kape?
from a USB drive, it’s self contained
provides the ability to forensically extract files from a mounted drive, including hidden or locked system files. (Free)
Kape
Average breakout time in 2017
~2 hrs
Primary purpose of IR
Cyber threat intelligence. What is happening? Otherwise, they will come back. Qualifying what the adversary wants and does will stop future attacks.
Primary output of the exercise.
What is the containment phase of IR?
Preventing additional adversary actions while monitoring activity. Active defense.
Not pulling the plug while creating cyber threat intelligence.
Manual and automated scanning looking for evil
Hunting
Why is baselining important to hunting?
Have to be able to establish what “normal” looks like before you can see what abnormal is.
How does threat intelligence get to the SOC?
Generated by HFS/NFS/CFS as part of Hunt/Incident detection, signatures created are put into intelligence as a product, fed back to the SOC.
Proper threat intelligence team will arm a hunt team with:
Where to look, based on APT type activity
What to look for: signatures. Reg keys, malware footprints, IP/domains, hashes, utilities used, TTPs…
Likelihood of attack
Hunt teams should have, at a minimum
Trusted visibility into endpoints and networks across the org. (Ability to use powershell or an EDR tool to sweep the entire enterprise)
Remediation should, at minimum:
Deny adversary access to the environment
Eliminate the ability for the adversary to impact remediation efforts
Remove presence of adversary from the environment
Degrade the future ability of adversary to return
Atomic Indicators
Pieces of data that are indicators of adversary activity all on their own, such as emails, IPs, strings from C2 channnels, FQDN, etc.
Computed Indicators
Hashes of malicious files, data included decoded C2 protocols, some IDS signatures
Behavior indicators
A profile of behaviors. Bad guy likes to tunnel traffic through think tanks, use macros for word documents, targets these types of targets, and uses these types of specific computed and atomic indicators. Like a CrowdStrike profile.
How many stages is the MITRE tactic categories, and where was it derived from?
10 stages, derived from the 7 stage Kill Chain.
Control, Maintain, and Execute are broken out from the latter stages of the Kill Chain.
What is STIX?
Structured Threat Information Expression (STIX™) is a language and serialization format used to exchange cyber threat intelligence (CTI). STIX is open source and free allowing those interested to contribute and ask questions freely.
The equivalent of narrowing down a human suspect through identifying characteristics, but for adversaries
IOCs.
Open sourced community driven standard format for IoC’s
STIX
Tool aimed at (but not limited to) helping Malware researchers identify and classify malware samples. Create descriptions of malware families based on textual or binary patterns>
YARA
What is a YARA rule?
A description of strings/boolean values that help determine a Malware variant.
Tools for making IoC rules
YARA, STIX, OpenIOC
Mandiant tool for standardizing IOC’s
OpenIOC
an antivirus signature that you can control, basically
an IOC
Free tool that provides host investigative capabilities to users to find signs of malicious activity through memory and file analysis and the development of a threat assessment profile.
FE Redline
Finding fileless malware should start with
….looking for the evidence of its execution when it RUNS.
Malware that is not active but is dormant is harder to find because
We can’t detect the malware in memory
How should you structure finding evil, from broad too specific?
Automated enterprise wide sweeps that can be signature based should start early, and then using targeted EDR data and triage data should be spent only on narrowed hosts that are suspicious, as they are time consuming. More manual processes should be used sparingly.
Mechanisms for detecting compromise of systems w/o malware on them
Program execution, File opening, File knowledge, event logs, browser usage
where malware hides, and names
Like to name it svchost, explorer.exe, win.,exe; app data folders (where outlook and explorer drop stuff)
Likes to hide in temp folders, windows folders, and internet files, system volume files….
They’ll often pack it, run it through python or after converting it to text, etc….obfuscating it
Best way to combat processes masquerading as legit
whitelisting
Malware uses services such as ______ to hide in plain sight
frequent compilation, packing, and armoring. It will mimic known good services and normal windows services.
Most frequent hallmarks of malware evasion
Probably create a new service (scheduler @ cmd)
replace an existing service, like the wireless zero config service
register as an outrun process in memory
process injection
To obtain a commercial software certification (to conduct code signing) you usually need ____ at a minimum, but often ______
Passport/phone bill (something to prove identity)
a Dun and Broadstreet rating (Level of financial standing/stability); shows that your org is a stable business.
Examples of code-signing certs being manipulated
Stuxnet
opera browser manipulation that allowed access to private keys
adobe key signing cert stolen
When did MSFT start doing code signing, and on what code?
Server 2008, Drivers
Drivers give you access to what level of the O/S?
Kernel
When did MSFT start enforcing code signing for executables?
On servers: Server 2016
Workstations: windows 10
You have to turn on executable signing!
difference between corporate and business code signing cert
For corporate, you need to have a Dun financial rating (Dun and Broadstreet) Shows you have a stable business.
% of malware that’s signed
around 3.5%; higher % for nation state attacks
Downside to signed malware
If you revoke the signing cert (add it to the CRL) it would put a beacon on any version of that code in the wild. Makes rapid re-development/redeployment of code hard
How to downselect code that’s signed for investigations
You can usually ignore code signed by well known sources such as MSFT, google, apple, etc.
Finding evil in process starts with
Identifying normal processes and their locations. (Lsass.exe, taskhostw.exe, winlogon) Cross check that it lives in the correct directory/location. (such as %SystemRoot%\System32\smss.exe)
What is sigcheck?
Checks for signed code, upload to VT
What is density scout?
Checks for possible obfuscation and packing of a file. File will receive a score; this score can be used to identify whether a set of files is worth investigation.
What is pescan?
command line tool to scan portable executable (PE) files to identify how they were constructed. Various metadata is displayed, identifying items such as:
Compile timestamp
MACB timestamp
File size and type of executable
Target OS and whether binary is 32 or 64 bit
Linker version used
Entry point address and desired image base address
Whether an X509 certificate was used and who the author is
Whether there is a checksum present and does it match the binary
Optional analysis of the PE internals to generate an abormality score which compares the internal construction to the standard operating system files. Higher scores equate to larger differences.
Optional MD5 and/or SHA1 hashes of the file can be generated as part of the scan.
Built in windows command to query service configurations
sc
Places to look for evidence of program execution
Prefetch, Shimcache, userassist registry keys, and jump lists.
Places to look for evidence of program execution
Prefetch, Shimcache, userassist registry keys, and jump lists.
Indications of odd behavior from seemingly normal OS artifacts could include
cmd.exe exeuction
Sysinternals tools usage (psexec, procdump, psloggedon)
at.exe or schtasks.exe execution (Persistence)
wmic.exe, Powershell.exe, or winrm.vbs execution
net.exe use, used for mapping drives or lateral movement
reg.exe or sc.exe (addition of run keys or services)
mount points2 registry key: records shares such as C$, Temp$, etc
.job files in C:\Windows\Tasks: odd application tasks executed
Where would you see an adversary adding new run keys or services?
Use of reg.exe or sc.exe
Where are some MSFT native tools an adversary might use for persistence or lateral movement?
Sysinternals tools (psexec, procdump, psloggedon) or net.exe (network)
When looking for malicious processes, some anomalous characteristics might include?
starting with wrong parent process image executable in wrong path misspelled processes incorrect sid (starting from wrong account) Processes with unusual boot times Unusual command line parameters packed executables
How does density scout work?
tries to compress a file; parts of the file that are obfuscated or encrypted won’t compress. Finds parts of files that have high frequency letters (usually encrypted) content or high entropy. (randomly generated)
You can usually compress standard EXEs very well (50%+) anything less than 10% compression represents concern.
What Is temporal analysis?
fancy term for “time lining”
How to use google post density scout to further check executables with low compression rates?
Look to see how common they are. Google/VT; put the full path into google. (If there’s zero hits, or even a recommendation, it will have a hit)
Technique that obfuscates or encrypts data or software and encapsulates it into a file along with a program to perform decryption/deobfuscation
packing. a “packed executable” is a piece of software with an unpacking program.
PEscan looks for what?
Code anomalies. Will present why it thinks the executable is weird, in the notes, and providing a rating. Compile data can be interesting….as is the CPU type. (32-bit code is unusual)
Where does 32 bit programs run from?
Syswow64, if they’re standard windows processes
Where do 64 bit programs run from?
System32==
Verifies that images are digitally signed, provided the root certificate store is updated.
Sigcheck
Checks VT detections while verifying code signing
sigcheck
Two hives that autoruns most often usually live in, and when are they usually executed?
NTUSER and Software; executed when a user logs on
How does an adversary manipulate the userinit registry key?
This key (in the Software hive) is used by Winlogon to execute explorer.exe and userinit.exe, at startup.
Greatest hits for places to stick persistence mechanisms (WADSSS)
W-MI Event Consumers A-utostart locations A: GPO, MS-Office add-ins, BIOS. D-LL's (DLL hijacking) S-ervice creation/replacement S-ervice failure/recovery S-cheduled taskss
What are runkeys?
AEPs. Autostart Execution Points. Things that start with the O/S. Frequently abused.
File system location that (and those like it) that can be used to launch attacks, not requiring admin credentials.
%AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
Tool used for evaluating registry runkeys for maliciousness
RegRipper
How to get malware to execute from a software link in user space (where to put it)
%AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup; shortcuts in here will link and execute to representative binaries
How are MSFT services used as persistence mechanisms?
They replace unused services with malware, or modify an auto-start to include a new binary, or manipulate service recovery features (like dr. Watson)
How are MSFT services used as persistence mechanisms?
They replace unused services with malware, or modify an auto-start to include a new binary, or manipulate service recovery features (like dr. Watson)
What is DLL Search order hijacking?
Putting a DLL with the same name in the directory of a core DLL, so it launches ahead of the existing DLL.
Traditionally, search-order hijacking attacks
utilize an executable file’s DLL search path to load
spoofed DLLs through the known DLLs record.
What is phantom DLL hijacking?
Inserting a DLL into a place where it would normally exist, but doesn’t. List of “known” DLLs for all the windows variants kept at KnownDLLs, and will include DLLS not found in that version. IE, for Windows 2016 R2 server, inserting a DLL that would normally be there but isn’t turned on/used for that build; when windows sees that DLL exists at startup, it will launch it.
Great example is replacing the FaxDLL (fxsst.dll) in the system32 folder.
What is DLL side-loading?
Getting a new version of a legit-DLL loaded into the system. Part of the dynamic update features of Windows, just like a Web 2.0 AJAX style query.
DLL side-loading, in contrast to search order hijacking, utilizes the WinSxSn assembly to load the malicious DLL from the SxS listing, which is located in the following registry key:
%TEMP%\RarSFX%\%ALLUSERS PROFILE%\SXS\ or
%TEMP%\RarSFX%\%ALLUSERS PROFILE%\WinSxS\
What does the Sysinternals Autoruns tool do?
Easy means to collect and analyze services on a system. Similar to SC. Will also collect currently scheduled jobs.
What can schedule tasks on remote systems?
both at.exe and schtasks.exe
How does a WMI event work?
- Create an event filter, that “triggers” based on an event occuring (for example, run every 20 seconds)
- Once triggered, an event consumer is added to the system with a script and/or executable to run (run this PS script to beacon to a backdoor)
- Finally, tie the event and consumer together as a “binding” and enter it in the WMI repository
File used to register new object classes into the WMI registry
MOF file (managed object format)
Where was the first big WMI based attack? How was it executed?
Stuxnet
A zero day (print spooler service) was exploited to deliver an EXE and an MOF file. The MOF file was auto-compiled by the system, creating a WMI event and consumer that immediately executed the malicious executable.
Native way to interrogate WMI for suspicious behavior
Powershell:
Get-wmi-object
Command line tool to look at windows malware persistence mechanisms?
autorunsc.exe; goes through and analyzes, like sigcheck,. (doesn’t do dll hijacking or service failure)
What does I E X indicate in memory?
Something to be concerned about. IEX is the “Invoke Expression” cmdlet, which takes the argument of a script and executes it. Often used to download the malicious script, which then gets passed in to PS. Evades many A/V tools.
What does I E X indicate in memory?
Something to be concerned about. IEX is the “Invoke Expression” cmdlet, the underlying .net command is
“Net-Object.System.Net.WebClient) which takes the argument of a script and executes it. Often used to download the malicious script, which then gets passed in to PS. Evades many A/V tools.
What is a download cradle?
A download cradle is a single line command for download and code execution. … A download cradle can also be part of a persistence mechanism, tooling or execution at other attack stages when an attacker attempts to download capability or run fileless
Can be used to interrogate local and remote systems for processes, network configs, etc
WMI + WMIC
How does WMI authenticate?
Non-interactively. (Network logons)
What’s the problem with many EDR platforms?
Doesn’t do historical well; mostly live, in place. (The LR functionality is FE using Redline for the historical)
Should you turn off Powershell remoting in your environment?
If you do, you’re likely using something less secure. (PSEXEC) It’s no more dangerous than RDP/RPC. Powershell remoting is MUCH more secure.
Powershell commands are based on?
.NET framework objects, which mean the objects carry multiple aspects or properties of the command. (Cmdlets)
How does Powershell handle command output?
By encapsulating it in objects, which can be passed to other cmdlets for additional processing. One cmdlet might make an array of objects for computers, files, network objects, the next might groom out the files, next might perform actions on those files.
What is a Powershell provider?
how Powershell abstracts collections of items into containers. For example, “Get-ChildItem HKLM:Software” would abstract all the registry keys in that hive to an object.
Windows alternative to Secure Shell
PSSession: ps for secure remoting
PS command used as one-to-many option for executing one command on multiple remote systems
Invoke-Command (E I X)
Sends commands without an interactive session being established.
Why PS is more secure than RDP/PSexec
It doesn’t cache credentials; only vulnerability is to things like ticket attacks
How do you use PS to send a series of commands remotely?
invoke-command, then use a -scriptblock parameter, or -filpath to have it run from a local file.
Doesn’t need to set an array to loop through data.
Why is Invoke-Command better than looping through an array of systems on the server running it?
The former uses the resources of the target to execute the commands, the latter relies on the processes/power of the invoker.
Why do we avoid CredSSP in Powershell?
It caches the credentials so that it can pass them to a 3rd party/system that requires it; similar to SSO.
Creds aren’t cached otherwise, so Mimikatz/Incognito can’t steal them.
How does Kansa work?
Organized collection of scripts andl modules and scripts into a framework for IR purposes. Much of it PS, but can execute anything. Uses PS for remoting.
two prereqs for Kansa
your account must have admin privs on the remote host windows remoting (WinRM) enabled.
All the plugins that Kansa runs are located where?
./Modules folder
All the analytics that Kansa can run on collected data is found where? How does it work?
./Analysis
All of the ways that it will crunch that data produced by the Modules in Kansa are listed in individual Analysis scripts. You can enable and disable ones you want it to run at the end of a pull, or run them ad-hoc.
Why should you look at when a potential C2 domain was registered?
If it’s been around a long time, it’s less likely to be used as C2 unless the adversary is just holding it for a long time. (Infoblox will block recently registered domains tho, so smart bad guys will hold them past that time)
What are Kansa analysis features that have “stack” in the name?
It’s the stackable feature of Kansa. If you see 30 hosts that have a specific run key, it will provide a “counter” for that occurrence across the environment.
Frequency analysis scripts.
how to use 3rd party binaries with Kansa, and where it needs to be told to run it
Put the binaries you want to run in the .\Modules\bin and when executing, push with -pushbin. Remove them after with -rmbin
Must add the tool as a BINARY DEPENDENCY #BINDEP in the collector script. Even commented, it will run
How to bring memory analysis into Kansa (to try to get
Get-RekalPsList.ps1
What is WMI for?
Windows Management Instrumentation. Deeply invasive control of the underlying Windows architecture, meant for administrative tasks in a large environment
Why is WMI traffic hard to detect?
It exists for uses in every stage of the kill chain
It’s largely only in memory
Windows native, minimal logging of actively
evades whitelists
scripts can be obfuscated when run through it
encrypted
runs over standard PScom/WinRM pipes
WMi for recon
List user accounts, groups, netuse lists, list of fixes and patches installed, etc
Why is WMI the real fear, not PS?
Powershell has history and logging. WMI is often the underlying commands being run, and usually silently.
There’s no automatic logging for WMIC commands by default
Examples of WMI for priv esc
Powershell Empire has multiple WMI tools for finding services running in the wrong directories or with elevated privs, that could be manipulated. Also looks for services that have a space and aren’t quoted, where you could inject other services.
WMI process for lateral movement
WMI Process Call Create: used by NotPetya and BadRabbit uses to execute code remotely
How does rundll.exe let you avoid whitelisting restrictions?
It’s the valid app that calls DLLs; if you want to run a malicious DLL, you could invoke this manually to call another DLL, thus skipping some whitelist controls.
WMI persistence mechanism
Creation of Event Consumer Backdoors. (Embedded in WMI database) is there an event/trigger condition (MOF file) that doesn’t belong?
Ways to create entries in WMI database for persistent attacks
Use PowerShell or mofcomp.exe
NotPetya uses ______ to spread it’s payload
Direct RCE for systems accessible via WMI Process Call Create.
Also uses Remote shares accessible via NetEnum/Netadd to spread its payload
Ways to identify WMI commands for cyber reconstruction efforts (how to catch WMI attacks)
Enable Event logs (will fill up your logs QUICK)
Sysmon has its OWN event log (better)
Use PowerShell to discover suspicious events
Commercial EDR tools (Carbon Block, Tanium, HX) (best)
3 things PS can be used to look at to find malicious use of WMI
Looking at:
- event filters (Trigger)
- EventConsumer (Script or executable to run)
- FilterToConsumerBinding (binding, storage, persistence)
3 Tool for exploring WMI database
WMI explorer tool (wmie2)
Mandiant WMI-Flare tool (Offline parsing)
Mandiant PyWMIPersistenceFinder
WMI forensics scripts
Two WMI events to search for first
ActiveScriptEventConsumer - execute a predefined script
CommandLineEventConsumer - Launch an arbitrary process (more common: launch a download cradle)
Focus on consumers!
What is a MOF File?
Think of it as text file representing the WMI definitions and instances.
Used for rebuilding and recovering the WMI database. Found in WMI repository.
Why is Mofcomp.exe dangerous?
Can use it to create WMI objects from anywhere; doesn’t NEED to reside in the WMI repo or even on the same computer. (-N to add remote machine names)
Can use it to rebuild WMI from another machine with arbitrary events/consumers. In this scenario, the residue isn’t even on disk, but in memory.
Student use of WMI?
You can send a MOF file to the Print Spooler, which will compile it and import it into the WMI repo. (Was just a windows service, not an exploit)
Anything you wrote in there was written in as an admin account to the backend.
Method to remote write to a WMI DB?
mofcomp -N \machinename\root\subscription test.mof
have to delete the #PRAGMA from the first line of the file
Do you need a MOF file to write into the WMI db?
No. Can write directly into it using .NET code (like PS)
When you run a MOF file from a non-standard location, it writes an artifact to:
HKLM registry, WBEM auto recover key
Seeing unusual WMI processes running
Consumer portion
look for wmipvrse (especially on non-servers)
Look for wmipvrse’s parent process. (Should be svchost!)
Look for wmipvrse spawning things like cmd/ps
Active script portion
Look for scrcons.exe
RARELY SEEN!
Hunting for WMI activity involves what
Looking for WMIC call create /node: invoke-wmimethod or invoke-CimMethod (PS) wmiprvse with unusual parent wmipvrse with unusual children (like PS) scrcons.exe running PS with encoded commands
Some of the event logs for credential harvesting
4624 (Logons)
4720 (Account Creation)
4776 (Local account authentication)
4672 (Privileged account usage)
What is protected processes, and when was it introduced?
Windows 8: Protected processes can only load signed code and can only be attached to other protected processes.
Why is protected process easy circumvented
It’s not on by default, and Mimikatz gets around it via a signed driver.
Remote credential guard does what?
Update to restricted admin: protects any account (not just admin) during RDP sessions.
Windows 8 integrated a lot of protections for _____ that no one integrated
Credential protections, via KB2871997. (Backport to Windows 7)
Why isn’t credential guard used pervasively? What does it do?
It’s hardware heavy; works with virtualized sandboxes. Has a lot of work to do for exceptions.
What is the core Active Directory authentication protocol used for users?
Kerberos
and
NTLM (for using local accounts, network logon w/SMB vs domain creds
An authenticated credential is composed of:
an identity and an authenticator (secret)
Create accounts to target on a local box when searching for a credential that can be used on other boxes
cached creds for users (ie, Joe on computer a has logged in via NTLM on another box, and his creds are cached there)
Helpdesk account (pushed to every box for local admin work)
Administrator account (if it hasn’t been randomized as part of build, with sysprep)
Challenge for hackers with local system creds that have been cached.
They’re encrypted and salted, so have to be offline cracked, unless you’re passing the hash. If you do crack them, you have the password, so you don’t need to pass the hash.
Attacking a local system for creds, what FOUR forms can the credential take?
Stored cached credential
NTLM Hash
Token
Ticket
NTLM pass the hash works specifically in what way?
The threat actor has access to a box, find a LOGGED IN system user, accesses the stored credential in the form of the NTLM hash, and then accesses another machine that has that account cached; when it asks the first box for the cred, the hash is passed over. Requires a logged on user, another machine that has that same user cached, and access to the hash.
How does Windows 8.1 introduce defense against Pass the Hash attacks?
Starting at 8,1, any priv account is not allowed to do a network logon over NTLM, with the exception of the default administrator account.
(Why you dont clone computers)
Caveat to a local cred in the form of a hash, token, or ticket being dumped?
It must be for a user that is LOGGED ON, or the process is still running
domain account hashes are stored where during interactive sessions
memory
How do you defend cred theft, locally?
Monitor admin accounts/boxes
Stop remote interactive sessions w/Admin accounts
Properly terminate RDP
Windows 10 (cred guard, tspkg, domain protected users group)
Credential guard defends creds by moving them
…from LSASS to a hypervisor controlled isolated process.
What privileges are required for any system you’re trying to steal a token from?
SeImpersonate or Delegate. (or admin privileges necessary to add those permissions)
Type of token that facilitates authentication even across network resources?
Delegate tokens
Can be used w/PSExec to map remote admin shares
Type of token that allows for local security context shifts
Impersonate tokens. (SeImpersonate)
If a token is present on a system, a user with the SeImpersonate privilege can do what?
Extract the token
Reuse it to manage group membership or add users
Escalate local privileges
Power “delegate” tokens are only available to an attacker when _______
Console logons, RDP, using “Run As” on the machine.
Smart additional ways to defend token theft on endpoints
“restricted admin” prevents tokens from being available on the machine during remote admin sessions (which should be avoided, anyway)
Remove delegation of high value accounts in AD
Use group policy to set time values for sessions, after which it disconnects (to prevent improperly terminated RDP sessions
Cached domain credentials are stored in
SECURITY\Cache reg key
To prevent a situation where a user cannot logon, windows ____________
caches the last 10 logon hashes. (25 for 2008+)
Format of cached credentials on modern Windows systems
mscash2
How long do cached credentials live?
indefinitely, even after a reboot.
Creddump can be used to?
extract hashes off-line, to be cracked
Why we shouldn’t clone endpoi nts
Creates a standard admin, same RID, which can be used in credential theft/lateral movement very easily
Unique ways to limit attacks on cached credentials
Minimize amount of cached accounts
Use Protected Users group
NSA/DoD recs for cached credential limit
0-1 (NSA)
<4 (DoD)
What does Nishang PS framework allow analysts to do?
through Get-Lsasecret.ps1, can dump and decrypt the LSA secrets. These secrets, if they’re privileged incorrectly, can let a service account be used to exploit escalation of privilege. (looking for overprivileged service accounts)
Can be combined with ticket requests (kerberoasting); offline the ticket, crack it, and use it with the service account.
Often used for looking for overprivileged accessible domain service accounts. (badly installed agents, etc)
Nishang Powershell framework (pulling encrypted service account details from LSA)
Kerberoasting to marry that account with a ticket for its use
Unique ways to defend against LSA attacks
dont employ services or schedule tasks requiring domain administrative trusts
reduce number of services that require domain accounts
Group managed services, through “Group Managed ServiceAccounts”
How do you acquire a golden ticket? (kerberos)
Stolen from memory
kerberos ticket w/o an expiration date, and has domain admin.
What is kerberoasting?
request tickets for service accounts: they send you the ticket for a service account, you roast it(crack it) and then reuse it
When does a golden ticket expire? What can it be used for?
Expires when the krbtgt is rotated. Changing other credentials is meaningless
What does managed service accounts do, and when was it introduced?
Server 2008R2
Introduces frequent password changes and long passwords
How can you flexibly utilize a dumped ticket, as a “transplant” ?
If you dump a privileged ticket, you can export it from the system, dump it into Mimikatz (or other utilities) and then import it into another system, where it will be cached and available
Key weakness that allows kerberoasting to work
ANY user can request a ticket from a DC for ANY service
The ticket returned for the service has a non-salted hash for the account that runs the service.
This password can be easily cracked offline
Dangers of Golden Ticket to defenders
- If an attacker loses access, ANY user-level access to a domain joined system will provide a mechanism to re-use the golden ticket to get priv access again using Pass the Ticket.
- Works even if a full password reset is conducted for all enterprise accounts
- Attack can be constructed with access to either the NTDS.dit or memory. (attacker must have Admin access on a DC to get this)
An all-access ticket for a single service or computer is referred to as a
“Silver ticket”
Why are silver tickets so effective?
they’re excellent backdoors: auth occurs without requiring comms with the DC. Attacks a computer account password.
What is a Skeleton Key for AD?
After gaining access to a DC, a tool like Mimikatz can “patch” LSASS to enable a backdoor password for any valid domain user.
It’s a SECONDARY password for the account; even if they change the primary, the secondary remains available.Easy and persistent backdoor for access.
Unique ways to defend against ticket attacks
Credential guard/Remote credential guard
Long and complex passwords on service accounts
Audit service accounts
Regularly change the KRBTGT password (no more than yearly
What does a hacker gaining the NTDS.dit do, and how do you get it?
Gains access to all the user and computer account hashes, which are encrypted. (though the encryption is easy to break)
Easiest way to get to a users personal access/drives/phones/computers,
How to get around the locked NTDS.dit file, when trying to export it?
use Volume Shadow Copy service.
Tools for extracting the NTDS.dit, and where is it?
\Windows\NTDS
Can be ripped by: ntdsutil NTDSXtract ntdsdump VSSAdmin PS Metasploit
Why use NTDS.dit for action on objectives?
Often, using admin credentials are noisy: if you have the NTDS.dit, you can natively log in as a user and see what they see, have access to their browser, OneDrive, phone, etc. Less noisy.
What is located inside every prefetch file?
The total number of times an application has been executed, the original path of the execution, and the last time of execution. (up to the last 8 times)
telemetry for execution
Why is the timestamp of the prefetch file?
It provides an extra bonus 9th “evidence of execution” for the application in question.
What’s the format of a prefetch file, and where’s it stored.
_.pf
ON WORKSTATIONS, in Stored in \Windows\Prefetch (not a server service)
Up to 128 files on
What does prefetch do?
Meant to give a process an extra bit of juice when it executes, next time will launch quicker/more efficiently. (On old hard drives, it would co-locate executables in close digital space so the hard drive didn’t have to scan to it)
SSDs and Prefetch?
IN windows 7, they started disabling prefetch for SSDs, but realized it was still providing efficiencies.
How would you look at the targets of sdelete?
the prefetch file for sdelete has the target of what was deleted. Doesn’t include registry keys, but file/filehandles.
How can you use frequency analysis of prefetch entries?
If there’s a huge recent amount of “living off the land” type tools, like netstat/net-use from command line, that might indicate that someone is in your space.
The first time a file is accessed is connected to the timestamp (creation) of
the .pf file.
Over time, a prefetch file may be….
Overwritten with the most recent runs of the file, or erased if the application hasn’t been used in a long time. (After which it gets re-created for a new run, with a new timestamp)
Creation of a .pf indicates
that an application ATTEMPTED to execute, not that it did so successfully.
What happens to a prefetch file if the application is run from a different directory other than standard?
It changes the hash value, because it’s been executed from a new location. (useful info!)
What does pecmd.exe do?
Pulls information on a directory or a single application for prefetch, including volume information, files and directories referenced, and all execution time info.
Difference between -f and -d for pecmd.exe
-f is for a single application, -d is a directory of applications
What is the hash of a prefetch file calculated from?
the directory path that the executable is in, and the command line options of the programs
What happens if you run calc from cmd, if cmd is launched from /syswow (32 bit folder)
Why?
it will launch a 32 bit version of the calc app. A 32 bit process can’t have a 64 bit child process.
Why should we always look at spikes in 32 bit programs (things running from syswow)
Because bad guys write a lot of malware in 32 bit, and a lot of child processes are launched in 32 bit as well, which is unusual for system activity
Filter = _____
Consumer = _________
Binding - _________
Trigger
Action
Host it runs on
How do you use sdelete to fully wipe forensic evidence of prefetch, including unallocated space?
Sdelete has a -z option, to zero-ize unallocated spac.e
If bad guys have deleted prefetch, zeroized unallocated space….what option is left to find evidence of the app execution?
Volume shadow copy (provided they didn’t turn VS off/on again or memory (volatility can pull prefetch)
pecmd can use a -vss option to also look in volume shadow copy at run
What is Application Compatibility/Shimcache, and why does it matter forensically?
Designed to detect program compatability challenges. (Apps should be able to run in any version of Windows, but that’s hard)
What is in shim cache?
All the application files, AS they’re run, that have been checked for compatibility/shimmed
When an app is shimmed, what is written?
the last modification time of the executable
the full path of the exe
(not when it was shimmed, when it was executed)
Also, when explorer browses the folder with the executable, and it’s shown in the gui (weird) You hav etc see it with your eyeballs
Every time psexec is run, what happens on the remote machine?
a new version of psexsvc is pushed to that machine. The NEW version gets shimmed every single time, even though it’s overwriting the same file. (good to know)
What forensic evidence is created when an executable is renamed?
an entry in the shimcache, because it’s shimmed again
When you move a file, what cache entry is updated?
shimcache