Explore the TW archive
← All analyses & audits

Trigona: configuration resource, key hierarchy and file footer

Historical architecture analysis of the Delphi ransomware path: CFGS resource, AES-CBC-RBT, RSA/AES-OFB, variable footer and wiper separation.

Review boundary: Resource location, integrity checking and section parsing are traceable in code; file recovery remains key-dependent. No independent sample, runtime, C2 or campaign verification.

At a glance

Key findings

  • CFGS ties together configuration, key material, exclusions and the note.
  • File encryption and wiping are separate impact paths.
  • Format knowledge replaces neither the private key nor tested recovery.
Read the analysis ↓
Review snapshot, method and evidence
Snapshot
Artefact: trigona_config_extractor.py · SHA-256 045508e91a26…
Scope
ThreatLabz analysis of Trigona plus the official configuration extractor; no claim about activity in 2026.
Method
Original architecture reconstruction from the pinned source snapshot
Evidence
Official extractor pinned locally by file hash and revision.
Ruhrdigital / original analysis

What we derived from this evidence set.

With Trigona, the defensible story starts in the parser: locate the resource, verify integrity, read the fields. File impact and recoverability begin only where matching key material exists.

Evidence anchorsource snapshot checked
Artefact
trigona_config_extractor.py
SHA-256
045508e91a264349dfe2d70a76980e700d410f439328ed628670a61d9a9851e6
Revision
aa8b55c63411a0ec691b4023cfdf6a81e48e1641
Analysis basis
Official extractor pinned locally by file hash and revision.
Analysis / 01

Scope, snapshot and evidence boundary

ThreatLabz analysis of Trigona plus the official configuration extractor; no claim about activity in 2026. The bounded question is: which architecture and behaviour claims does this specific evidence set support, and which remain attributable only to the source?

ARTIFACT MANIFEST

Files and checksums

threatlabz-tools/trigona/trigona_config_extractor.py
045508e91a264349dfe2d70a76980e700d410f439328ed628670a61d9a9851e6

Official configuration extractor, read statically.

Visual overview & analysis model
Malware / Evidence Atlas

Binary start → Encryption effect

The analysis path for this report. Every node shows what is supported, where detection can start and where the claim stops.

5flow nodes 3detection artefacts 3rule formats
Claim

Binary start

The report binds its claims to the documented Trigona review record.

Detection focus

Preserve revision, origin and execution context.

Bound to primary research
Config Surface

Configuration fingerprint

Review pivots derived from the report — not a live configuration or universal family indicator.

01
Campaignconfiguration ID
support
02
Key roleparser-bound
core
03
File selectioninclude / exclude
core
04
Impactobserved files only
boundary
MODEL / 3662FC47Core, support and boundary — not risk scores
Detection Pack

Defensive artefacts

Source, validation and limits accompany every rule.

SourceOriginal derivation from the structure described in the report.ValidationCompiled with yara-python; synthetic truth table 3/3.LimitStrings and extensions are historical and mutable across variants.
YARAOpen rule
Defensive model
rule Windows_Ransomware_Trigona_Artifacts {
 meta:
  author = "Ruhrdigital Studio"
  scope = "historical family-likely artifact combination"
 strings:
  $note = "how_to_decrypt.hta" ascii wide
  $ext = "._locked" ascii wide
  $crypto = "TDCP_rijndael" ascii wide
 condition:
  uint16(0) == 0x5a4d and filesize < 20MB and all of them
}

Evidence status Supported by review evidenceBound to primary researchBounded or unresolved
Analysis / 02

What is supported — and what is missing

Primary sources, statically inspectable code and runtime observations carry different evidentiary weight. The map keeps those layers separate; missing first-party observation is not replaced by plausibility.

FILE / EVIDENCE MAP

Evidence chain and open runtime gap

The map separates primary source, reproducible source snapshots and runtime evidence not collected here.

A file reference does not establish runtime behaviour. Recorded processing is not a new execution.

SourceToolDerivedEvidenceMissingVerified referenceRecordedUnresolved

Evidence

Traceable source with an explicit sample gap.

Primary source

Published analysis or pinned upstream snapshot.

  • Primary source → trigona_config_extractor.pytechnically cross-checked · Verified reference

    File, commit and SHA-256 were pinned.

Related report section →
trigona_config_extractor.py

Locally hash-bound source snapshot, read statically only.

