T1560.002 Google Chronicle · YARA-L

Detect Archive via Library in Google Chronicle

Adversaries may compress or encrypt collected data prior to exfiltration using third-party or built-in programming libraries rather than standalone archival utilities. Libraries such as Python's zlib, bzip2, gzip, zipfile, and rarfile modules; .NET's System.IO.Compression (GZipStream, DeflateStream, ZipArchive); C libraries libzip and zlib; and platform-native libraries enable adversaries to compress and encrypt data programmatically within a running process. Because no separate archival utility process (7-Zip, WinRAR, tar) is spawned, this technique evades detections focused on command-line archivers. Malware families including TajMahal, LunarWeb, SeaDuke, BBSRAT, InvisiMole, and Denis have all used library-based compression to stage and exfiltrate collected data.

MITRE ATT&CK

Tactic
Collection
Technique
T1560 Archive Collected Data
Sub-technique
T1560.002 Archive via Library
Canonical reference
https://attack.mitre.org/techniques/T1560/002/

YARA-L Detection Query

Google Chronicle (YARA-L)
yaral
rule t1560_002_archive_via_library {
  meta:
    author = "Detection Engineering"
    description = "Detects T1560.002 - Archive via Library: compression DLL loading by non-archiver processes, PowerShell and Python using in-process compression APIs, scripting interpreter-driven compressed file creation in staging paths. Covers TajMahal, LunarWeb, InvisiMole, SeaDuke TTPs."
    mitre_attack_tactic = "Collection"
    mitre_attack_technique = "T1560.002"
    mitre_attack_url = "https://attack.mitre.org/techniques/T1560/002/"
    severity = "HIGH"
    confidence = "MEDIUM"
    created = "2025-01-01"

  events:
    (
      $e.metadata.event_type = "PROCESS_MODULE_LOAD"
      and re.regex($e.target.file.full_path, `(?i)(zlib\.dll|zlib1\.dll|zlibwapi\.dll|bzip2\.dll|libbzip2\.dll|libzip\.dll|minizip\.dll)$`)
      and not re.regex($e.target.file.full_path, `(?i)(system32|syswow64|7-zip|winrar)`)
      and not re.regex($e.principal.process.file.full_path, `(?i)(7z\.exe|7zg\.exe|winrar\.exe|msiexec\.exe)$`)
    ) or (
      $e.metadata.event_type = "PROCESS_LAUNCH"
      and re.regex($e.target.process.file.full_path, `(?i)(powershell\.exe|pwsh\.exe)$`)
      and re.regex($e.target.process.command_line, `(?i)(IO\.Compression|GZipStream|DeflateStream|ZipArchive|ZipFile|ICSharpCode|DotNetZip)`)
    ) or (
      $e.metadata.event_type = "PROCESS_LAUNCH"
      and re.regex($e.target.process.file.full_path, `(?i)python[0-9]*\.exe$`)
      and re.regex($e.target.process.command_line, `(?i)(import (zlib|bz2|gzip|zipfile|rarfile|lzma|tarfile)|zlib\.compress|bz2\.compress)`)
    ) or (
      $e.metadata.event_type = "FILE_CREATION"
      and re.regex($e.target.file.full_path, `(?i)\.(gz|bz2|zlib|lzma|xz|lz)$`)
      and re.regex($e.target.file.full_path, `(?i)(temp|appdata|programdata|users.public)`)
      and re.regex($e.principal.process.file.full_path, `(?i)(python[0-9]*|ruby|perl|node|java|javaw|wscript|cscript|mshta)\.exe$`)
    )

  condition:
    $e
}
high severity medium confidence

Chronicle YARA-L 2.0 rule for T1560.002 using UDM event types PROCESS_MODULE_LOAD, PROCESS_LAUNCH, and FILE_CREATION. Covers compression DLL loading outside trusted system paths, PowerShell and Python using in-process compression APIs, and scripting interpreter-initiated compressed archive staging. Uses backtick-delimited regex literals per YARA-L 2.0 syntax. Applicable to UDM-normalized Windows endpoint telemetry ingested via Chronicle forwarder.

Data Sources

Google Chronicle SIEMChronicle UDM-normalized Windows endpoint telemetryChronicle Forwarder with Sysmon or CrowdStrike/Carbon Black feed

Required Tables

UDM Events with event_type in (PROCESS_MODULE_LOAD, PROCESS_LAUNCH, FILE_CREATION)

False Positives & Tuning

  • Python ETL or data pipeline workflows (Apache Airflow tasks, custom ingestion scripts) that import compression modules to handle compressed data files, with imports visible in process command-line arguments captured by Chronicle
  • PowerShell-based deployment automation using ZipFile or GZipStream to package application components or config bundles before distributing to endpoints via SCCM or Group Policy
  • PyInstaller or cx_Freeze packaged Python applications that load compression DLLs from non-standard application directories and trigger PROCESS_MODULE_LOAD events during runtime unpacking
Download portable Sigma rule (.yml)

Other platforms for T1560.002


Testing Methodology

Validate this detection against 4 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.

  1. Test 1Python zlib Compression of Sensitive File Collection

    Expected signal: Sysmon Event ID 1: Process Create with Image=python.exe, CommandLine containing 'import zlib' and 'zlib.compress'. Sysmon Event ID 11: File Create for %TEMP%\stage_df00.zlib. DeviceFileEvents: FileCreated action for the .zlib output file. DeviceFileEvents: FileRead action for the hosts file.

  2. Test 2PowerShell GZipStream Compression via System.IO.Compression

    Expected signal: Sysmon Event ID 1: Process Create with Image=powershell.exe, CommandLine containing 'IO.Compression', 'GZipStream', 'MemoryStream', and 'CompressionMode'. Sysmon Event ID 11: File Create for %TEMP%\stage_df00.gz. PowerShell ScriptBlock Log Event ID 4104 with full .NET compression code.

  3. Test 3Python bzip2 Multi-File Collection and Compression

    Expected signal: Syslog/auditd: python3 process execution with command line containing 'import bz2', 'tarfile', and output path in /tmp. File creation event for /tmp/stage_df00.tar.bz2. Auditd syscall events: openat for source files, write for output file. Linux process accounting: python3 with suspicious file access pattern.

  4. Test 4Python rarfile Library Compression (Third-Party Library)

    Expected signal: Sysmon Event ID 1: python.exe with CommandLine containing 'import zipfile', 'ZIP_DEFLATED', and temp path. Sysmon Event ID 11: File Create for %TEMP%\stage_df00_lib.zip. Potential child process for pip install subprocess. DeviceFileEvents shows file read of hosts file and write of .zip artifact.

Unlock Pro Content

Get the full detection package for T1560.002 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections