diff --git a/.gitignore b/.gitignore index afb92a49b6..f7fcc7cdc9 100644 --- a/.gitignore +++ b/.gitignore @@ -115,3 +115,10 @@ package/bin/sftp-config.json package/default/sftp-config.json *.code-snippets notes + +# detection_testing_batch innteractive mode +bin/automated_detection_testing/ci/detection_testing_batch/*-test-run.json +bin/automated_detection_testing/ci/detection_testing_batch/apps/ +bin/automated_detection_testing/ci/detection_testing_batch/security_content/ +bin/automated_detection_testing/ci/detection_testing_batch/test_config.json +bin/automated_detection_testing/ci/detection_testing_batch/test_results/ diff --git a/detections/cloud/aws_lambda_updatefunctioncode.yml b/detections/cloud/aws_lambda_updatefunctioncode.yml new file mode 100644 index 0000000000..cba2ca43fa --- /dev/null +++ b/detections/cloud/aws_lambda_updatefunctioncode.yml @@ -0,0 +1,59 @@ +name: AWS Lambda UpdateFunctionCode +id: 211b80d3-6340-4345-11ad-212bf3d0d111 +version: 1 +date: '2022-02-24' +author: Bhavin Patel, Splunk +type: Hunting +datamodel: [] +description: This analytic is designed to detect IAM users attempting to update/modify AWS lambda code via the AWS CLI to gain persistence, futher access into your AWS environment and to facilitate planting backdoors. In this instance, an attacker may upload malicious code/binary to a lambda function which will be executed automatically when the funnction is triggered. +search: '`cloudtrail` eventSource=lambda.amazonaws.com eventName=UpdateFunctionCode* errorCode = success user_type=IAMUser | stats count min(_time) as firstTime max(_time) as lastTime values(requestParameters.functionName) as function_updated by src_ip user_arn user_agent user_type eventName aws_account_id |`aws_lambda_updatefunctioncode_filter`' +how_to_implement: You must install Splunk AWS Add on and enable Cloudtrail logs in your AWS Environment. +known_false_positives: While this search has no known false positives, it is possible + that an AWS admin or an autorized IAM user has updated the lambda fuction code legitimately. +references: +- http://detectioninthe.cloud/execution/modify_lambda_function_code/ +- https://sysdig.com/blog/exploit-mitigate-aws-lambdas-mitre/ +tags: + analytic_story: + - Suspicious Cloud User Activities + asset_type: AWS Account + automated_detection_testing: passed + cis20: + - CIS 13 + confidence: 90 + context: + - Source:Cloud Data + - Outcome:Allowed + - Stage:Execution + dataset: + - https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1204/aws_updatelambdafunctioncode/aws_cloudtrail_events.json + impact: 70 + kill_chain_phases: + - Actions on Objectives + message: User $user_arn$ is attempting to update the lambda function code of $function_updated$ from this IP $src_ip$ + mitre_attack_id: + - T1204 + nist: + - PR.DS + - PR.AC + - DE.CM + observable: + - name: src_ip + type: IP Address + role: + - Attacker + - name: user_arn + type: User + role: + - Attacker + product: + - Splunk Enterprise + - Splunk Enterprise Security + - Splunk Cloud + required_fields: + - _time + - eventName + - userAgent + - errorCode + risk_score: 63 + security_domain: cloud diff --git a/tests/cloud/aws_lambda_updatefunctioncode.test.yml b/tests/cloud/aws_lambda_updatefunctioncode.test.yml new file mode 100644 index 0000000000..bc47b70de1 --- /dev/null +++ b/tests/cloud/aws_lambda_updatefunctioncode.test.yml @@ -0,0 +1,13 @@ +name: AWS Lambda UpdateFunctionCode Unit Test +tests: +- name: AWS Lambda UpdateFunctionCode + file: cloud/aws_lambda_updatefunctioncode.yml + pass_condition: '| stats count | where count > 0' + earliest_time: '-30d' + latest_time: 'now' + attack_data: + - file_name: aws_cloudtrail_events.json + data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1204/aws_updatelambdafunctioncode/aws_cloudtrail_events.json + sourcetype: aws:cloudtrail + source: aws_cloudtrail + update_timestamp: True