JavaScriptを前処理しLLMの悪性パッケージ検出を改善
CASHEWS: Source Preprocessor for LLM-based Malicious Package Detection
この論文をやさしく読む
ひとことで言うと
大きく難読化されたJavaScriptを、検出に関わる処理を中心に短く整理し、LLMが読み切れずに見逃す問題を減らします。
何に役立つ?
パッケージの防御的な検査で、読めるファイルの割合を増やし、モデル利用費用を抑えるための前処理として役立ちます。
この研究の面白いところ
単純な切り詰めではなく、復号・モジュール抽出・後方スライスを組み合わせます。解析範囲と検出率だけでなく、前処理時間と費用も評価しています。
どこまで分かった?
数値は512ファイル、2種類のスキャナー、3モデルでの実験結果です。98.8〜100%は解析カバー率であり、すべての悪性パッケージを検出した率ではありません。
v1のアブストラクトに基づくAI解説。日本語訳とは別に、用途の解釈を含みます。
アブストラクトの日本語訳
悪性npmパッケージの検出ツールは、現在、LLMのソースコードの意味理解を利用して悪意を大規模に検出している。この能力は、Shai-Huludのような近年のサプライチェーン攻撃に関与するパッケージの特定に非常に有用であると分かっている。しかし攻撃者は、トークン密度を高めるコード難読化や、悪性コードを正常なパッケージとまとめるバンドルなどのJavaScript技法によって、LLMの限られたコンテキスト長を悪用する。その結果、検出器が大きなファイルを飛ばしたり、悪性の振る舞いを見逃したりし、検出回避の余地が生まれる。 本論文では、解析に無関係なコードやモデルを誤らせそうなコードを除くようソースを書き換えてファイルを縮小するJavaScript前処理器CASHEWSを提示する。パッケージのソースファイルに対し、反復的な復号によって難読化を解き、バンドルされたモジュールと動的実行コードを抽出する。さらに悪性のシンクを特定し、そこへ至る後方スライスを計算し、長いリテラルや識別子を短縮して、検出器用の簡潔な表現を作る。 大きなパッケージファイル512件、2種類のスキャナー、3つのLLMにわたり、CASHEWSは解析カバー率を69.1〜85.7%から98.8〜100%へ高め、偽陰性率を最大18.6ポイント低下させる。また、前処理時間の中央値は30秒で、正味の解析費用を34.6%削減し、レジストリ全体を対象とするLLM解析をより現実的にする。解析前にソースコードを前処理することで、研究者や実務者が、能力の低いモデルと同等以下の解析費用で、より高性能なモデルを悪性パッケージ検出に使えるようにする。
v1の要旨から自動生成。本文の精読・人による確認は未実施。
- 初稿
- 2026-09-16(UTC)
- 最新改訂
- 2026-09-16 · v1
- 査読・掲載
- 査読状況未確認
更新履歴
- v1 2026-09-16 この版を読む
取得できた版を表示。版の更新は査読済みを意味しません。過去版の本文差分は未解析です。
原文の要旨
Malicious npm package detection tools now leverage LLMs' semantic understanding of source code to detect malicious intent at scale. This capability has proven invaluable in identifying packages involved in recent supply-chain attacks such as Shai-Hulud. However, threat actors exploit the limited context windows of LLMs through JavaScript techniques such as code obfuscation that yields high token density and bundling malicious code with benign packages, causing detectors to skip large files or miss malicious behavior. This creates an attack surface for evading detection. In this paper, we present CASHEWS, a JavaScript preprocessor that reduces file size by rewriting source code to remove code that is irrelevant to analysis or likely to mislead the model. Given a package source file, CASHEWS deobfuscates it through iterative decoding, extracts bundled modules and dynamically executed code, identifies malicious sinks and computes backward slices that reach them, and abbreviates long literals and identifiers to produce a compact representation for the detector. Across 512 large package files, two scanner types, and three LLMs, CASHEWS increases analysis coverage from 69.1--85.7% to 98.8--100% and reduces the false-negative rate by up to 18.6 percentage points. CASHEWS also has a median preprocessing time of 30 seconds while reducing net analysis cost by 34.6%, making registry-wide LLM-based analysis more practical. By preprocessing source code before analysis, CASHEWS enables researchers and industry practitioners to use more powerful models for malicious package detection at the same or lower analysis cost as less powerful models.
arXiv ID: 2609.18862 / 要約の誤りについて