🇰🇷 한글 설명
Inspektor Gadget의 이미지 빌드 기능에서 Makefile 템플릿에 사용자 입력값이 적절히 이스케이프되지 않아 명령 주입 취약점이 발생합니다. 악의적인 YAML 가젯 매니페스트를 통해 임의의 명령어를 실행할 수 있으며, --local 플래그 사용 여부에 따라 호스트 또는 빌드 컨테이너에서 명령이 실행됩니다.
💡 쉬운 설명
Inspektor Gadget의 이미지 빌드 기능이 입력값을 안전하게 처리하지 못해 악의적인 명령어 실행이 가능합니다. CI/CD 환경에서 신뢰할 수 없는 가젯 이미지를 빌드할 때 특히 위험합니다.
🇺🇸 원문 (English)
Inspektor Gadget is a set of tools and framework for data collection and system inspection on Kubernetes clusters and Linux hosts using eBPF. The `ig` binary provides a subcommand for image building, used to generate custom gadget OCI images. A part of this functionality is implemented in the file `inspektor-gadget/cmd/common/image/build.go`. The `Makefile.build` file is the Makefile template employed during the building process. This file includes user-controlled data in an unsafe fashion, specifically some parameters are embedded without an adequate escaping in the commands inside the Makefile. Prior to version 0.48.1, this implementation is vulnerable to command injection: an attacker able to control values in the `buildOptions` structure would be able to execute arbitrary commands during the building process. An attacker able to exploit this vulnerability would be able to execute arbitrary command on the Linux host where the `ig` command is launched, if images are built with the `--local` flag or on the build container invoked by `ig`, if the `--local` flag is not provided. The `buildOptions` structure is extracted from the YAML gadget manifest passed to the `ig image build` command. Therefore, the attacker would need a way to control either the full `build.yml` file passed to the `ig image build` command, or one of its options. Typically, this could happen in a CI/CD scenario that builds untrusted gadgets to verify correctness. Version 0.51.1 fixes the issue.
📍 영향받는 시스템
Inspektor Gadget 0.48.0 이하 (0.51.1에서 수정됨)
⚔️ 공격 벡터
YAML 가젯 매니페스트의 buildOptions 파라미터를 조작하여 ig image build 실행 시 임의 명령어 주입
🛡️ 대응 방법
Inspektor Gadget을 0.51.1 이상으로 업그레이드
🔧 검증 코드
출력된 버전이 0.51.1 미만이면 취약하므로 즉시 업데이트 필요
ig version 2>/dev/null | head -1