Malicious PostgreSQL Extensions in the Wild

Cyera uncovers 20 malicious PostgreSQL extensions tied to Tor2Mine, revealing a Windows and Linux cryptomining campaign with undetected Linux samples.

Smiling man with glasses and a beard in front of a colorful mural with pink and blue patterns.
Ariel Szarf
Oct 7, 2026

After our team discovered a way to load malicious extensions in PostgreSQL that enabled remote code execution (RCE), we had to answer the next logical question: Are threat actors already loading malicious extensions into PostgreSQL? And if so, what do these campaigns look like?

So, we went hunting. What came back surprised us: a cross-platform campaign by  a known cryptomining group whose roots go back to 2018. The Linux versions weren’t detected by a single antivirus engine. 

In this blog, we’ll cover how malicious PostgreSQL extensions work, how we found them, and who’s behind the expansive campaign.

Key Findings

  • We discovered 20 malicious extensions: 16 for Windows, 4 for Linux.
  • The campaign infrastructure dates back to 2018.
  • It’s a cross-platform operation: Windows and Linux share three of four C2 domains. 
  • The campaign supports a cryptomining operation.
  • Infrastructure for the campaign (C2 domain d1.pool4883.pw) was still live during our research.

Why Malicious PostgreSQL Extensions Are a Blind Spot

Databases are central points in organizations that often hold huge amounts of sensitive data related to customers, employees, secrets, and more. That's why they’re the crown jewels for threat actors and a critical piece of defense efforts.

PostgreSQL is an especially big target because it's the most popular database in Stack Overflow's Developer Survey, a title it’s held since 2023. All deployments of PostgreSQL have an option to load binary extensions except for Database-as-a-Service (DBaaS). But a 2024 survey found only 41.3% of the PostgreSQL community hosted it as DBaaS.

That means many PostgreSQL instances are exposed to a scenario where a threat actor places a malicious extension and steals their data.

Here is a simple example of a malicious extension:

Seven lines of code, without signing or verification. Once loaded, malicious code runs inside PostgreSQL itself, with no process to catch and no standalone executable to flag.

How We Spotted Problematic Extensions

To answer our questions, we developed a systematic hunting methodology. We separated our methodology into three stages:

  • Use YARA rules to find the needles in a huge haystack.
  • Cluster the different artifacts based on metadata and VirusTotal enrichments.
  • Reverse-engineer the most interesting samples using Ghidra.

We turned to VirusTotal intelligence to gain access to potentially malicious PostgreSQL extensions.

From there, we used a simple YARA rule to pull as many PostgreSQL extensions as possible. It looks for Pg_magic_func:

This rule matches any PE or ELF binary exporting the PostgreSQL magic function.

Our starting point was to search for Pg_magic_func, the macro every PostgreSQL extension must export. After that, we checked all available metadata for each to better understand the file's meaning.

How did we examine the metadata? Imphash (Import Hash) groups binaries by the DLLs and functions they import, so the same Imphash often means the same codebase or builder. PE timestamps showed when the binary was compiled — five samples compiled within five minutes told us they were likely connected. Sandbox reports showed which domains the binary contacted and which files it dropped.

In this phase, our purpose was to try clustering them to hopefully identify and reveal the different groups of Trojans. Who uses them? Cryptominers? APTs? Script kiddies? Professional attack groups?

We reverse-engineered the interesting extensions with Ghidra. For sandboxing and efficiency, we ran Ghidra MCP on EC2 with an SSH tunnel to our laptops, and built a custom skill that handles the full RE workflow automatically.

The Campaign We Found

We found 20 malicious PostgreSQL extensions that all seemed to be part of one campaign.

Platform Samples AV Detection Rate Final Payload Target PG Version
Windows 16 14–43/72 XMRigCC Miner 9.2–16.0
Linux 4 0/65 XMRigCC Miner 14.0–17.0