File
threatlabz-tools/trigona/trigona_config_extractor.py
SHA-256
045508e91a264349dfe2d70a76980e700d410f439328ed628670a61d9a9851e6
Location
1-222
  • Primary source → trigona_config_extractor.pytechnically cross-checked · Verified reference

    File, commit and SHA-256 were pinned.

  • trigona_config_extractor.py → No local malware sampleruntime unresolved · Unresolved

    The review remains static or source-bound.

Related report section →
No local malware sample

No first-party runtime, C2 or campaign telemetry.

  • trigona_config_extractor.py → No local malware sampleruntime unresolved · Unresolved

    The review remains static or source-bound.

Related report section →

Limit: A published observation is not an independent reproduction.

Analysis / 03

Entry and delivery chain

The report covers the ransomware core and its configuration, not a universal initial-access path. The Delphi PE contains a resource named CFGS that structures identifiers, RSA material, exclusion lists and the ransom note.

Analysis / 04

Architecture and data flow

The extractor locates CFGS, removes variable padding, verifies MD5 and parses three length-coded sections. ThreatLabz describes two-layer AES-CBC decryption with residual block termination. For files, Trigona combines per-file AES material with a 4,112-bit RSA key and AES-OFB.

Analysis / 05

Original code as architecture evidence

The short excerpt shows only the structure discussed in this chapter. It is not executed and does not contain a complete operational implementation.

pythontrigona_config_extractor.py · complete toolComplete analysis tool

Complete public offline analysis tool from the source snapshot already pinned in the report. The displayed code reads or decodes artefacts; publishing it does not prove we executed it on a malware sample.

threatlabz-tools/trigona/trigona_config_extractor.py · Lines 1–222
Show file hashSHA-256 045508e91a264349dfe2d70a76980e700d410f439328ed628670a61d9a9851e6
#!/usr/bin/env python3

# Author: Zscaler ThreatLabz
# Blog reference: https://www.zscaler.com/blogs/security-research/technical-analysis-trigona-ransomware
# Description: This is a Python tool to decrypt Trigona's ransomware configuration
# Follow us on Twitter: @ThreatLabz

import sys
import pefile
import json
import hashlib
import struct
from Crypto.Cipher._mode_cbc import CbcMode
from Crypto.Cipher.AES import _create_base_cipher


class AESCBCRBT(CbcMode):
    def _reset_state(self):
        self._next = [self.encrypt, self.decrypt]

    def decrypt(self, ciphertext, output=None):
        self._reset_state()
        return super().decrypt(ciphertext, output)

    def encrypt(self, plaintext, output=None):
        self._reset_state()
        return super().encrypt(plaintext, output)


class Stream:
    def __init__(self, data):
        self.data = data
        self.offset = 0

    def read_byte(self):
        data = self.data[self.offset]
        self.offset += 1
        return data

    def read_bytes(self, num_bytes):
        data = self.data[self.offset:self.offset + num_bytes]
        self.offset += num_bytes
        return data

    def read_dword(self):
        data = self.data[self.offset:self.offset+4]
        self.offset += 4
        return data

    def read_int_dword(self):
        return struct.unpack(">I", self.read_dword())[0]

    def read_data_block(self):
        size = self.read_int_dword()
        return self.read_bytes(size)

    def seek_bytes(self, num_bytes):
        return self.data[self.offset:self.offset+num_bytes]

    def seek_all(self):
        return self.data[self.offset:]


class Config:
    def __init__(self):
        self.cid = None
        self.vid = None
        self.file_rsa_pub_key = None
        self.ransom_rsa_pub_key = None
        self.ransom_note_aes_key = None
        self.extension_whitelist = []
        self.dir_whitelist = []
        self.email_contact = ""
        self.ransom_note = ""
        self.extensions = []

    def get_config(self):
        return {
            "cid": self.cid.decode("ascii"),
            "vid": self.vid.decode("ascii"),
            "file_rsa_pubkey": self.file_rsa_pub_key[4:4+0x202].hex(),
            "ransom_note_rsa_pubkey": self.ransom_rsa_pub_key[4:4+0x200].hex(),
            "ransom_note_aes_key": self.ransom_note_aes_key.hex(),
            "extension_whitelist": str(self.extension_whitelist),
            "directory_whitelist": str(self.dir_whitelist),
            "email_contact": str(self.email_contact.decode("ascii")),
            "ransom_note_template": self.ransom_note.decode("utf-8"),
            "extensions": self.extensions
        }

    def print_config(self):
        print(json.dumps(self.get_config(), indent=4))


