Benign powershell Download

install.ps1

Invokes PowerShell HTTP request cmdletInvokes PowerShell REST request cmdlet
SHA-256c477e0d9c6229073f2ff83d2e26b7d4abedc564848e5f86d39e41b365deed20c

Evidence

References the GitHub service name lines 1–16
1# APM CLI Installer Script (Windows / PowerShell)
2#
3# Usage:
4# irm https://aka.ms/apm-windows | iex
5#
6# Pin a version (skips GitHub HTTP API - use for air-gapped / GHE):
7# $env:VERSION = 'v1.2.3'; irm https://aka.ms/apm-windows | iex
8# .\install.ps1 v1.2.3
9#
10# Custom install location (contains apm.cmd; sibling current contains apm.exe):
11# $env:APM_INSTALL_DIR = "$env:LOCALAPPDATA\Programs\apm\bin"; irm ... | iex
12#
13# Fork or private mirror:
14# $env:APM_REPO = 'my-org/apm'; irm ... | iex
15#
16# GitHub Enterprise Server / mirror (set VERSION …
IRM fetches a remote HTTPS script lines 16–25
16:63… achable api.github.com):
17# $env:GITHUB_URL = 'https://github.corp.com'
18# $env:VERSION = 'v1.2.3'
19# irm https://.../install.ps1 | iex
20#
21# Enterprise bootstrap mirror:
22# $env:APM_RELEASE_BASE_URL = 'https://mirror.example/apm-releases'
23# $env:APM_RELEASE_METADATA_URL = 'https://mirror.example/apm-releases/latest.json'
24# $env:APM_INSTALLER_BASE_URL = 'https://mirror.example/apm-install'
25# $env:APM_PYPI_INDEX_URL = 'https://mirror.example/p …
References the GITHUB_TOKEN environment variable lines 26–36
26:23… _FALLBACK = '1'
27#
28# Private repositories: set GITHUB_APM_PAT or GITHUB_TOKEN
29#
30# Pinned installs require a .sha256 sidecar unless you opt out:
31# $env:APM_SKIP_CHECKSUM = '1' # or: .\install.ps1 v1.2.3 -SkipChecksum
32
33param(
34 [Parameter(Position = 0)]
35 [string]$Version = $null,
36 # Prefer $env:APM_REPO; -Repo r …
PowerShell script sets stop-on-error behavior lines 37–45
37:3… [string]$Repo = "microsoft/apm",
38 [switch]$SkipChecksum
39)
40
41$ErrorActionPreference = "Stop"
42
43$skipChecksum = $SkipChecksum -or ($env:APM_SKIP_CHECKSUM -eq '1')
44
45# -------------------------------------------------------- …
HTTP URL string literal lines 50–65
50 $env:GITHUB_URL.Trim().Trim('"').TrimEnd('/')
51} else {
52 "https://github.com"
53}
54if ($githubUrl -notmatch '(?i)^https://') {
55 Write-Host "GITHUB_URL must use an https:// URL." -ForegroundColor Red
56 exit 1
57}
58
59$apmRepo = if ($env:APM_REPO) { $env:APM_REPO.Trim() } else { $Repo }
60if ($apmRepo -notmatch '^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$') {
61 Write-Host "APM_REPO must be owner/name (letters, digits, ._- only)." -ForegroundColor Red
62 exit 1
63}
64
65$releaseBaseUrl = if ($env:APM_RELEASE_BASE_URL) { $env:APM_RELEASE_BASE_URL.Trim().Trim('"').TrimEnd('/') } …

Keyboard shortcuts on this page: j for the next sample, k for the previous one, x to go back to the feed, d to download the original bytes, r to re-queue the sample for analysis.