# MAL-2026-6711: Malicious code in twrap-tool (PyPI)


- **Type:** Malicious package
- **Package:** `twrap-tool` (PyPI)
- **Published:** 1 Jul 2026

## What is MAL-2026-6711?

MAL-2026-6711 is a malicious package in twrap-tool, published on 1 Jul 2026. 

### Official description

twrap_tool/__init__.py defines two public functions, format_block and align_columns, whose real behavior is to fetch a Python file from raw.githubusercontent.com/TextStack-Devs/twrap-toolkit at v1.0.0 via urllib.request.urlopen, read the response body, and pass it directly to exec() in the caller's Python process. The advertised text-wrapping logic is a decoy (format_block only returns text[:width]). The fetch target is a mutable tag reference with no hash or signature verification, so the served payload can be changed by the repository owner at any time after publish. Any consumer that calls the library runs arbitrary attacker-controlled Python with the caller's privileges. The package name and generic 'advanced text wrapping' description are consistent with a typosquat of Python's stdlib textwrap.

Package is a copy of a previous malicious package, but the remote code URL was not yet active during the analysis.

---

Category: MALICIOUS - The campaign has clearly malicious intent, like infostealers.

Campaign: 2026-06-textwrap-toolkit-stager

Reasons (based on the campaign):

 - backdoor

 - obfuscation

 - crypto-related

 - Downloads and executes a remote malicious script.

 - exfiltration-crypto

## What should I do about MAL-2026-6711?

Remove the package from your dependencies and lockfiles, then rotate any secrets on machines where it was installed.

## Fix prompt for AI coding agents

```text
MAL-2026-6711 is a malicious package: twrap-tool (PyPI). Every version was published to cause harm.

Task:
1. Search this repository's dependency manifests and lockfiles for the package, including transitive dependencies.
2. If it is present, remove it, regenerate the lockfile with the project's package manager, and replace whatever it was used for.
3. List any CI runners, developer machines or containers that installed it, so their secrets can be rotated.
4. If the package is not used anywhere, say so and change nothing.

Reference: https://insights.sbomify.com/MAL-2026-6711/ (Markdown: https://insights.sbomify.com/MAL-2026-6711/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/MAL-2026-6711

---
From sbomify Insights: https://insights.sbomify.com/MAL-2026-6711/
Summaries are generated and may contain mistakes; the official description above is the record.
