# Apifox Desktop Client Supply Chain Attack via Compromised Official CDN Script (apifox.it.com C2)

> A supply chain attack targeting the Apifox desktop client was discovered where a front-end JavaScript file hosted on Apifox's official CDN was injected with heavily obfuscated malicious code. The malicious script steals SSH keys, Git credentials, shell histories, Kubernetes configs, npm tokens, and Apifox authentication tokens, then establishes RSA-encrypted C2 communication via apifox.it.com to retrieve and execute arbitrary remote code. The attack affected all desktop users running versions below 2.8.19 between March 4-22, 2026.

- **Author:** Threadlinqs Team
- **Published:** 2026-03-29T12:00:00Z
- **Last updated:** 2026-03-29T12:00:00Z
- **Canonical:** https://intel.threadlinqs.com/threat/TL-2026-0295
- **Card image:** https://intel.threadlinqs.com/og/threat/threat-intel-apifox-supply-chain-attack-tl-2026-0295.webp?v=3a2a7563 (Threadlinqs threat intel: Apifox CDN Poisoning Steals Dev Secrets: Detection & IOCs (TL-2026-0295) — Critical severity, 22 IOCs, 9 detection rules.)
- **ID:** TL-2026-0295
- **Severity:** CRITICAL (CVSS 9.1)
- **Category:** SUPPLY_CHAIN
- **Status:** PATCHED
- **Detections:** 9 (1 shown free below) · **IOCs:** 22 (3 shown free below)

## Description

A sophisticated supply chain attack compromised the Apifox desktop client by injecting malicious JavaScript into a legitimate analytics tracking script hosted on Apifox's official CDN. The poisoned file, apifox-app-event-tracking.min.js, grew from approximately 34KB to 77KB with the addition of roughly 42KB of heavily obfuscated malicious code.

The attack operates in multiple stages. Stage 1 (Loader): The injected code appended to the legitimate CDN script detects the Electron desktop environment by attempting to import Node.js modules (crypto, os) unavailable in browsers. Once confirmed, it beacons to the C2 domain apifox.it.com, sending machine fingerprinting data via custom HTTP headers (af_uuid, af_os, af_user, af_name, af_apifox_user, af_apifox_name). The af_uuid is a SHA-256 hash of concatenated MAC address, CPU model, hostname, user home directory, and OS platform, cached in localStorage as _rl_mc. The C2 responds with a 344-byte RSA-encrypted payload that, when decrypted with the embedded RSA-2048 private key (OAEP padding, SHA-256), returns a dynamically-generated Stage 2 URL with a randomized 8-character hex filename.

