Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[New Rule] AWS S3 Bucket Ransom Note Uploaded #3604

Merged
merged 22 commits into from
Jun 10, 2024

Conversation

terrancedejesus
Copy link
Contributor

@terrancedejesus terrancedejesus commented Apr 18, 2024

Issues

Summary

Identifies potential ransomware note being uploaded to an AWS S3 bucket. This rule detects the PutObject S3 API call
with a common ransomware note file extension such as .txt, .note, .ransom, or .lock. Adversaries with access to
a misconfigured S3 bucket may retrieve, delete, and replace objects with ransom notes to extort victims.

Screenshot 2024-04-17 at 10 18 52 PM
PutObject Example Event
{
  "_index": ".ds-logs-aws.cloudtrail-default-2024.05.06-000002",
  "_id": "e3ce95d475-000000346284",
  "_score": 1,
  "fields": {
    "aws.cloudtrail.request_parameters.text": [
      "{bucketName=stratus-red-team-ransomware-bucket-fhumti, x-id=PutObject, Host=stratus-red-team-ransomware-bucket-fhumti.s3.us-east-1.amazonaws.com, key=FILES-DELETED.txt}"
    ],
    "aws.cloudtrail.flattened.additional_eventdata": [
      {
        "SignatureVersion": "SigV4",
        "CipherSuite": "TLS_AES_128_GCM_SHA256",
        "bytesTransferredIn": 230,
        "SSEApplied": "Default_SSE_S3",
        "AuthenticationMethod": "AuthHeader",
        "x-amz-id-2": "Fw8a7tg+1+5ow/cjXQ6XgYbm5LcIQyAcWK95AiGIObII9tzz1QkwMQd/5IITKIaO0QIvLodrU/0=",
        "bytesTransferredOut": 0
      }
    ],
    "elastic_agent.version": [
      "8.13.2"
    ],
    "tls.version_protocol": [
      "tls"
    ],
    "user_agent.original.text": [
      "[stratus-red-team_995b14d8-ecd5-4883-8faf-bb5e9d235ee7]"
    ],
    "aws.cloudtrail.flattened.response_elements": [
      {
        "x-amz-server-side-encryption": "AES256",
        "x-amz-version-id": "bSpH4eh5YU_A6R56qMGjd_dnOMtuzKC9"
      }
    ],
    "aws.cloudtrail.additional_eventdata": [
      "{SignatureVersion=SigV4, CipherSuite=TLS_AES_128_GCM_SHA256, bytesTransferredIn=230, SSEApplied=Default_SSE_S3, AuthenticationMethod=AuthHeader, x-amz-id-2=Fw8a7tg+1+5ow/cjXQ6XgYbm5LcIQyAcWK95AiGIObII9tzz1QkwMQd/5IITKIaO0QIvLodrU/0=, bytesTransferredOut=0}"
    ],
    "aws.cloudtrail.response_elements": [
      "{x-amz-server-side-encryption=AES256, x-amz-version-id=bSpH4eh5YU_A6R56qMGjd_dnOMtuzKC9}"
    ],
    "agent.name.text": [
      "ip-172-31-95-103"
    ],
    "source.geo.region_name": [
      "Ohio"
    ],
    "source.ip": [
      "24.140.110.160"
    ],
    "agent.name": [
      "ip-172-31-95-103"
    ],
    "event.agent_id_status": [
      "verified"
    ],
    "source.geo.region_iso_code": [
      "US-OH"
    ],
    "aws.cloudtrail.management_event": [
      "false"
    ],
    "event.kind": [
      "event"
    ],
    "aws.cloudtrail.user_identity.arn": [
      "arn:aws:iam::891377031307:user/stratus"
    ],
    "event.outcome": [
      "success"
    ],
    "source.geo.city_name": [
      "Massillon"
    ],
    "tls.version": [
      "1.3"
    ],
    "user_agent.original": [
      "[stratus-red-team_995b14d8-ecd5-4883-8faf-bb5e9d235ee7]"
    ],
    "event.original": [
      "{\"eventVersion\":\"1.09\",\"userIdentity\":{\"type\":\"IAMUser\",\"principalId\":\"AIDA47CRWDCFTQGUB5FBF\",\"arn\":\"arn:aws:iam::891377031307:user/stratus\",\"accountId\":\"891377031307\",\"accessKeyId\":\"AKIA47CRWDCFXZ3V7UXR\",\"userName\":\"stratus\"},\"eventTime\":\"2024-06-02T14:23:21Z\",\"eventSource\":\"s3.amazonaws.com\",\"eventName\":\"PutObject\",\"awsRegion\":\"us-east-1\",\"sourceIPAddress\":\"24.140.110.160\",\"userAgent\":\"[stratus-red-team_995b14d8-ecd5-4883-8faf-bb5e9d235ee7]\",\"requestParameters\":{\"bucketName\":\"stratus-red-team-ransomware-bucket-fhumti\",\"Host\":\"stratus-red-team-ransomware-bucket-fhumti.s3.us-east-1.amazonaws.com\",\"key\":\"FILES-DELETED.txt\",\"x-id\":\"PutObject\"},\"responseElements\":{\"x-amz-server-side-encryption\":\"AES256\",\"x-amz-version-id\":\"bSpH4eh5YU_A6R56qMGjd_dnOMtuzKC9\"},\"additionalEventData\":{\"SignatureVersion\":\"SigV4\",\"CipherSuite\":\"TLS_AES_128_GCM_SHA256\",\"bytesTransferredIn\":230,\"SSEApplied\":\"Default_SSE_S3\",\"AuthenticationMethod\":\"AuthHeader\",\"x-amz-id-2\":\"Fw8a7tg+1+5ow/cjXQ6XgYbm5LcIQyAcWK95AiGIObII9tzz1QkwMQd/5IITKIaO0QIvLodrU/0=\",\"bytesTransferredOut\":0},\"requestID\":\"FJV8AB29ES77QPJX\",\"eventID\":\"958d276a-15fd-4901-aa67-b13ec9c9d8d9\",\"readOnly\":false,\"resources\":[{\"type\":\"AWS::S3::Object\",\"ARN\":\"arn:aws:s3:::stratus-red-team-ransomware-bucket-fhumti/FILES-DELETED.txt\"},{\"accountId\":\"891377031307\",\"type\":\"AWS::S3::Bucket\",\"ARN\":\"arn:aws:s3:::stratus-red-team-ransomware-bucket-fhumti\"}],\"eventType\":\"AwsApiCall\",\"managementEvent\":false,\"recipientAccountId\":\"891377031307\",\"eventCategory\":\"Data\",\"tlsDetails\":{\"tlsVersion\":\"TLSv1.3\",\"cipherSuite\":\"TLS_AES_128_GCM_SHA256\",\"clientProvidedHostHeader\":\"stratus-red-team-ransomware-bucket-fhumti.s3.us-east-1.amazonaws.com\"}}"
    ],
    "cloud.region": [
      "us-east-1"
    ],
    "user.id": [
      "AIDA47CRWDCFTQGUB5FBF"
    ],
    "input.type": [
      "aws-s3"
    ],
    "log.offset": [
      346284
    ],
    "user_agent.name": [
      "Other"
    ],
    "data_stream.type": [
      "logs"
    ],
    "related.user": [
      "stratus"
    ],
    "tags": [
      "preserve_original_event",
      "forwarded",
      "aws-cloudtrail"
    ],
    "event.provider": [
      "s3.amazonaws.com"
    ],
    "agent.id": [
      "f14d530d-b7f2-4dbd-b122-28582c2a767c"
    ],
    "ecs.version": [
      "8.0.0"
    ],
    "event.created": [
      "2024-06-02T14:24:34.038Z"
    ],
    "aws.cloudtrail.event_version": [
      "1.09"
    ],
    "agent.version": [
      "8.13.2"
    ],
    "source.as.number": [
      12097
    ],
    "aws.cloudtrail.read_only": [
      false
    ],
    "aws.cloudtrail.event_category": [
      "Data"
    ],
    "aws.cloudtrail.user_identity.type": [
      "IAMUser"
    ],
    "aws.s3.bucket.arn": [
      "arn:aws:s3:::asperitas-security-logs"
    ],
    "aws.cloudtrail.recipient_account_id": [
      "891377031307"
    ],
    "aws.cloudtrail.request_id": [
      "FJV8AB29ES77QPJX"
    ],
    "tls.cipher": [
      "TLS_AES_128_GCM_SHA256"
    ],
    "user.name": [
      "stratus"
    ],
    "source.geo.location": [
      {
        "coordinates": [
          -81.4971,
          40.8133
        ],
        "type": "Point"
      }
    ],
    "source.address": [
      "24.140.110.160"
    ],
    "aws.cloudtrail.flattened.request_parameters": [
      {
        "bucketName": "stratus-red-team-ransomware-bucket-fhumti",
        "x-id": "PutObject",
        "Host": "stratus-red-team-ransomware-bucket-fhumti.s3.us-east-1.amazonaws.com",
        "key": "FILES-DELETED.txt"
      }
    ],
    "agent.type": [
      "filebeat"
    ],
    "event.module": [
      "aws"
    ],
    "source.geo.country_iso_code": [
      "US"
    ],
    "aws.cloudtrail.response_elements.text": [
      "{x-amz-server-side-encryption=AES256, x-amz-version-id=bSpH4eh5YU_A6R56qMGjd_dnOMtuzKC9}"
    ],
    "elastic_agent.snapshot": [
      false
    ],
    "aws.cloudtrail.event_type": [
      "AwsApiCall"
    ],
    "aws.s3.bucket.name": [
      "asperitas-security-logs"
    ],
    "source.as.organization.name.text": [
      "MASSCOM"
    ],
    "elastic_agent.id": [
      "f14d530d-b7f2-4dbd-b122-28582c2a767c"
    ],
    "data_stream.namespace": [
      "default"
    ],
    "source.as.organization.name": [
      "MASSCOM"
    ],
    "source.geo.continent_name": [
      "North America"
    ],
    "aws.cloudtrail.additional_eventdata.text": [
      "{SignatureVersion=SigV4, CipherSuite=TLS_AES_128_GCM_SHA256, bytesTransferredIn=230, SSEApplied=Default_SSE_S3, AuthenticationMethod=AuthHeader, x-amz-id-2=Fw8a7tg+1+5ow/cjXQ6XgYbm5LcIQyAcWK95AiGIObII9tzz1QkwMQd/5IITKIaO0QIvLodrU/0=, bytesTransferredOut=0}"
    ],
    "tls.client.server_name": [
      "stratus-red-team-ransomware-bucket-fhumti.s3.us-east-1.amazonaws.com"
    ],
    "event.action": [
      "PutObject"
    ],
    "event.ingested": [
      "2024-06-02T14:24:38Z"
    ],
    "@timestamp": [
      "2024-06-02T14:23:21.000Z"
    ],
    "cloud.account.id": [
      "891377031307"
    ],
    "aws.cloudtrail.user_identity.access_key_id": [
      "AKIA47CRWDCFXZ3V7UXR"
    ],
    "data_stream.dataset": [
      "aws.cloudtrail"
    ],
    "event.type": [
      "info"
    ],
    "log.file.path": [
      "https://asperitas-security-logs.s3.us-east-1.amazonaws.com/AWSLogs/891377031307/CloudTrail/us-east-1/2024/06/02/891377031307_CloudTrail_us-east-1_20240602T1425Z_OhKx2Q26KuHGGckK.json.gz"
    ],
    "agent.ephemeral_id": [
      "69b4fa20-756a-4d41-8325-7613b13a01b2"
    ],
    "aws.cloudtrail.request_parameters": [
      "{bucketName=stratus-red-team-ransomware-bucket-fhumti, x-id=PutObject, Host=stratus-red-team-ransomware-bucket-fhumti.s3.us-east-1.amazonaws.com, key=FILES-DELETED.txt}"
    ],
    "event.id": [
      "958d276a-15fd-4901-aa67-b13ec9c9d8d9"
    ],
    "source.geo.country_name": [
      "United States"
    ],
    "user_agent.device.name": [
      "Other"
    ],
    "aws.s3.object.key": [
      "AWSLogs/891377031307/CloudTrail/us-east-1/2024/06/02/891377031307_CloudTrail_us-east-1_20240602T1425Z_OhKx2Q26KuHGGckK.json.gz"
    ],
    "event.dataset": [
      "aws.cloudtrail"
    ],
    "user.name.text": [
      "stratus"
    ]
  }
}

