Skip to content

security: obfuscated malicious code found in playwright.config.js #75

Closed

Description

@kwoktung

Summary

Obfuscated malicious code was found appended to playwright.config.js. The code executes automatically whenever Playwright loads the config — including during pnpm test:smoke runs and in the smoke.yml CI workflow.

Location

  • File: playwright.config.js, line 48
  • Introduced in: commit f259734 (PR docs(repo): forbid local main merges #46, merged 2026-04-09)
  • Method: appended inline after the closing });, hidden behind ~700 spaces of whitespace — invisible without horizontal scrolling or file size inspection

The file size is 8430 bytes; the legitimate config is ~1400 bytes. The difference is the injected payload.

What the code does

The payload runs in four stages:

Stage 1 — Setup
Saves require and module into global scope so later stages can call Node.js APIs from inside new Function() sandboxes where those are not normally available.

Stage 2 — Blockchain C2 fetch
Makes outbound HTTPS requests to public blockchain APIs to retrieve encrypted payload data:

  • api.trongrid.io — fetches the latest transaction from TRON wallet TMfKQEd7TJJa5xNZJZ2Lep838vrzrs7mAP
  • bsc-dataseed.binance.org — fetches BSC transaction 0xbe037400670fbf1c32364f762975908dc43eeb38759263e7dfcdabc76380811e
  • Fallback: bsc-rpc.publicnode.com

The transaction input calldata is used as an XOR key to decrypt the Stage-2 payload. Because the payload lives on an immutable blockchain, it cannot be taken down.

Stage 3 — eval()
The decrypted code (7147 bytes, confirmed live) is passed to eval(). It contains a further obfuscation layer and collects runtime context (__dirname, __filename, environment).

Stage 4 — Persistent background process
Spawns a detached node process with stdio: ignore:

node -e "global['_V']='C5-022626'; <full payload>"  { detached: true, stdio: 'ignore' }

This process survives after Playwright exits and re-runs the full chain independently.

A rate-limit guard (global._p_t timestamp) prevents re-execution within 30 seconds on the same process, but the detached process resets this.

Indicators of Compromise

Type Value
Version marker global["!"] = "5-022626"
TRON wallet TMfKQEd7TJJa5xNZJZ2Lep838vrzrs7mAP
BSC tx (primary) 0xbe037400670fbf1c32364f762975908dc43eeb38759263e7dfcdabc76380811e
BSC tx (secondary) 0x3f0e5781d0855fb460661ac63257376db1941b2bb522499e4757ecb3ebd5dce3
C2 hosts api.trongrid.io, bsc-dataseed.binance.org, bsc-rpc.publicnode.com
Persistence global global["_V"] = "C5-022626"

Recommended actions

  • Remove the injected code from playwright.config.js (everything after }); on line 48)
  • Rotate any secrets that were present in environments where pnpm test:smoke ran — particularly CLOUDFLARE_API_TOKEN and any GitHub Actions secrets
  • Audit other config files for similar injections: grep -r 'global\[.\!.\]' . --include="*.js"
  • Review the origin of PR docs(repo): forbid local main merges #46 and the commit that introduced playwright.config.js (converted from playwright.config.ts)
  • Check for running background node processes on any machines where smoke tests were executed

Verification

To confirm the injection locally:

wc -c playwright.config.js         # should be ~1400 bytes, currently 8430
awk 'NR==48{print length($0)}' playwright.config.js  # line 48 is abnormally long

Activity

  1. xrdavies commented on Jun 7, 2026

    @xrdavies
    Member

    thx,fixed

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions