Skip to content

Instantly share code, notes, and snippets.

View terrancedejesus's full-sized avatar
🏠
Working from home

Terrance DeJesus terrancedejesus

🏠
Working from home
View GitHub Profile
@terrancedejesus
terrancedejesus / tycoon2fa_aitm_containment.yaml
Created May 19, 2026 04:09
PoC: Workflow - Tycoon2FA AiTM Containment
name: Tycoon2FA AiTM Containment (M365, live)
description: |
Triggers on alerts from the "Successful Sign-in from Known AiTM Kit Egress ASN" rule.
Wire this workflow as the rule's "Run Workflow" action; the rule binding handles the rule-id filter.
Runs the documented Response chain against real Microsoft Graph using a client_credentials bearer
acquired at trigger time. Assumes every alert from the wired rule is an Entra sign-in.
Credentials are inlined for demo simplicity. Rotate or delete the app registration after the demo.
triggers:
@terrancedejesus
terrancedejesus / iac_white_box_aws_sns_exfiltration_main.tf
Last active March 13, 2025 13:42
Blog: AWS SNS Abuse - Data Exfiltration and Phishing
provider "aws" {
region = var.region
}
# Generate random ID for unique resource names
resource "random_id" "unique" {
byte_length = 2
}
# VPC for EC2
@terrancedejesus
terrancedejesus / customer_data.csv
Last active February 20, 2025 14:38
Blog - Detection Strategies for AWS S3 SSE-C Ransom Threats IaaC
CustomerID Name Email TotalSpent
1 John Doe johndoe@example.com $5000
2 Jane Smith janesmith@example.com $3000
3 Bob Johnson bobjohnson@example.com $7000
@terrancedejesus
terrancedejesus / gcp_service_account_access_key_emulation.sh
Created September 3, 2024 13:41
GCP Service Account Access Key Emulation
#!/bin/bash
# Exit immediately if a command exits with a non-zero status.
set -e
# Variables (replace with your project ID)
PROJECT_ID="<your-project-id>"
SERVICE_ACCOUNT_NAME="attacker-sa"
SERVICE_ACCOUNT_DISPLAY_NAME="Attacker Service Account"
KEY_FILE="attacker-sa-key.json"
@terrancedejesus
terrancedejesus / aws_ec2_describe_instance_for_all_regions.sh
Last active August 26, 2024 17:28
Emulate Multi-Region Describe-Instance and Quota Requests
#!/bin/bash
# Assumes existing AWS CLI authentication
# Disable AWS CLI pager
export AWS_PAGER=""
# Output file
output_file="ec2_service_quotas.log"
echo "EC2 Service Quotas Check - $(date)" > "$output_file"
echo "===================================" >> "$output_file"
@terrancedejesus
terrancedejesus / aws_temp_creds_console_login_emulate.sh
Created August 20, 2024 13:04
AWS Temporary Credentials Request and Console Login URL Emulation
#!/bin/bash
# Get federated creds
output=$(aws sts get-federation-token --name consoler --policy-arns arn=arn:aws:iam::aws:policy/AdministratorAccess)
# Check if the previous command was successful
if [ $? -ne 0 ]; then
echo "The command 'aws sts get-federation-token --name consoler' failed."
exit 1
fi
@terrancedejesus
terrancedejesus / aws_s3_bucket_object_setup_and_retrieval.sh
Last active August 15, 2024 21:46
AWS S3 Bucket Object Setup and Retrieval Emulation
#!/bin/bash
# Disable AWS CLI pager
export AWS_PAGER=""
# Define variables
bucket_name="test-vulnerable-access-bucket-$(date +%s)"
access_log_bucket_name="${bucket_name}-logs"
region="us-east-1" # Update if in a different region
object_prefix="sensitive-file"
@terrancedejesus
terrancedejesus / aws_administratoraccess_attached_emulation.sh
Last active August 15, 2024 14:59
AWS AdministratorAccess Attached Emulation
#!/bin/bash
# Disable AWS CLI pager
export AWS_PAGER=""
# Define the user and role names
user_name="test-user"
role_name="test-role"
# Create a new IAM user
@terrancedejesus
terrancedejesus / elastic_aws_threat_detection_setup.sh
Last active February 19, 2025 17:51
Threat Detection for AWS with Elastic Security
#!/bin/bash
# Replace with your own values
RANDOM_SUFFIX=$(openssl rand -hex 4)
ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
REGION="us-west-2"
IAM_USER="elastic_agent"
S3_BUCKET="elastic-monitoring-logs-$RANDOM_SUFFIX"
CLOUDTRAIL_NAME="elastic-trail"
SQS_QUEUE_NAME="elastic-monitoring-queue"
@terrancedejesus
terrancedejesus / main.tf
Last active August 15, 2024 15:00
Setup AWS CloudTrail Monitoring for Elastic SIEM with Terraform
provider "aws" {
region = var.region
}
data "aws_caller_identity" "current" {}
resource "random_id" "bucket_suffix" {
byte_length = 4
}