Stage 2 (Information Harvesting): Delivered as plaintext Node.js scripts, Stage 2 payloads systematically harvest sensitive files. Version 1 (collectPreInformations) recursively reads ~/.ssh/ (private keys, authorized_keys, config), ~/.git-credentials, shell histories (.zsh_history, .bash_history), and executes process listing commands (ps aux on Linux/macOS, tasklist on Windows). Version 2 (collectAddInformations) expands scope to include Kubernetes configs (~/.kube/*), npm registry tokens (~/.npmrc), Subversion credentials (~/.subversion/*), shell environment variables, and performs directory tree traversal up to 2 levels deep. On Windows, it additionally scans D:/, E:/, F:/ drives.

All harvested data is compressed via Gzip, encrypted with AES-256-GCM using a key derived from scryptSync with passphrase 'apifox' and salt 'foxapi' (32-byte key), then Base64-encoded in the format IV[12] + AuthTag[16] + CipherText before being POSTed to /event/0/log (v1) or /event/2/log (v2) endpoints.

The C2 infrastructure used the domain apifox.it.com, registered through a .it.com commercial subdomain service (non-ICANN) to appear as an official Apifox property. The domain resolved to Cloudflare IPs (104.21.2.104, 172.67.129.21) and was active for 18 days (March 4-22, 2026). The backend infrastructure ran Nginx 1.28.2 with an Express (Node.js) application, implementing one-time-use Stage 2 URLs that permanently 404 after delivery, fully open CORS, and no-cache response headers.

The obfuscation employed 7 layers: (1) String array rotation via _0x10e4() with 300+ encoded strings, (2) Base64 + RC4 double-decryption, (3) Proxy function wrappers, (4) Hexadecimal arithmetic expressions masking constants, (5) Control flow flattening, (6) Dead code injection, (7) Anti-debugging via toString regex and infinite recursion loops. Notably, while the entrance code was heavily obfuscated, Stage 2 payloads contained Chinese-language development comments explaining encryption parameters, suggesting separate authorship or overconfidence in the RSA encryption protecting the delivery channel.

The malicious code includes a persistence mechanism using randomized setTimeout intervals between 30 minutes and 3 hours, with a finally block ensuring scheduleNext() executes even after network failures or eval errors, maintaining continuous C2 polling.

Apifox confirmed the compromise on March 25, 2026 and released version 2.8.19 which moved tracking scripts from CDN retrieval to bundled package resources. Only the public SaaS desktop client was affected; web and self-hosted versions were not impacted.

## MITRE ATT&CK

- T1195 Supply Chain Compromise
- T1059 Command and Scripting Interpreter
- T1027 Obfuscated Files or Information
- T1140 Deobfuscate/Decode Files or Information
- T1036 Masquerading
- T1552 Unsecured Credentials
- T1539 Steal Web Session Cookie
- T1082 System Information Discovery
- T1057 Process Discovery
- T1083 File and Directory Discovery
- T1005 Data from Local System
- T1119 Automated Collection
- T1560 Archive Collected Data
- T1071 Application Layer Protocol
- T1573 Encrypted Channel
- T1132 Data Encoding
- T1041 Exfiltration Over C2 Channel

## Free detection (Splunk SPL, Microsoft KQL, Sigma)

**Apifox Supply Chain — Encrypted Data Exfiltration via C2 POST Endpoints** (`TL-2026-0295-SPL-003`)

Detects HTTP POST requests to the Apifox supply chain exfiltration endpoints (/event/0/log and /event/2/log) carrying AES-256-GCM encrypted, Gzip-compressed, Base64-encoded stolen credential data. Also detects anomalous large POST payloads from Electron/desktop application processes to unknown external endpoints, characteristic of the bulk data exfiltration pattern used by Stage 2 payloads.

- **Languages:** Splunk SPL, Microsoft KQL, Sigma
- **ATT&CK:** T1041, T1071.001, T1573.001, T1132.001, T1560.001
- **Data sources:** proxy, web_traffic, network_connection, firewall
- **Severity:** critical
- **Confidence:** high

### Splunk SPL

```spl
index=proxy OR index=web sourcetype="stream:http" OR sourcetype="bluecoat:proxysg:access:syslog" OR sourcetype="pan:traffic"
(cs_method="POST")
(
  (cs_uri_path="/event/0/log" OR cs_uri_path="/event/2/log")
  OR (cs_host="apifox.it.com" cs_method="POST")
  OR (cs_host="cdn.openroute.dev" cs_method="POST")
)
| eval payload_size_kb=round(bytes_out/1024, 2)
| eval is_exfil_endpoint=if(match(cs_uri_path, "/event/[0-2]/log"), 1, 0)
| eval is_c2_post=if(match(cs_host, "apifox\.it\.com|cdn\.openroute\.dev") AND cs_method="POST", 1, 0)
| stats count sum(bytes_out) as total_bytes_out values(cs_uri_path) as exfil_paths values(cs_host) as destinations earliest(_time) as first_exfil latest(_time) as last_exfil by src_ip
| eval total_kb=round(total_bytes_out/1024, 2)
| where count > 0
| table first_exfil last_exfil src_ip destinations exfil_paths total_kb count
```

### Microsoft KQL

```kql
let exfil_paths = dynamic(["/event/0/log", "/event/2/log"]);
let c2_domains = dynamic(["apifox.it.com", "cdn.openroute.dev"]);
union DeviceNetworkEvents, CommonSecurityLog
| where TimeGenerated > ago(24h)
| where 
    (RequestMethod == "POST" and RequestURL has_any (exfil_paths))
    or (RequestMethod == "POST" and DestinationHostName has_any (c2_domains))
    or (RemoteUrl has_any (exfil_paths))
    or (RemoteUrl has_any (c2_domains) and InitiatingProcessFileName in~ ("electron.exe", "Apifox.exe", "node.exe"))
| extend PayloadSizeKB = SentBytes / 1024.0
| summarize ExfilCount = count(), TotalSentKB = sum(PayloadSizeKB), Endpoints = make_set(coalesce(RemoteUrl, RequestURL), 20), FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated) by DeviceName, coalesce(InitiatingProcessFileName, SourceIP)
| project FirstSeen, LastSeen, DeviceName, ExfilCount, TotalSentKB, Endpoints
```

### Sigma

```yaml
title: Apifox Supply Chain — Encrypted POST Exfiltration to C2 Endpoints
id: 9c5d3e6f-a7b8-4c0d-1e2f-3a4b5c6d7e8f
status: experimental
description: Detects HTTP POST requests to Apifox supply chain exfiltration endpoints /event/0/log and /event/2/log which receive AES-256-GCM encrypted stolen credentials and system data
references:
    - https://slowmist.medium.com/security-alert-supply-chain-attack-on-apifox-desktop-client-via-compromised-official-cdn-script-bc3870992564
    - https://intel.threadlinqs.com/threats/TL-2026-0295
author: Threadlinqs Team
date: 2026-03-29
tags:
    - attack.exfiltration
    - attack.t1041
    - attack.command_and_control
    - attack.t1071.001
    - attack.t1573.001
    - attack.t1132.001
logsource:
    category: proxy
detection:
    selection_exfil_path:
        c-uri|contains:
            - '/event/0/log'
            - '/event/2/log'
    selection_method:
        cs-method: 'POST'
    selection_c2_domain:
        r-dns|endswith:
            - 'apifox.it.com'
            - 'cdn.openroute.dev'
    condition: (selection_exfil_path and selection_method) or (selection_c2_domain and selection_method)
falsepositives:
    - Legitimate analytics or telemetry services using similar /event/ URL patterns (verify destination domain)
level: critical
```

**Known false positives:**

- Legitimate analytics platforms using /event/ URL path patterns (verify destination domain is not apifox.it.com)
- Internal telemetry services posting event data to /event/ endpoints on trusted infrastructure

**Tuning notes:** Correlate with DNS resolution for apifox.it.com to confirm C2 context. Add payload size threshold (e.g., >10KB POST body) for generic /event/ path matching. Exclude known legitimate analytics domains. Monitor for new exfiltration path patterns as threat actor evolves infrastructure.

### 8 more detection rules (Splunk SPL, Microsoft KQL, Sigma), unlock with TL Creds

- Apifox Supply Chain — Electron Process Network Connection to Supply Chain C2 Infrastructure (locked: unlock with TL Creds)
- Apifox Supply Chain — Process Enumeration Spawned by Electron Desktop Application (locked: unlock with TL Creds)
- Apifox Supply Chain — Anomalous Large Outbound POST from Electron Application (locked: unlock with TL Creds)
- Apifox Supply Chain — DNS Resolution of C2 Lookalike Domains (locked: unlock with TL Creds)
- Apifox Supply Chain — Electron Application Recursive Home Directory Traversal (locked: unlock with TL Creds)
- Apifox Supply Chain — Compromised CDN Script Load with Abnormal File Size (locked: unlock with TL Creds)
- Apifox Supply Chain — C2 Beacon to Lookalike Domain via Electron Process (locked: unlock with TL Creds)
- Apifox Supply Chain — Credential File Harvesting by Electron Desktop Application (locked: unlock with TL Creds)

Sign up free to unlock the detection rules: https://threadlinqs.com/?modal=signup

## Sample indicators (3 of 22)

Defanged, TLP:CLEAR.

- IP address: `104.21.2[.]104`
- Domain: `apifox[.]it[.]com`
- File hash: `91d48ee33a92acef02d8c8153d1de7e7fe8ffa0f3b6e5cebfcb80b3eeebc94f1`

Full set of 22 indicators unlocks with TL Creds: https://threadlinqs.com/tl-creds

## Sources

- [SlowMist Security Alert: Supply Chain Attack on Apifox Desktop Client via Compromised Official CDN Script](https://slowmist.medium.com/security-alert-supply-chain-attack-on-apifox-desktop-client-via-compromised-official-cdn-script-bc3870992564)
- [Wiz Cloud Threats - Apifox Supply Chain Attack Incident](https://threats.wiz.io/all-incidents/apifox-supply-chain-attack)
- [Crypto Tools Under Attack as Apifox Breach Exposes Sensitive Data](https://www.cryptotimes.io/2026/03/26/crypto-tools-under-attack-as-apifox-breach-exposes-sensitive-data/)
- [SlowMist Twitter Alert on Apifox Supply Chain Attack](https://x.com/SlowMist_Team/status/2037024243112702075)
- [Apifox CDN Supply Chain Poisoning Detailed Technical Analysis (leavesongs)](https://www.leavesongs.com/PENETRATION/apifox-supply-chain-attack-analysis.html)
- [Apifox Supply Chain Attack Analysis (rce.moe)](https://rce.moe/2026/03/25/apifox-supply-chain-attack-analysis/)
- [Apifox Incident Response Tool (GitHub)](https://github.com/myxiaoao/apifox-incident-fix)
- [PANews: SlowMist Reports Apifox Supply Chain Attack](https://www.panewslab.com/en/articles/019d288b-beb0-7139-a173-d17b332e892d)
- [Wayback Machine Archive of Poisoned Script](https://web.archive.org/web/20260305160602/https://cdn.apifox.com/www/assets/js/user-tracking.min.js)
- [Phemex News: Apifox Client Supply Chain Attack Exposes Users to Risks](https://phemex.com/news/article/apifox-desktop-client-hit-by-supply-chain-attack-users-at-risk-69126)

## Full data

The other 8 detection rules (Splunk SPL / Microsoft KQL / Sigma) unlock with TL Creds; a free account includes daily creds: https://threadlinqs.com/?modal=signup
Indicator values unlock with TL Creds, at a lower price on Red and Purple; AI agents can query rules and IOCs through the Threadlinqs MCP server (Purple and Gold in full, 2 calls a day on a free account): https://intel.threadlinqs.com/mcp

Canonical: https://intel.threadlinqs.com/threat/TL-2026-0295