More interesting than the number of extensions is that Windows and Linux samples share the same C2 domains and the same purpose. One campaign, two platforms.

Timeline

The infrastructure behind this campaign goes back to at least June 2018. The PostgreSQL extensions themselves first appeared in October 2023:

Date Event
2018-06 asq.r77vh0.pw registered (REG.RU Moscow)
2019-10 asq.d6shiiwz.pw registered (REG.RU Moscow)
2021-01 asd.s7610rir.pw registered (REG.RU Moscow)
2023-04 us1.somepools555.pw registered (Namecheap)
2023-10 Gen1 compilation: 5 samples in 5 minutes
2024-07 Gen2 compilation: 5 samples in 12 minutes
2025-07 d1.pool4883.pw registered (REG.RU Moscow)
2025-07 Gen3 compilation: 6 samples in 17 minutes (14 days after domain registration)
2026-03 First Linux samples appear

During our research, we found that the domain d1.pool4883.pw was still alive and the resolved IP was 209.99.186.219.

So, how does the malware work?

Windows: Three-Stage Chain

Stage 1: The PostgreSQL Extension — gc_manager.dll

A legitimate-looking extension exporting a valid Pg_magic_func. But inside is an XOR-encrypted payload. On load, it decrypts the payload and uses process hollowing: it finds the host executable path, launches it suspended, and replaces its memory with Stage 2.

Stage 2: The Downloader

WinHTTP-based C2 communication with four backup .pw domains. Downloads from https://<domain>/win/min/c64.exe.

This architecture lets the attacker choose any payload. Stage 2 downloads whatever the C2 serves: a credential stealer, ransomware, a crypto miner, or anything else.

During our research, we checked what they're currently serving and downloaded this binary from the one live domain.

Stage 3: The Miner — c64.exe

5.1 MB, compiled December 2025.

The final payload is XMRigCC, a fork of XMRig with remote command and control capabilities. Eight hardcoded mining pools with the same worker ID across all of them.

The miner uses defense evasion techniques to avoid detection and reduce its impact on users. It monitors running processes and pauses when it detects Task Manager, Process Explorer, or Process Hacker to stay invisible. It also pauses when it detects games like Dota 2, CS:GO (Counter-Strike), GTA V, Overwatch, and more to avoid degrading performance and alerting the user.

Each Windows sample was flagged by some AV engines. But flagging a file as suspicious isn't the same as identifying a campaign. They all share the same builder and C2 domains, so the pieces were there, but no one had connected them yet.

Linux: Similar Chain, Zero Detection

Four samples, all named gcmanager-1.so, targeting PostgreSQL 14.0-17.0. Detection rate: 0/65 in VirusTotal.

Stage 1: The PostgreSQL Extension — gcmanager-1.so

The trick is that most malware runs on load; this one runs on unload.

When the extension is unloaded, a destructor runs that:

  • Extracts a zlib-compressed payload embedded in the .so file, writes it to disk, and executes it as a background daemon.
  • Finds postgresql.conf and copies itself (the .so file) into the same directory.
  • Parses shared_preload_libraries and session_preload_libraries from the configuration, then adds itself if missing.
  • Writes the modified config back and signals PostgreSQL to reload it.

Stage 2: The Downloader

A zlib-compressed ELF extracted from the extension at runtime. On its own, 4/66 engines flag it. The extension that carries it, however, doesn’t raise a single flag.

It contains four hardcoded C2 domains and downloads the final payload from https://{domain}/lin/64/xmrig.

Stage 3: XMRigCC Miner

Searching VirusTotal for files contacting the same C2, we found related Linux malware whose sandbox execution dropped an XMRigCC miner. 

Three of the four C2 domains overlap with Windows, indicating that both are part of the same campaign.

Next, we followed the infrastructure to see if we could expand our understanding.

Different Campaign, Same Infrastructure

