Blog Application Security
When the Trusted Channel Ships the Malware: Optimizely, PyPI and npm
This week a third-party experimentation script, a Microsoft release path on PyPI and an npm trusted-publishing workflow all delivered attacker code from the legitimate origin. Here is what the three incidents share, what they mean for your controls, and the two patches that also belong in your queue.

Key takeaways
- Optimizely's CDN, the real agent-framework project on PyPI and WPPConnect's own publish pipeline all delivered attacker code from the legitimate origin.
- Origin-based controls such as script host allowlists and provenance attestations did not stop these attacks on their own.
- Report URI found only 24 of the organisations whose CSP it evaluated, 15% by its count, had a policy that blocked the Optimizely payload.
- Publish jobs need a required-reviewer gate and protected release branches, and consumers need exact pins plus a release-age delay.
- Drupal's critical installer flaw and CISA's KEV listing for LiteLLM both need attention in this week's patch queue.
Three separate incidents this week have the same shape. In each one, the malicious code arrived from exactly where the good code normally comes from: Optimizely's own CDN, the real agent-framework project on PyPI, and WPPConnect's own GitHub Actions publish job. Controls that only ask whether something came from the right place did not stop any of them.
Optimizely: the vendor's CDN served the payload #
Optimizely says an unauthorized third party exploited a flaw in the Web Experimentation account signup flow on 16 November, used it to impersonate users on targeted customer accounts, and inserted malicious JavaScript into those customers' projects. The company states that less than 5% of its customers were impacted and that it closed the vulnerability within three hours of detection. Both are vendor claims.
Report URI, which found and documented the campaign, says the code sat in the customer-editable Project JavaScript field and was still served from cdn.optimizely.com. In its own crawl of 1,611 snippets it found 188 infected, belonging to 178 organisations, and it says the real number is likely higher. Its analysis describes a payload that swapped cryptocurrency addresses, skimmed card details from the site's own forms, and stole cookies and screenshots. Hosted payment iframes were out of reach.
The control lesson is in one Report URI finding: it crawled 256 hosts belonging to affected organisations, and only 24 organisations, 15% by its count, had a Content Security Policy that blocked the payload. Allowlisting the script host is not enough when the host itself is delivering the attack.
agent-framework: the real PyPI project shipped a stealer #
Two malicious releases of Microsoft's agent-framework package were published to PyPI this week and removed within about an hour. GitHub advisory GHSA-764m-3ppc-5m73 lists both as malware with no patched version.
Both carried a credential stealer launched from a .pth file, which runs at every Python interpreter start whether or not the package is imported. Per the advisory and Wiz, it went after secret-like environment variables, credential files, Azure managed-identity tokens and Azure DevOps pipeline tokens, and the second release added GitHub Actions OIDC tokens.
How the attacker got publish access is not confirmed. Wiz says the attacker appears to have compromised a client certificate and private key for Microsoft ESRP, and that how those credentials were obtained is not yet known. The advisory says the activity has not been attributed to a known campaign. Its guidance is direct: treat the environment as exposed and rotate the credentials reachable from it.
WPPConnect: provenance without review #
Malicious releases of two WPPConnect npm packages, @wppconnect-team/wppconnect and @wppconnect/server, were published this week through the project's own GitHub Actions workflows. This account rests on write-ups from StepSecurity and SafeDep plus the project's issue threads.
StepSecurity says unsigned commits were pushed directly to the default branches with no pull request, and that the library's publish workflow had no environment key, so no reviewer approval was required. Both releases were published by a GitHub trusted-publisher identity, and the library release carries an SLSA provenance attestation. StepSecurity says it has not established how access was obtained.
The payload collected environment variables, config files such as .env, and WhatsApp session tokens, and uploaded them through the Telegram Bot API. It ran on import or server start, not in an install script, so StepSecurity notes that disabling install scripts does not stop it. A project member has said the malicious releases are deprecated, and the issues remained open pending confirmation of containment. Recommended remediation is to pin the last clean releases named in the write-ups, rotate every secret the process could read, and unlink and re-pair WhatsApp sessions.
Provenance proves where a package was built. It does not prove anyone reviewed the commit.
Also in the patch queue #
Drupal. SA-CORE-2026-017 fixes CVE-2026-132165, a critical core flaw in which an attacker can, under specific conditions, use the installer to attempt to reinstall a site. No authentication is required and Drupal records that a proof of concept exists, but it also rates the attack as complex and limited to uncommon configurations. The advisory does not report exploitation. End-of-life branches get no fix.
LiteLLM. CISA added CVE-2026-40217 in BerriAI LiteLLM to its Known Exploited Vulnerabilities catalog on 18 November, alongside flaws in Apache Axis, Vanderbilt REDCap and Synology DiskStation Manager. The federal due date is 21 November for those three and 2 December for LiteLLM. The vendor advisory describes a sandbox escape in the custom-code guardrail test endpoint that allows arbitrary code execution in the proxy process, and says reaching the endpoint requires a proxy-admin credential in default configurations. CISA gives no detail on who is exploiting it. The vendor workaround, if you cannot upgrade to a fixed release right away, is to block POST /guardrails/test_custom_code at your reverse proxy or API gateway. An LLM gateway holds provider API keys for every model behind it, so treat this one as a credential exposure risk.
What to change #
- Third-party scripts: deploy a strict CSP with a tight connect-src, audit which tags can modify your pages, and keep payment fields in hosted iframes.
- Dependencies: pin exact versions with a lockfile, and add a release-age delay so a release that is pulled within the hour never reaches your build.
- Publish pipelines: put a required-reviewer environment on publish jobs and protect release branches. A trusted-publisher identity should not be reachable by a single direct push.
- CI secrets: assume any build environment that installed a malicious release is exposed, and scope tokens so that assumption is cheap to act on.
Sources
- Optimizely Service Status - Web Experimentation Security Incident, Optimizely
- World's Largest Brands Infected With Malware Via Optimizely, Report URI
- Malicious code in agent-framework (PyPI) · GHSA-764m-3ppc-5m73 · GitHub Advisory Database · GitHub, GitHub Advisory Database
- Microsoft agent-framework Compromised: Credential Stealer Targets Azure and CI Pipelines | Wiz Blog, Wiz
- WPPConnect Compromised: Malicious Releases Steal Secrets and WhatsApp Sessions Through the Project's Own Pipeline - StepSecurity, StepSecurity
- Malicious wppconnect Release Steals Secrets and WhatsApp Sessions, SafeDep
- Security: npm release @wppconnect-team/wppconnect 2.4.1 (still latest) uploads secrets to a Telegram bot · Issue #2968, GitHub (wppconnect-team)
- Security: npm releases @wppconnect/server 2.10.82 and @wppconnect-team/wppconnect 2.4.1 upload secrets to a Telegram bot · Issue #2734, GitHub (wppconnect-team)
- Drupal core - Critical - Remote code execution - SA-CORE-2026-017 | Drupal.org, Drupal Security Team
- CISA Adds Four Known Exploited Vulnerabilities to Catalog | CISA, CISA
- Known Exploited Vulnerabilities Catalog | CISA, CISA
- Sandbox escape in custom-code guardrail · Advisory · BerriAI/litellm · GitHub, BerriAI (LiteLLM)
Questions this raises
- What do the Optimizely, agent-framework and WPPConnect incidents have in common?
- In each case the malicious code was delivered from the legitimate source: Optimizely's CDN, the real agent-framework project on PyPI, and WPPConnect's own GitHub Actions publish workflow using a trusted-publisher identity. Downstream users had no origin signal that anything was wrong.
- Does npm provenance or trusted publishing prevent this kind of attack?
- Not by itself. StepSecurity says the WPPConnect releases were published by a GitHub trusted-publisher identity and the library release has an SLSA provenance attestation, because the real pipeline built commits that were pushed directly to the default branch. Provenance shows where a package was built, not that the change was reviewed.
- Would a Content Security Policy have stopped the Optimizely payload?
- A strict one could. Report URI crawled 256 hosts of affected organisations and says 24 organisations, 15% by its count, had a CSP that blocked the payload. Its guidance is to deploy CSP with a restricted connect-src.
- What should LiteLLM operators do about CVE-2026-40217?
- Confirm you are on a fixed release per the vendor advisory. If you cannot upgrade immediately, the vendor workaround is to block POST /guardrails/test_custom_code at your reverse proxy or API gateway. CISA has confirmed exploitation but has not published details of the activity.