Encrypting Files with WinRar or 7z
Elastic Stack Serverless Security
Identifies use of WinRar or 7z to create an encrypted files. Adversaries will often compress and encrypt data in preparation for exfiltration.
Rule type: eql
Rule indices:
- logs-endpoint.events.*
- winlogbeat-*
- logs-windows.*
Severity: medium
Risk score: 47
Runs every: 5m
Searches indices from: now-9m (https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#date-math[Date Math format], see also Additional look-back time
)
Maximum alerts per execution: 100
References:
Tags:
- Elastic
- Host
- Windows
- Threat Detection
- Collection
Version: 5
Rule authors:
- Elastic
Rule license: Elastic License v2
Attackers may compress and/or encrypt data collected before exfiltration. Compressing the data can help obfuscate the
collected data and minimize the amount of data sent over the network. Encryption can be used to hide information that is
being exfiltrated from detection or make exfiltration less apparent upon inspection by a defender.
These steps are usually done in preparation for exfiltration, meaning the attack may be in its final stages.
- Investigate the script execution chain (parent process tree).
- Retrieve the encrypted file.
- Investigate other alerts related to the user/host in the last 48 hours.
- Check if the password used in the encryption was included in the command line.
- Decrypt the
.rar
/.zip
and check if the information is sensitive. - If the password is not available, and the format is
.zip
or the option used in WinRAR is not the-hp
, list the
file names included in the encrypted file. - Investigate if the file was transferred to an attacker-controlled server.
- Backup software can use these utilities. Check the
process.parent.executable
and
process.parent.command_line
fields to determine what triggered the encryption.
- Initiate the incident response process based on the outcome of the triage.
- If personally identifiable information (PII) or other classified data is involved, investigations into this should be prioritized.
- Quarantine the involved host for forensic investigation, as well as eradication and recovery activities.
- Reset the passwords of the involved accounts.
- Safeguard critical assets to prevent further harm or theft of data.
If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2, events will not define event.ingested
and default fallback for EQL rules was not added until 8.2, so you will need to add a custom pipeline to populate event.ingested
to @timestamp for this rule to work.
process where event.type in ("start", "process_started") and
((process.name:"rar.exe" or process.code_signature.subject_name == "win.rar GmbH" or
process.pe.original_file_name == "Command line RAR") and
process.args == "a" and process.args : ("-hp*", "-p*", "-dw", "-tb", "-ta", "/hp*", "/p*", "/dw", "/tb", "/ta"))
or
(process.pe.original_file_name in ("7z.exe", "7za.exe") and
process.args == "a" and process.args : ("-p*", "-sdel"))
/* uncomment if noisy for backup software related FPs */
/* not process.parent.executable : ("C:\\Program Files\\*.exe", "C:\\Program Files (x86)\\*.exe") */
Framework: MITRE ATT&CKTM
Tactic:
- Name: Collection
- ID: TA0009
- Reference URL: https://attack.mitre.org/tactics/TA0009/
Technique:
- Name: Archive Collected Data
- ID: T1560
- Reference URL: https://attack.mitre.org/techniques/T1560/
Sub-technique:
- Name: Archive via Utility
- ID: T1560.001
- Reference URL: https://attack.mitre.org/techniques/T1560/001/