@terrancedejesus terrancedejesus self-assigned this Apr 18, 2024
@terrancedejesus terrancedejesus marked this pull request as ready for review June 1, 2024 14:32
terrancedejesus and others added 3 commits June 5, 2024 10:25
…nsomware_note_added.toml

Co-authored-by: Ruben Groenewoud <78494512+Aegrah@users.noreply.github.com>
…nsomware_note_added.toml

Co-authored-by: Ruben Groenewoud <78494512+Aegrah@users.noreply.github.com>
@terrancedejesus terrancedejesus marked this pull request as draft June 5, 2024 14:33
@terrancedejesus terrancedejesus changed the title [New Rule] AWS S3 Bucket Object Retrieval, Deletion, and Potential Ransom Note Replacement [New Rule] AWS S3 Bucket Ransom Note Uploaded Jun 5, 2024
@terrancedejesus terrancedejesus requested review from imays11 and Aegrah June 5, 2024 19:30
@terrancedejesus terrancedejesus marked this pull request as ready for review June 5, 2024 19:35
@terrancedejesus
Copy link
Contributor Author

@imays11 - Although approved, please re-review this PR. I changed it from a sequence to ESQL focusing only on the ransom note upload as discussed in #3604 (comment). Thanks!

Copy link
Contributor

@imays11 imays11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

