B
Ars Technica 12일 전
트리비 스캐너 공급망 공격으로 전면 탈취 위험
중요도
핵심 요약
아쿠아 시큐리티(Aqua Security)의 널리 쓰이는 오픈소스 취약점 스캐너인 트리비(Trivy)의 깃허브(GitHub) 저장소가 대규모 공급망 공격을 받아 개발자 파이프라인과 기밀 정보가 전면 유출될 위기에 처했습니다. 해커는 탈취한 자격 증명을 이용해 악의적인 의존성을 포함한 버전 태그를 강제 푸시(force-push)했으며, 감염된 버전을 사용할 경우 깃허브 토큰, SSH 키 등 모든 시크릿이 암호화되어 외부로 전송됩니다. 개발자들은 자신의 CI/CD 파이프라인이 감염되었을 가능성을 가정하고 모든 파이프라인 시크릿을 즉시 교체해야 합니다.
번역된 본문
지속적인 공급망 공격으로 인해 해커들이 Aqua Security의 널리 사용되는 Trivy 취약점 스캐너의 거의 모든 버전을 탈취했습니다. 이는 이 스캐너를 사용하는 개발자 및 기업에 광범위한 영향을 미칠 수 있는 사태입니다.
공격자가 삭제한 소문과 스레드가 돌았던 가운데, Trivy 메인테이너인 Itay Shakury는 금요일에 이 탈취 사실을 확인했습니다. 이번 공격은 목요일 새벽에 시작되었습니다. 공격이 끝날 무렵, 위협 행위자는 탈취한 자격 증명을 사용하여 단 하나를 제외한 모든 trivy-action 태그와 7개의 setup-trivy 태그를 강제 푸시(force-push)하여 악성 종속성을 사용하도록 강제했습니다.
"파이프라인이 탈취된 것으로 의심되면, 모든 파이프라인 시크릿이 유출된 것으로 간주하고 즉시 교체하십시오."
강제 푸시는 기존 커밋을 덮어쓰지 못하게 막는 기본 안전 메커니즘을 무시하는 Git 명령입니다. Trivy는 개발자가 소프트웨어 업데이트를 개발하고 배포하는 파이프라인에서 취약점과 의도치 않게 하드코딩된 인증 시크릿을 감지하는 데 사용하는 취약점 스캐너입니다. 이 스캐너는 GitHub에서 33,200개의 스타를 받았으며, 이는 널리 사용되고 있음을 나타냅니다.
Shakury는 "손상된 버전을 실행하고 있었다고 의심되면 모든 파이프라인 시크릿이 유출된 것으로 간주하고 즉시 교체하라"고 작성했습니다.
보안 업체인 Socket과 Wiz는 75개의 손상된 trivy-action 태그에서 트리거되는 멀웨어가 개발자 머신을 포함한 개발 파이프라인을 철저히 수색하여 GitHub 토큰, 클라우드 자격 증명, SSH 키, Kubernetes 토큰 및 기타 모든 시크릿을 찾아낸다고 밝혔습니다. 시크릿을 발견하면 멀웨어는 데이터를 암호화하여 공격자가 제어하는 서버로 전송합니다.
Socket에 따르면, 최종 결과적으로 손상된 버전 태그를 참조하는 소프트웨어를 사용하는 모든 CI/CD 파이프라인은 Trivy 스캔이 실행되는 즉시 악성 코드를 실행하게 됩니다. 스푸핑된 버전 태그에는 널리 사용되는 @0.34.2, @0.33 및 @0.18.0이 포함됩니다. @0.35.0 버전만 영향을 받지 않은 유일한 버전인 것으로 보입니다.
Wiz 연구원들은 "악성 바이너리가 실행되면 합법적인 Trivy 서비스와 악성 코드가 병렬로 시작된다"고 작성했습니다. "우리의 초기 분석에 따르면 악성 코드는 기본 및 백업 메커니즘을 통해 시크릿을 유출합니다. 개발자 머신에 있다고 감지하면 지속성을 위해 Base64로 인코딩된 Python 드로퍼(dropper)를 추가로 기록합니다."
그들은 계속해서 설명했습니다: "악성 프로세스는 환경 변수를 수집하고, 파일 시스템에 저장된 모든 자격 증명을 스캔하며, 네트워크 인터페이스를 열거합니다. 그런 다음 데이터를 압축 및 암호화하여 https://scan.aquasecurtiy[.]org 로의 POST 요청을 통해 유출을 시도합니다. 이 시도가 실패하면(2xx가 아닌 상태 코드 반환), 멀웨어는 탈취한 GITHUB_TOKEN을 사용하여 tpcp-docs라는 저장소를 만들고 거기에 데이터를 게시하려고 시도합니다."
이 대규모 탈취는 목요일에 시작되었지만, 이는 지난달 Trivy 스캐너용 Aqua Trivy VS Code 확장 프로그램이 탈취된 별도의 사건에서 비롯된 것이라고 Shakury는 말했습니다. 이 사건에서 공격자는 Trivy GitHub 계정에 대한 쓰기 액세스 권한이 있는 자격 증명을 탈취했습니다. Shakury에 따르면 메인테이너들은 대응하여 토큰 및 기타 시크릿을 교체했지만, 이 과정이 완전히 "원자적(atomic)"이지 않았습니다. 즉, API 키, 인증서 및 비밀번호와 같은 자격 증명 아티팩트를 철저히 제거하여 악의적으로 사용되지 않도록 보장하지 못했습니다.
Socket 연구원들은 "이러한 [실패로 인해] 위협 행위자는 GitHub 자체를 악용할 필요 없이 강제 태그 업데이트를 포함한 인증된 작업을 수행할 수 있었습니다. 이 단계에서 사용된 정확한 자격 증명은 공개적으로 명시되지 않았지만, 근본 원인은 이전 자격 증명 탈취로 인한 잔여 접근 권한으로 밝혀졌다"고 작성했습니다.
은밀함을 더하는 새로운 기법
이번 탈취 기법은 새로운 커밋을 푸시하여 악성 코드로 저장소를 오염시키기 위해 도난당한 자격 증명을 사용하는 일반적인 공급망 공격과는 다릅니다. 이 새로운 방법은 많은 일반적인 방어 수단의 탐지 레이더를 피해 공격이 이루어지도록 허용했습니다.
원문 보기 (영어)
Text settings Story text Size Small Standard Large Width * Standard Wide Links Standard Orange * Subscribers only Learn more Minimize to nav Hackers have compromised virtually all versions of Aqua Security’s widely used Trivy vulnerability scanner in an ongoing supply chain attack that could have wide-ranging consequences for developers and the organizations that use them. Trivy maintainer Itay Shakury confirmed the compromise on Friday, following rumors and a thread , since deleted by the attackers, discussing the incident. The attack began in the early hours of Thursday. When it was done, the threat actor had used stolen credentials to force-push all but one of the trivy-action tags and seven setup-trivy tags to use malicious dependencies. Assume your pipelines are compromised A forced push is a git command that overrides a default safety mechanism that protects against overwriting existing commits. Trivy is a vulnerability scanner that developers use to detect vulnerabilities and inadvertently hardcoded authentication secrets in pipelines for developing and deploying software updates. The scanner has 33,200 stars on GitHub, a high rating that indicates it’s used widely. “If you suspect you were running a compromised version, treat all pipeline secrets as compromised and rotate immediately,” Shakury wrote. Security firms Socket and Wiz said that the malware, triggered in 75 compromised trivy-action tags, causes custom malware to thoroughly scour development pipelines, including developer machines, for GitHub tokens, cloud credentials, SSH keys, Kubernetes tokens, and whatever other secrets may live there. Once found, the malware encrypts the data and sends it to an attacker-controlled server. The end result, Socket said, is that any CI/CD pipeline using software that references compromised version tags executes code as soon as the Trivy scan is run. Spoofed version tags include the widely used @0.34.2, @0.33, and @0.18.0. Version @0.35.0 appears to be the only one unaffected. “When the malicious binary is executed it starts both the legitimate trivy service and the malicious code in parallel,” Wiz researchers wrote. “In our initial analysis the malicious code exfiltrates secrets with a primary and backup mechanism. If it detects it is on a developer machine it additionally writes a base64 encoded python dropper for persistence.” They continued: The malicious process gathers environmental variables, sweeps the system for any credentials stored in the filesystem and enumerates the network interface. It then compresses and encrypts the data and attempts to exfiltrate it via post request to https://scan.aquasecurtiy[.]org. If that fails (returns a non-2xx status code), the malware then attempts to use a stolen GITHUB_TOKEN to create a repo tpcp-docs and post the data there. Although the mass compromise began Thursday, it stems from a separate compromise last month of the Aqua Trivy VS Code extension for the Trivy scanner, Shakury said. In the incident, the attackers compromised a credential with write access to the Trivy GitHub account. Shakury said maintainers rotated tokens and other secrets in response, but the process wasn’t fully “atomic,” meaning it didn’t thoroughly remove credential artifacts such as API keys, certificates, and passwords to ensure they couldn’t be used maliciously. “This [failure] allowed the threat actor to perform authenticated operations, including force-updating tags, without needing to exploit GitHub itself,” Socket researchers wrote. “While the exact credential used in this phase has not been publicly specified, the root cause is now understood to be residual access from the earlier credential compromise.” A newer technique for added stealth The compromise technique is a departure from typical supply-chain attacks, which use stolen credentials to poison a repository with malicious code, usually by pushing a new commit. The newer method allowed the compromise to fly under the radar of many common defenses. Socket explained: After getting access to Trivy’s credentials, the attacker compromised the aquasecurity/trivy-action GitHub action but not by pushing to a branch or creating a new release, which would appear in the commit history and trigger notifications. Instead, the attacker force-pushed 75 existing version tags to point to new malicious commits. The technique involved multiple layers of deception that merit close examination. Git tags are pointers that refer to the SHA fingerprint of a commit. GitHub Actions that reference such tags resolve them to the specified commit. By force-updating the tags from the legitimate commits to attacker-written malicious ones, any workflow that referenced them automatically began pulling the latter ones. Socket said the precise process used by the threat attacker, which self-identified as Team PCP, was: Started from the master HEAD tree ( 57a97c7e ), the current file tree containing all latest code Swapped entrypoint.sh with the infostealer payload, leaving everything else from master intact Looked up the original commit that the tag previously pointed to (e.g., the PR #481 merge for tag 0.33.0) Cloned that commit’s metadata, spanning author name, email, committer, both timestamps, and the full commit message including PR number and “Fixes” references Set the parent to 57a97c7e (master HEAD) rather than the original parent Force-pushed the tag to this new commit Wiz added: The threat actor, self-identifying as TeamPCP , made imposter commits that were pushed to actions/checkout (while spoofing user rauchg) and to aquasecurity/trivy (while spoofing user DmitriyLewen. At 17:43:37 UTC, the Trivy repository’s tag was pushed, triggering a release. This resulted in a malicious checkout that fetched credential stealer code from a typosquatted domain (scan.aquasecurtiy[.]org, resolving to 45.148.10.212), and backdoored binaries being published to GitHub Releases, Docker Hub, GHCR, and ECR. The maintainers have since removed these malicious artifacts. The attacker also compromised the service account and then abused their access push malicious workflows to traceeshark and trivy-action and steal additional credentials from Aqua (including GPG keys and credentials for Docker Hub, Twitter, and Slack). These secrets were exfiltrated to a Cloudflare Tunnel C2 (plug-tab-protective-relay.trycloudflare.com). Furthermore, 75 out of 76 trivy-action tags were force-pushed to malicious versions, and 7 tags were force-pushed as well. So far, there are no known reports of breaches that have hit developers or organizations that used the compromised Trivy scanner. Given the app’s popularity, the thoroughness of the info-stealer, and the stealth of the operation, the potential fallout could be severe. All Trivy users should read the Socket and Wiz blog posts and follow the described defense steps. Dan Goodin Senior Security Editor Dan Goodin Senior Security Editor Dan Goodin is Senior Security Editor at Ars Technica, where he oversees coverage of malware, computer espionage, botnets, hardware hacking, encryption, and passwords. In his spare time, he enjoys gardening, cooking, and following the independent music scene. Dan is based in San Francisco. Follow him at here on Mastodon and here on Bluesky. Contact him on Signal at DanArs.82. 30 Comments