While investigating the C2 domains, we queried VirusTotal for files communicating with the same infrastructure. One domain, asq.d6shiiwz.pw, returned multiple patch.exe samples alongside the PostgreSQL extensions. These aren't part of the gc_manager infection chain; they're probably a parallel campaign by the same actor that uses a different initial access vector but the same C2 infrastructure.

Stage 1: The Defense Evasion Stage

  • Disables Windows Defender real-time monitoring.
  • Adds a registry key to disable AntiSpyware.
  • Stops and disables the Windows Update service.
  • Adds %TEMP%\drivers to Defender exclusions.
  • Downloads a script from a GitHub Gist.
  • Drops the stealer into the excluded %TEMP%\drivers.
  • Self-deletes via ping delay.

Stage 2: AZORult Stealer

An obfuscated AutoIt-compiled payload steals browser credentials, cookies, and crypto wallets. It takes screenshots, collects system information, and exfiltrates to lubrpenal.xyz.

Two campaigns sharing infrastructure: one monetizes compute, the other monetizes credentials.

The next step was following the infrastructure trail to determine who's behind this.

The Attack Group

The actor behind this malware is Tor2Mine, a cryptocurrency mining group.

The infrastructure led us to a known cryptojacking operation. The domains asq.d6shiiwz.pw and asd.s7610rir.pw appear in Sophos Labs' published IOC list for Tor2Mine from 2021. Cisco Talos documented this group in 2020, noting their use of AZORult alongside mining, which is exactly what we found.

This isn't a new threat actor. It's a new attack vector for an established group.

What was already known about Tor2Mine:

  • Active since at least 2018.
  • Deploys AZORult stealer alongside XMRig mining.
  • Russian-registered infrastructure (REG.RU Moscow).

As far as we can tell, this is the first published analysis of Trojanized PostgreSQL extensions as an attack vector in the wild.

Tor2Mine didn't disappear after 2021. They just added a new trick.

What Else Is Running Where Your Data Lives?

This investigation proves that threat actors are abusing PostgreSQL extensions and they have been for at least three years.

It’s important to remember that PostgreSQL is just one database, so this is only part of the picture. Redis has modules. MongoDB has server-side JavaScript. MySQL has user-defined functions (UDFs). Elasticsearch has extensions. Each one loads code into a process that touches your data. We found gc_manager because we looked. What's running inside your database?

Database servers are big targets. Go find what we missed.

Indicators of Compromise (IoC)

You can find the IOCs here.

Last verified: 2026-09-27.

gc_manager Campaign (PostgreSQL Extensions)

C2 Domains

Domain Registrar First Seen Status
asq.d6shiiwz.pw REG.RU (Moscow) 2019-10 Active
asd.s7610rir.pw REG.RU (Moscow) 2021-01 Active
us1.somepools555.pw Namecheap 2023-04 Active
asq.r77vh0.pw REG.RU (Moscow) 2018-06 Inactive
d1.pool4883.pw REG.RU (Moscow) 2025-07 Active

Windows gc_manager.dll (16 Samples)

SHA-256 Hash
0637c029845110b90146a894a860cf26c7bf0b6eaa95f49b4341501f53b35acc
1568c7d6b09687b06393278d2f991a1b1efeef1c2c22b42b149758d04fd99af9
2b3ea1144f566a00251f56f779f64bbc1ae97876809940f49a37535df159295e
3480d4d59f6a5746b8fd952239055931fe03fa7143d3a36ae5c524857ae8d522
41804f1467275f436d3a5303ecb3bea1ef1f8130e54248aa9888ff3f580af2dd
450ad26a041e51950956b109a22990ddc46786de46919ddeb2224f9dbbcfe846
8730dd940ec7242c4f72dcd9698652063c88f8bdc23b88c18e7e41a45f00e439
9a53b5d6fcb8a0ebe6704e9375b100e910cc12e80a8bdebecb6e57f598e5ea8a
c46c1c9dfc3b728fb01dda53721eeab3631fb6b84efeed72d54ec8f3fce937db
e06b7118082d5ff0638c62992a2a372ae81fbfe42bf969a966dd6bcde18ca5a4
e8e1ad75b7d767d71b446670d72e92d44c3a0d95bf1d334fe26941f040140c99
f038250f31c06b84ba2e58561b51f22b5c30482c84077c55880a557a756e4d82
f86cdfebc776c063aa1077b7cc72d10d63f5129b7a88a91b6dec95350c2ade84
01b3b47e5df62cafc91ec32c34777d38fc71929cadfd7ce6fe5c4d38eeba7033
1c49f99450d4f77c98c973cbe16d60cdbd2b87575530d55fd54d06873ce19bb7
bbf1caaa3c5926ea742871b8210204c3913dba89a842fc7f146cb54e3f00ec2f