def get_config_resource(pe):
    for rsrc in pe.DIRECTORY_ENTRY_RESOURCE.entries:
        for entry in rsrc.directory.entries:
            if entry.name is not None:
                if entry.name.__str__() == "CFGS":
                    offset = entry.directory.entries[0].data.struct.OffsetToData
                    size = entry.directory.entries[0].data.struct.Size
                    data = pe.get_data(offset, size)
                    return {"data": data, "size": size}
    return None


def parse_sections(data):
    cfg = Config()
    config_stream = Stream(data)
    padding_bytes = config_stream.read_byte()
    config_stream.read_bytes(padding_bytes)
    config_md5 = config_stream.read_bytes(16)
    cfg_data = config_stream.seek_all()
    actual_cfg_md5 = hashlib.md5(cfg_data).hexdigest()
    if actual_cfg_md5 != config_md5.hex():
        print("invalid config!")
        return None

    section1_size = config_stream.read_int_dword()
    section1 = config_stream.read_bytes(section1_size)
    parse_section1_stream(cfg, section1)

    section2_size = config_stream.read_int_dword()
    section2 = config_stream.read_bytes(section2_size)
    extensions = parse_section2_stream(section2)
    cfg.extensions = extensions

    section3_size = config_stream.read_int_dword()
    ransom_note = config_stream.read_bytes(section3_size)
    cfg.ransom_note = ransom_note
    return cfg


def parse_section1_stream(cfg, data):
    section1 = Stream(data)
    if section1.seek_bytes(4) == (b"\x00" * 4):
        section1.read_bytes(2)
    file_rsa_pub_key = section1.read_data_block()
    ransom_note_rsa_pub_key = section1.read_data_block()
    vid = section1.read_data_block()
    cid = section1.read_data_block()
    section1.read_data_block()  # unk1
    extension_whitelist = section1.read_data_block()
    contact_email = section1.read_data_block()
    dir_whitelist = section1.read_data_block()
    section1.read_data_block()  # unk2
    section1.read_data_block()  # unk3
    section1.read_data_block()  # unk4
    section1.read_data_block()  # unk5
    ransom_note_aes_key = section1.read_bytes(32)

    cfg.file_rsa_pub_key = file_rsa_pub_key
    cfg.ransom_rsa_pub_key = ransom_note_rsa_pub_key
    cfg.vid = vid
    cfg.cid = cid
    cfg.ransom_note_aes_key = ransom_note_aes_key
    if len(dir_whitelist) > 1:
        cfg.dir_whitelist = dir_whitelist.decode("ascii").strip().split("\r\n")
    if len(extension_whitelist) > 1:
        cfg.extension_whitelist = extension_whitelist.decode("ascii").strip().split("\r\n")
    cfg.email_contact = contact_email


def parse_section2_stream(data):
    section2 = Stream(data)
    extension_cnt = 0
    extensions_list = []
    for i in range(13):
        extensions_size = section2.read_int_dword()
        extensions = section2.read_bytes(extensions_size)
        ext_stream = Stream(extensions)
        while ext_stream.offset < extensions_size:
            size = ext_stream.read_byte()
            extension = ext_stream.read_bytes(size)
            extensions_list.append(extension.decode('ascii'))
            extension_cnt += 1
    return extensions_list


def aes_decrypt(aes_key, aes_iv, data):
    aes = AESCBCRBT(_create_base_cipher({"key": aes_key}), aes_iv)
    blocks = int(len(data) / 16)
    dec = aes.decrypt((data[:16*blocks]))
    xor_key = aes.encrypt(b"\x00" * 16)
    for j, i in enumerate(data[16 * blocks:]):
        dec += (i ^ xor_key[j % 16]).to_bytes(1, "little")
    return dec


def print_usage():
    header = "Author: Zscaler ThreatLabz (@threatlabz)\r\nDescription: Trigona ransomware configuration extraction " \
             "tool\r\n"
    print(f"{header}\r\nUsage: python3 {sys.argv[0]} [trigona.exe]")


