codyhara のここでしか言えない話(3/24 - 3/29)


ひとこと

データベース部門を担当している同僚が、AWS Certified Security - Specialty を取得していた。 つい先日 AWS Certified Solutions Architect - Professional を取ったばかりで、しかも自分の専門スコープ外であるにもかかわらず、わずか数ヶ月での取得だ。 理由はまだ聞けていないが、AI による技術進化が加速する中でセキュリティの重要性を感じたのかもしれない。 私も「今年中に取れればいい」と気楽に構えていたのだが、彼のおかげで気が引き締まった。 4 月から始まる第二四半期内に取得することを決め、まず Udemy の講座を購入した。

---🇺🇸 English ---

A colleague on my team — someone who works in the database domain — just earned the AWS Certified Security - Specialty. This is right after he got his AWS Certified Solutions Architect - Professional, and it’s completely outside his area of specialization. He pulled it off in just a few months. I haven’t had a chance to ask him why, but I suspect he sees security as increasingly critical in a world where AI is accelerating technical change. I had been pretty relaxed about it myself, figuring “sometime this year is fine” — but his example lit a fire under me. I’ve decided to get it done within Q2, starting with a Udemy course I just bought.


今週のニュース・気になったこと

1. Inside TeamPCP’s Sophisticated Supply Chain Attack on Trivy

https://cybermagazine.com/news/inside-teampcps-sophisticated-supply-chain-attack-on-trivy

TeamPCP というハッカー集団が、OSS セキュリティスキャンツール Trivy のリポジトリからトークンを窃取し、そこを起点に連鎖的に複数のツールへ侵害を広げた事件。自分なりの理解をまとめておく。

1. 最初の「合鍵」を盗む(2026 年 2 月 28 日)

Trivy では CI/CD 自動化のために aqua-bot というボットアカウントが使われており、その個人アクセストークン(PAT)がリポジトリ内に保存されていた。 攻撃の入口となったのは GitHub Actions のトリガー pull_request_target の設定不備だ。このトリガーはフォーク元の外部 PR であっても元リポジトリの強力な権限(書き込み権限・シークレットへのアクセス)を持ったまま実行されてしまう。攻撃者はこれを利用した悪意ある PR を送り込み、aqua-bot の PAT を盗み出すことに成功した。

2. 公式タグに「罠」を仕掛ける(汚染)

盗んだ PAT を使い、GitHub 上の公式タグ(@v1 など)を悪意あるコミット(Imposter Commit)を指すよう書き換えた。 見た目は本物そっくりに偽装されていたが、GPG 署名(Verified バッジ)がなかったのが唯一の見破り口だった。 (GPG:コミットが本当にその人物から来たものかを検証するセキュリティ機能)

3. 利用者の環境で情報を盗む(実行)

普段どおりにツールを使った利用者の CI/CD パイプラインで罠が発動。マルウェアはメモリ(RAM)を直接スキャンしてパスワードやクラウド認証情報を収集し、タイポスクワットドメイン scan.aquasecurtiy.org(正規は aquasecurity.org)へ送信した。 また、フォールバックとして利用者の GitHub に tpcp-docs という公開リポジトリを勝手に作成し、そこにデータを流出させる経路も確保していた。

4. 盗んだ権限で次の標的へ(拡大)

窃取した情報の中に Checkmarx や LiteLLM を操作できる権限が含まれており、攻撃者はそれを悪用してさらに次のツールへ罠を仕掛けた。 LiteLLM では、メンテナ用の鍵を入手して悪意あるバージョンを PyPI に公開。Python の .pth ファイルを悪用することで、インポートなしに実行時自動読み込みを実現し、そこからさらに認証情報を収集する仕組みを埋め込んだ。

5. バックドアを維持する(持続化)

sysmon.service と ICP ブロックチェーンの Canister を C2(Command and Control)の中継点に使うことで、通信の遮断・追跡を困難にした。通常の C2 サーバーは当局に閉鎖されるリスクがあるが、ブロックチェーン上のスマートコントラクトはそれが難しいため、持続的なコントロールを維持できる。

C2(Command and Control) とは、攻撃者が侵害したマシンに遠隔から命令を下したり、盗んだデータを回収したりするための指令サーバーのこと。

---🇺🇸 English ---

A hacker group called TeamPCP stole a token from the repository of the OSS security scanning tool Trivy, then used it as a launchpad to compromise a chain of other tools. Here’s my attempt to break down what happened.

Step 1 — Stealing the master key (February 28, 2026)

Trivy used a bot account called aqua-bot to automate CI/CD tasks, and its Personal Access Token (PAT) was stored inside the repository. The attack entry point was a misconfigured GitHub Actions trigger: pull_request_target. The key risk with this trigger is that it runs with the full permissions of the original repository — including write access and secrets — even for pull requests coming from external forks. The attackers sent a malicious PR that exploited this, successfully extracting the aqua-bot PAT from memory.

Step 2 — Planting the trap (contamination)

Using the stolen PAT, they quietly rewrote official GitHub tags (like @v1) to point to a malicious Imposter Commit. The fake commit was disguised to look legitimate, but the one telltale sign was the missing GPG signature (Verified badge). (GPG is a security mechanism that verifies whether a commit actually came from who it claims to be from.)

Step 3 — Stealing data from users (execution)

When users ran the tool as usual in their CI/CD pipelines, the trap triggered. The malware directly scanned memory (RAM) to collect passwords and cloud credentials, then exfiltrated them to a typosquatting domain: scan.aquasecurtiy.org (the real domain is aquasecurity.org). As a fallback, it also silently created a public repository called tpcp-docs in the victim’s GitHub account as a secondary data exfiltration channel.

Step 4 — Pivoting to new targets (expansion)

Among the stolen credentials were permissions to manage tools like Checkmarx and LiteLLM. The attackers used these to plant traps in those tools as well. With LiteLLM, they obtained maintainer keys and published a malicious version to PyPI. By abusing Python’s .pth file mechanism — which gets loaded automatically at runtime without any explicit import — they embedded a second stage payload to harvest even more credentials.

Step 5 — Maintaining persistence

They used sysmon.service and an ICP blockchain Canister as C2 (Command and Control) relay points, making communication difficult to block or trace. Unlike conventional C2 servers, which can be taken down by authorities, a smart contract on a blockchain is much harder to shut down — giving the attackers a durable foothold.

C2 (Command and Control) refers to the infrastructure attackers use to remotely issue commands to compromised machines and receive stolen data.