| Title | ChainguardのMelangeにおけるパストラバーサルの脆弱性 |
|---|---|
| Summary | melangeは宣言的パイプラインを使用してapkパッケージを構築することを可能にします。バージョン0.32.0から0.43.4の前までの間において、`melange lint --persist-lint-results`(オプトインフラグで、`melange build --persist-lint-results`でも使用可能)は、出力ファイルパスを`--out-dir`とAPKの.PKGINFO制御ファイルから読み取った`arch`および`pkgname`の値を結合して構築していました。影響を受けるバージョンでは、これらの値にパス区切り文字や`..`シーケンスの検証が行われていなかったため、melangeベースのlint/buildパイプラインにAPKを提供できる攻撃者(例:サードパーティAPKをlintするCIやサービスとしてのビルド)が、melangeプロセスが到達可能な任意の`.json`パスに`lint-pkgname-pkgver-repoch.json`を書き込ませる可能性がありました。書き込まれるファイルは部分的に攻撃者に影響された内容を持つJSONのlintレポートです。直接的なコード実行経路はありませんが、書き込みによりファイルシステム上の他のJSONアーティファクトを上書きしてしまう恐れがあります。本問題は`--persist-lint-results`を明示的に渡したデプロイメントにのみ影響し、このフラグはデフォルトで無効です。修正はmelange v0.43.4で行われ、`arch`と`pkgname`に`..`、`/`、および`filepath.Separator`の検証を`pkg/linter/results.go`のパス構築前に追加しました(コミット84f3b45)。回避策としては、.PKGINFOの内容を完全に信頼できないAPKのlintやビルド時に`--persist-lint-results`を渡さないことが推奨されます。また、低権限ユーザーでmelangeを実行し、書き込みを隔離されたディレクトリに制限することも影響を軽減します。 |
| Possible impacts | 当該ソフトウェアが扱う情報について、外部への漏えいは発生しません。 また、当該ソフトウェアが扱う情報の一部が書き換えられる可能性があります。 さらに、当該ソフトウェアは停止しません。 そして、この脆弱性を悪用した攻撃の影響は、他のソフトウェアには及びません。 |
| Solution | 正式な対策が公開されています。ベンダ情報を参照して適切な対策を実施してください。 |
| Publication Date | April 24, 2026, midnight |
| Registration Date | April 30, 2026, 12:11 p.m. |
| Last Update | April 30, 2026, 12:11 p.m. |
| CVSS3.0 : 低 | |
| Score | 3.3 |
|---|---|
| Vector | CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:N |
| Chainguard |
| Melange 0.32.0 以上 0.43.4 未満 |
| No | Changed Details | Date of change |
|---|---|---|
| 1 | [2026年04月30日] 掲載 |
April 30, 2026, 12:11 p.m. |
| Summary | melange allows users to build apk packages using declarative pipelines. Starting in version 0.32.0 and prior to version 0.43.4, `melange lint --persist-lint-results` (opt-in flag, also usable via `melange build --persist-lint-results`) constructs output file paths by joining `--out-dir` with the `arch` and `pkgname` values read from the `.PKGINFO` control file of the APK being linted. In affected versions these values were not validated for path separators or `..` sequences, so an attacker who can supply an APK to a melange-based lint/build pipeline (e.g. CI that lints third-party APKs, or build-as-a-service) could cause melange to write `lint-<pkgname>-<pkgver>-r<epoch>.json` to an arbitrary `.json` path reachable by the melange process. The written file is a JSON lint report whose content is partially attacker-influenced. There is no direct code-execution path, but the write can clobber other JSON artifacts on the filesystem. The issue only affects deployments that explicitly pass `--persist-lint-results`; the flag is off by default. The issue is fixed in melange v0.43.4 by validating `arch` and `pkgname` for `..`, `/`, and `filepath.Separator` before path construction in `pkg/linter/results.go` (commit 84f3b45). As a workaround, do not pass `--persist-lint-results` when linting or building APKs whose `.PKGINFO` contents are not fully trusted. Running melange as a low-privileged user and confining writes to an isolated directory also limits impact. |
|---|---|
| Publication Date | April 24, 2026, 9:16 a.m. |
| Registration Date | April 25, 2026, 4:07 a.m. |
| Last Update | April 27, 2026, 11:42 p.m. |
| Configuration1 | or higher | or less | more than | less than | |
| cpe:2.3:a:chainguard:melange:*:*:*:*:*:go:*:* | 0.32.0 | 0.43.4 | |||