Linux gcmanager-1.so (4 Samples)

SHA-256 Hash
fb0e952804714034640a45ca09fff87b74b0ec7ae2a11ed8bd5b4096895526f1
715348a40250549100cbbeb2a8d68ffa323e671b55fc46e8df24c7016b11e10a
97109072c04bd4a4806bb7172a2a3128dfe10bf83fccea31217d5a9ad0b1b503
d3f6f1de753bceef33dd4515c50a436b2c5a687cbb795122921fddabcb3391f4

Embedded Payloads

SHA-256 Hash Description
d3bb71a7554dbeeb248d35db4d03514ed84e4023b21ef7e21616cb0c6fb5a053 Windows Stage 2 downloader
52422f2470fcccfbc40e55bb5c273ad3db947e92ec0474f83ddf423a2c50cf5b Linux Stage 2 downloader

Downloaded Miners (XMRigCC)

Platform Filename SHA-256 Hash
Windows c64.exe 47e777c4541044dd439bf065478bfadc5b6d7049f70a3114ca8386acb02d0b6a
Linux xmrig 287bd345c4cd16737ab999d8f9fd08ebb9411d09d06c35aa4869d65db31367e1

Mining Pools

  • eu.minerpool.pw:443
  • rig.zxcvb.pw:443
  • rig.myrms.pw:443
  • rs.fym5gserobhh.pw:443
  • back123.brasilia.me:443
  • 185.10.68.220:443
  • 65.87.7.196:443
  • 2.59.220.122:443

patch.exe Campaign (AZORult Stealer)

C2 Infrastructure

  • lubrpenal.xyz/ynvs2/index.php
  • interstart.xyz/hab3v13/index.php
  • testarea.hostigger.com
  • 195.123.234.33
  • 141.98.117.69

patch.exe (6 Samples)

SHA-256 Hash
02178169ec7cd5abd69d5537614b3c1c9b85bc00902cebd048c2aba8c9d770ea
a22e1bf0009fa6cdbd4fe8dcf974feb583f237b1dfdbdf7b137ac9b0c99488ac
93166bc5f43d374777823bb4eefc72c2b9d960d5f6bf8fd1f76ebe06627f7eed
2984122ebc7466fc38153921570a1bf64439e79a5849003d652c1d2beabd4610
1dfd0162fc8d9b52c8ae9634219b8e59100fafad1c98e64335dcce62c8c254cb
ef299f9f764df01505a86404828e9fa54df31ba1e1cabcd737db6d6ae0b490e5

AZORult Stealer (Dropped Payload)

SHA-256 Hash
2c54175c5b7755e11726fa7bd1b2c9e7f681bded3af3a77c7916bb15acac505a

Note on Unsubmitted Hashes

  • d3bb71a7554dbeeb248d35db4d03514ed84e4023b21ef7e21616cb0c6fb5a053 — the Windows Stage 2 exists only after in-memory decryption, so it is never written to disk.
  • 47e777c4541044dd439bf065478bfadc5b6d7049f70a3114ca8386acb02d0b6a — retrieved directly from the C2 on 2026-07-26.
Share