def main():

    if len(sys.argv) != 2:
        print_usage()
        sys.exit(1)

    try:
        pe = pefile.PE(sys.argv[1])
    except:
        print("[ERROR] Invalid PE file")
        sys.exit(1)
    cfg = get_config_resource(pe)
    if cfg is None:
        print("[ERROR] Could not find Trigona ransomware config")
        sys.exit(1)
    data = cfg['data']
    layer1 = aes_decrypt(data[:32], data[32:48], data[48:])
    dec_data = aes_decrypt(layer1[16:48], layer1[:16], layer1[48:])
    cfg = parse_sections(dec_data)
    if cfg is None:
        print("[ERROR] Could not extract config")
    else:
        cfg.print_config()


if __name__ == "__main__":
    main()
Read the code

MIT · Source & license noticePinned public source ↗
MIT License

Copyright (c) 2022 Zscaler ThreatLabz

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Analysis / 06

Analysis resistance and persistence

The cryptographic layering protects configuration and file keys but is also structured. MD5, section lengths and footer fields create testable relationships. A magic or extension value alone remains version-dependent and can collide with other software.

Analysis / 07

Capabilities, objective and impact

The documented encryption path produces files ending in `_locked`; a separate wiper path uses `_erased`. Ransom note, encryption and deletion are therefore distinct effects. Knowing the format does not imply general recoverability without the private RSA key.

Analysis / 08

Telemetry plan and evidence chain

Detection should connect the CFGS resource, consistent section structure, unusual file renaming, an HTA ransom note and high-volume write activity. Extensions or hashes alone are weak and cannot survive variant changes. A defensible investigation preserves process GUID and full ancestry, user and session, command line, signer and hash state, file and registry changes, DNS/connection destinations and follow-on access to sensitive data in one timeline. Temporal proximity is an evidence parameter, not mere visualization. Missing sensor coverage is marked per stage so that an unseen event is not falsely treated as an event that did not occur.

Analysis / 09

Detection engineering and countertesting

Detection should connect the CFGS resource, consistent section structure, unusual file renaming, an HTA ransom note and high-volume write activity. Extensions or hashes alone are weak and cannot survive variant changes. The following model is deliberately narrow, not engine-validated and must be tested against legitimate administration and software paths.

yamlDefensive model, not engine-validatedDefensive model
title: Trigona encryption-impact candidate
status: experimental
logsource:
  product: windows
  category: file_event
detection:
  selection:
    TargetFilename|endswith:
      - '_locked'
      - '_erased'
  filter_legitimate:
    Image|endswith: '\\backup-agent.exe'
  condition: selection and not filter_legitimate
falsepositives:
  - Legitimate administrative or software activity with the same isolated pattern
level: medium
Read the code

Analysis / 10

Alternative hypotheses and negative tests

Before assigning the family, each signal used by the model is tested independently against software deployment, administration tools, installers, browser or backup software and known internal scripts. At least one structural anchor and one temporally consistent behaviour chain must align. This is a historical, source-bound architecture review. The extractor does not establish support for every variant; extortion or exfiltration claims are not adopted as independently confirmed. A negative countercheck rejects only the tested hypothesis; it is not a general all-clear.

Analysis / 11

Attribution and variant risk

This is a historical, source-bound architecture review. The extractor does not establish support for every variant; extortion or exfiltration claims are not adopted as independently confirmed.

Analysis / 12

Final assessment

The review provides a defensible architecture and detection baseline for the named snapshot. It is not proof of current activity, complete variant coverage or a specific operator.

Review limits

  • No independent sample, runtime, C2 or campaign verification.
  • This is a historical, source-bound architecture review. The extractor does not establish support for every variant; extortion or exfiltration claims are not adopted as independently confirmed.
  • Defensive models were not validated with a target engine.

Sources & context

These sources provide evidence and further context. Our observations, reconstructions and other authors’ results are distinguished in the relevant analysis section.

ThreatLabz — Technical Analysis of Trigona Ransomware ↗ThreatLabz — Trigona config extractor ↗
Final assessment

Conclusion

Conclusion: structure before signature

The greatest defensive value comes from connecting entry, internal architecture, persistence, impact and telemetry. Individual names, hashes or IOCs remain supporting evidence, not the conclusion.

Next steps

  • Test models against synthetic positives and legitimate negatives.
  • Rebind version and evidence snapshot with every update.
  • Extend runtime claims only after first-party, lawfully available telemetry.
Basis of this judgmentHigh for directly inspectable structure; limited for runtime and campaign claims not independently reproduced.
ThreatLabz analysis of Trigona plus the official configuration extractor; no claim about activity in 2026.
← All research audits

Start a conversation

Discuss your project.

Start a conversation