Build depends on SNAPSHOT artifacts and non-enforced version locks

オープン
#4,971 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
22/100
issue の種類
リファクタリング
明瞭さ
説明が足りない
活発さ
活発
技術スタック
java

調査の方向性

Start with the parent pom.xml (repository and pluginRepository blocks near lines 36-54) and k-frontend/pom.xml (the nailgun-server and ng dependencies near lines 157 and 169), then compare them with the lock files under mvn-lock/ and the k-lock target in nix/k.nix and flake.nix. Done would mean the build resolves only pinned release artifacts, or enforces the lock in the plain Maven path, with maintainers agreeing on the approach first. The issue itself leaves the fix undecided, so confirm the direction before writing code.

索引モデルが issue の本文から書いたものです。

説明

Summary

k-frontend/pom.xml consumes 1.0.0-k5.0-SNAPSHOT artifacts from the RV Maven repository; a rebuilt SNAPSHOT changes the toolchain without any repo change.

4 finding(s) (2 MEDIUM, 2 LOW) — line-anchor verified at commit 4a46d1231473.

Findings
Severity ID Location Summary
MEDIUM supply-chain-build-007 pom.xml:197 Maven dependency locks exist but are not enforced by the POM build
MEDIUM supply-chain-build-008 k-frontend/pom.xml:169 Native executable ng pulled as a 1.0.0-k5.0-SNAPSHOT Maven artifact
LOW supply-chain-build-006 pom.xml:36 Maven SNAPSHOT repository enabled for the whole build
LOW supply-chain-build-009 k-frontend/pom.xml:157 nailgun-server:1.0.0-SNAPSHOT resolved from a third-party repository
Details
supply-chain-build-007 — Maven dependency locks exist but are not enforced by the POM build (pom.xml:197)

Trigger (as reviewed): mvn-lock//dependencies-lock.json files (with sha512 integrity fields for every artifact) are checked in, and nix/k.nix / flake.nix only generate them (the k-lock attribute runs dependency-lock-maven-plugin:1.2.2:lock). Grepping the POMs for dependency-lock / dependencies-lock finds no binding the plugin's verify/check goal to a lifecycle phase. Consequently mvn package, as invoked by package/debian//rules.* and package/arch/PKGBUILD, resolves dependencies from remote repositories without consulting the lock.

Impact (as reviewed): The integrity data in mvn-lock/ provides no protection for the ordinary (non-Nix) build paths that produce the released .debs and Arch packages. A compromised or typosquatted artifact at a resolved coordinate is accepted; the checked-in lock is decorative in those paths. A partially applied verification gap: the repo looks locked but the enforcing step is absent.

Deep review: reachability=REACHABLE-FROM-UNTRUSTED; exploitability=EXPLOITABLE; red-team=RED-TEAM-SURVIVED.

Strongest counterargument found during red-teaming: The exploit requires an attacker with write access to runtimeverification.mycloudrepo.io, and the maintainers explicitly documented the lock as informational/best-effort in commit #4820. Whether that documented tradeoff should count as an accepted risk with an owner (lowering or closing this as a finding) is a judgment the code alone cannot settle; the external repository's redeploy/immutability policy for the 1.0.0-SNAPSHOT coordinates is also unverifiable from this checkout.

supply-chain-build-008 — Native executable `ng` pulled as a `1.0.0-k5.0-SNAPSHOT` Maven artifact (k-frontend/pom.xml:169)

Trigger (as reviewed): The frontend declares a uexe (native executable) dependency on org.kframework.dependencies:ng at a -SNAPSHOT version, with sibling declarations at 0.9.2-k4.0 for linux (line 161) and windows (line 175). The snapshot repository is enabled (see -006). ng/kserver are the nailgun launchers that the distribution executes (k-distribution/src/main/scripts/lib/checkJava invokes bin/ng), and k-distribution/src/main/assembly/bin.xml copies :uexe: artifacts into lib/kframework/bin.

Impact (as reviewed): An unverifiable, re-publishable native binary is bundled into the shipped distribution and executed on the user's machine. Maven's checksum check only proves consistency with whatever the repository currently serves for that snapshot coordinate, not that the binary is the reviewed one. Direct binary-supply-chain injection point into every K install.

Deep review: reachability=REACHABLE-FROM-UNTRUSTED; exploitability=EXPLOITABLE; red-team=RED-TEAM-INCONCLUSIVE.

Strongest counterargument found during red-teaming: The Nix fixed-output hash fully protects released macOS installations (the only shipped macOS channel) and Linux packages, so an artifact-repository-only attacker cannot reach end users; however the finding still survives in a narrower form: the README-documented mvn package developer build on macOS resolves the mutable snapshot fresh with no enforced digest (the lock file is only generated by the separate k-lock Nix output), and the build/tests plus the resulting local distribution execute lib/kframework/bin/ng, giving RCE on macOS build machines.

supply-chain-build-006 — Maven SNAPSHOT repository enabled for the whole build (pom.xml:36)

Trigger (as reviewed): The parent POM enables snapshot resolution from a third-party host (runtimeverification.mycloudrepo.io) for all modules. The same repository is registered again as a pluginRepository (lines 50-54), so build plugins can also be resolved as snapshots.

Impact (as reviewed): Snapshot artifacts are mutable by design: the same coordinates can be re-published with different bytes. Any module that resolves a -SNAPSHOT coordinate silently picks up re-published content on the next non-offline build. Because the repository is operator-controlled and not central, this is a persistent supply-chain path that survives normal dependency pinning.

supply-chain-build-009 — `nailgun-server:1.0.0-SNAPSHOT` resolved from a third-party repository (k-frontend/pom.xml:157)

Trigger (as reviewed): nailgun-server is a compile-scope dependency at a snapshot version, resolved from runtimeverification.mycloudrepo.io. The lock file records its sha512, but (per -007) the lock is not enforced in the plain Maven build. checkJava in the distribution uses the nailgun server socket (KSERVER_SOCKET, $NG --nailgun-server local:$KSERVER_SOCKET/socket), so this class is loaded into the long-running kserver process.

Impact (as reviewed): Mutable snapshot code runs in the compiler server process that K's tooling talks to. A re-published snapshot (or a repo compromise) substitutes new bytecode with no enforced hash and no signature; because it is compile-scope it also enters the toolchain's classpath at runtime.

Deep review: reachability=REACHABLE-FROM-UNTRUSTED; exploitability=EXPLOITABLE; red-team=RED-TEAM-SURVIVED.

Strongest counterargument found during red-teaming: The attack requires write access to Runtime Verification's own CloudRepo namespace (or a compromise of CloudRepo itself), and the repository is first-party rather than the 'third-party repository' the title claims. Whether CloudRepo permits adding new timestamped snapshots under that coordinate, and whether the release deploy job really executes the integration-test/kserver phase while MAVEN_PASSWORD is in the environment, could not be verified offline. These affect severity and framing, not the existence of the unenforced mutable-snapshot dependency.

Suggested fix

Publish/rely on release (not SNAPSHOT) artifacts for ng, nailgun-server, and mpfr_java, and enforce the dependency lock in CI so unexpected version changes fail the build.


From a static audit of this repository at commit 4a46d1231473b599c699160132fd6e76a5c46406 (master). Every location above was verified against the source at that revision; no exploit code was run against this repository or its infrastructure.

主要言語
Python
スター
605
フォーク
165
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

runtimeverification/k のほかの issue

runtimeverification/k の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。