Copy link
Contributor

@Aegrah Aegrah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks good to me! Discussed with Terrance to remove some additional regex searches that are common from the query.

@terrancedejesus terrancedejesus merged commit 62eea77 into main Jun 10, 2024
9 checks passed
@terrancedejesus terrancedejesus deleted the new-rule-aws-s3-ransomware-deletion-and-note branch June 10, 2024 14:47
protectionsmachine pushed a commit that referenced this pull request Jun 10, 2024
* new rule 'AWS S3 Bucket Object Retrieval, Deletion, and Potential Ransom Note Replacement'

* fixed technique mapping

* added investigation guide; added more ransom note extensions

* adjusted lookback and maxspan

* added  API call to second sequence

* updating date

* Update rules/integrations/aws/impact_s3_bucket_object_deletion_and_ransomware_note_added.toml

Co-authored-by: Ruben Groenewoud <78494512+Aegrah@users.noreply.github.com>

* Update rules/integrations/aws/impact_s3_bucket_object_deletion_and_ransomware_note_added.toml

Co-authored-by: Ruben Groenewoud <78494512+Aegrah@users.noreply.github.com>

* changed rule to ESQL; updated investigation guide

* changed file name

* removed txt, ecc, and note

---------

Co-authored-by: Ruben Groenewoud <78494512+Aegrah@users.noreply.github.com>

(cherry picked from commit 62eea77)
protectionsmachine pushed a commit that referenced this pull request Jun 10, 2024
* new rule 'AWS S3 Bucket Object Retrieval, Deletion, and Potential Ransom Note Replacement'

* fixed technique mapping

* added investigation guide; added more ransom note extensions

* adjusted lookback and maxspan

* added  API call to second sequence

* updating date

* Update rules/integrations/aws/impact_s3_bucket_object_deletion_and_ransomware_note_added.toml

Co-authored-by: Ruben Groenewoud <78494512+Aegrah@users.noreply.github.com>

* Update rules/integrations/aws/impact_s3_bucket_object_deletion_and_ransomware_note_added.toml

Co-authored-by: Ruben Groenewoud <78494512+Aegrah@users.noreply.github.com>

* changed rule to ESQL; updated investigation guide

* changed file name

* removed txt, ecc, and note

---------

Co-authored-by: Ruben Groenewoud <78494512+Aegrah@users.noreply.github.com>

(cherry picked from commit 62eea77)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants