AETERNAE AI RESEARCH LLC INDEPENDENT RESEARCH
ÆAETERNAERESEARCH
Sign inRequest access
← Malware catalog

Attributed metadata history

REPORTPUBLIC METADATA

Malware and cryptography 47 - encrypt/decrypt payload via Trivium. Simple C example

﷽ Introduction to Malware Binary Triage (IMBT) Course Looking to level up your skills? Get 10% off using coupon code: MWNEWS10 for any flavor. Enroll Now and Save 10%: Coupon Code MWNEWS10 Note: Affiliate link – your enrollment helps support this platform at no extra cost to you. Hello, cybersecurity enthusiasts and white hackers! In part 46, I used a small neural model to distinguish reduced-round Speck outputs. In this post I return to payload encryption/decryption research and implement Trivium, a synchronous stream cipher, in C. The payload is the usual x64 Meow-meow! MessageBox shellcode. Trivium Trivium is a lightweight synchronous stream cipher designed by Christophe De Cannière and Bart Preneel. Trivium keeps a 288-bit state split across three shift registers of 93, 84 and 111 bits. Its key and initialization vector are each 80 bits. Initialization clocks the state 1152 times before the cipher produces keystream. The original Trivium specification describes the state update and the eSTREAM byte ordering used here. For each output bit, the cipher reads taps from the three registers, XORs them to produce one keystream bit, then updates one bit in each register. The state update uses XOR and AND operations. In the C implementation, state[0] corresponds to the first indexed state bit used by the equations. The bytes of the key and IV are loaded in reverse order to match the eSTREAM test-vector convention. A stream cipher combines each plaintext byte with a keystream byte using XOR: [C_i = P_i \oplus Z_i,] where \(P_i\) is a plaintext byte, \(Z_i\) is the corresponding keystream byte and \(C_i\) is the ciphertext byte. Decryption applies the same operation again: [P_i = C_i \oplus Z_i.] Trivium processes any byte length directly, so this example needs no block padding or unpadding. The same key and IV must generate the same keystream for encryption and decryption. practical example First, trivium_clock() calculates the output bit and the three feedback bits. The following taps use zero-based C indexes for the specification’s state bits \(s_{66}, s_{93}, s_{162}, s_{177}, s_{243}, s_{288}\): uint8_t t1 = state[65] ^ state[92]; uint8_t t2 = state[161] ^ state[176]; uint8_t t3 = state[242] ^ state[287]; uint8_t output = t1 ^ t2 ^ t3; t1 ^= (state[90] & state[91]) ^ state[170]; t2 ^= (state[174] & state[175]) ^ state[263]; t3 ^= (state[285] & state[286]) ^ state[68]; The feedback values shift into positions 0, 93 and 177, the first position of each register. The loops shift the remaining bits toward the end of each register. trivium_crypt() initializes the state from the key and IV, clocks it for 4 × 288 = 1152 rounds without using those bits, then collects eight output bits for each byte and XORs them with the input. A fresh state is initialized each time the function is called. The same routine therefore encrypts and decrypts the data. Before using the payload, check_test_vector() checks the first 16 keystream bytes against eSTREAM Set 1, vector 0. The test uses key 80000000000000000000 and an all-zero IV. The expected bytes are 38eb86ff730d7a9caf8df13a4420540d. The Linux program (hack.c) encrypts the complete payload, prints every ciphertext byte in hexadecimal, then decrypts it and compares all bytes with the original. It does not execute the Windows payload, just checking corectness: /* * hack.c - Trivium payload encryption and decryption * author: @cocomelonc */ #include <stdint.h> #include <stdio.h> #include <string.h> #define STATE_BITS 288 #define KEY_BYTES 10 #define IV_BYTES 10 static const uint8_t payload = “\xfc\x48\x81\xe4\xf0\xff\xff\xff\xe8\xd0\x00\x00\x00\x41” “\x51\x41\x50\x52\x51\x56\x48\x31\xd2\x65\x48\x8b\x52\x60” “\x3e\x48\x8b\x52\x18\x3e\x48\x8b\x52\x20\x3e\x48\x8b\x72” “\x50\x3e\x48\x0f\xb7\x4a\x4a\x4d\x31\xc9\x48\x31\xc0\xac” “\x3c\x61\x7c\x02\x2c\x20\x41\xc1\xc9\x0d\x41\x01\xc1\xe2” “\xed\x52\x41\x51\x3e\x48\x8b\x52\x20\x3e\x8b\x42\x3c\

Reference details

Source category
research-report
First reported
Nov 27, 2026 14:01 UTC
Last reported
Nov 27, 2026 14:01 UTC
Catalog updated
Nov 30, 2026 01:58 UTC
Record ID
7b4a42535312256b51f7732bed3efb1cef518cbc0adec47c1e68c152962a4561

Published indicators

Network indicators are visibly defanged. This page does not make them clickable or send them to another service.

No validated file hashes or network indicators are stored for this record.

Source observations

intelligence_src_f9879f264b7a8ec1d7

Source-provided label
Publisher RSS metadata
Evidence class
mentioned in report
Confidence
Not reported
Observed
Nov 27, 2026 14:01 UTC
Retrieved
Nov 30, 2026 01:58 UTC

This record contains metadata and attribution only. It does not host, download, unpack, render, or execute malware samples.

Feed collection status

Sources represented on this page. Publication and observation dates describe the content; successful batch dates describe local collection. A recent batch does not certify complete coverage or current provider availability.

1 sources: 0 stale, 0 needing attention, 0 paused, 0 unverified.

Review source update dates and status
  • intelligence_src_f9879f264b7a8ec1d7Recent successful batchLast successful batch: Last attempt:

Stale means older than twice the recorded collection interval, with a minimum of one hour; without an interval, the threshold is 24 hours. Cached content remains available while a feed is stale, paused, or unverified.