Skip to content

Guardduty malware s3 integration with lambda and eventbridge

0

Hello,

I have enabled guardduty malware s3 for a bucket and would like to know how I can integrate with eventbridge to trigger a lambda function every time I identify a malicious object move it to a quarantine bucket and send an email notification.

asked 2 years ago1.4K views

3 Answers
2

Hi, this document provide you with predefined SAM template to deploy above mentioned solution:

https://serverlessland.com/patterns/guardduty-malware-s3

answered 2 years ago

EXPERT

reviewed 2 years ago

  • The solution linked is useful, but to clarify, it involves an SNS notification being sent about all completed scans (not just those involving malware detections) and the scanned object being tagged with the scanning verdict. It would need to be modified to notify only about malware detections and to move the offending objects to another bucket, to satisfy the original requirements.

  • Hello

    Thank you for the shared article. Analyzing I realize that I can get an idea and what I really need as mentioned by Leo K is that after detecting the malware in the bucket this artifact is moved to a quarantine bucket and the security team receives an email notification.

1
Accepted Answer

Enter image description here Hi,

This recent blog post will fully detail the solution and provide all code need to implement it in your context: https://aws.amazon.com/blogs/security/using-amazon-guardduty-malware-protection-to-scan-uploads-to-amazon-s3/

Best,

Didier

EXPERT

answered 2 years ago

EXPERT

reviewed 2 years ago

  • Adding to this other good article, the solution sends the notifications about detected threats to EventBridge, not to SNS, so for the requested email notifications, an EventBridge rule needs to be created to send the notifications to an SNS topic. Also for clarity, this solution copies files found to be healthy to the specified destination S3 bucket, rather than moving infected files away from the source.

  • Thank you for the shared article. Analyzing I realize that I can get an idea and what I really need as mentioned by Leo K is that after detecting the malware in the bucket this artifact is moved to a quarantine bucket and the security team receives an email notification.

  • Thank you for the shared article. Analyzing I realize that I can get an idea and what I really need as mentioned by Leo K is that after detecting the malware in the bucket this artifact is moved to a quarantine bucket and the security team receives an email notification.

1

Hello.

When Guardduty Malware protection S3 detects malware, it tags the object.
You can trigger Lambda etc. by setting an EventBridge rule like the one below to detect that event.

{
  "source": ["aws.s3"],
  "detail-type": ["Object Tags Added"],
  "detail": {
    "bucket": {
      "name": ["Your S3 Bucket Name"]
    }
  }
}

Alternatively, you can create event rules that notify you when threats are detected from scan results.
https://docs.aws.amazon.com/guardduty/latest/ug/monitor-with-eventbridge-s3-malware-protection.html#s3-object-scan-status-malware-protection-s3-ev

{
  "detail-type": ["GuardDuty Malware Protection Object Scan Result"],
  "source": ["aws.guardduty"],
  "detail": {
    "scanResultDetails": {
      "scanResultStatus": ["THREATS_FOUND"]
    }
  }
}
EXPERT

answered 2 years ago

EXPERT

reviewed 2 years ago

  • Adding to that, the tags GuardDuty adds to the S3 object can (and arguably, should be) used only to prevent users from accessing the object both a) before the scanning has completed returned a healthy verdict and b) after the scan has detected malware. Users can be allowed only to access objects positively identified to be free of known malware.

  • Thank you for the shared article. Analyzing I realize that I can get an idea and what I really need as mentioned by Leo K is that after detecting the malware in the bucket this artifact is moved to a quarantine bucket and the security team receives an email notification.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.