I have enabled cloudtrail logs on wazuh and able the logs in events section. However, wazuh is not providing the events for Lambda function(eg: Delete function, Create function etc.). I looked up for a solution for this on the chat group and found a workaround.
Sample logs:
{
"eventVersion": "1.08",
"userIdentity": {
"type": "IAMUser",
"principalId": "AIDxxxxxxxxxxxxxxxxx",
"arn": "arn:aws:iam::2542xxxxxxxxxxxxxxx",
"accountId": "254xxxxxxxxxxx",
"accessKeyId": "ASIxxxxxxxxxxxxxxxxx",
"userName": "riyxxxxxxxxxxxxxxx",
"sessionContext": {
"sessionIssuer": {},
"webIdFederationData": {},
"attributes": {
"creationDate": "2023-07-13T05:11:38Z",
"mfaAuthenticated": "false"
}
}
},
"eventTime": "2023-07-13T05:59:03Z",
"eventSource": "
lambda.amazonaws.com",
"eventName": "DeleteFunction2015xxxx",
"awsRegion": "eu-north-1",
"sourceIPAddress": "120.11.102.1",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/
114.0.0.0 Safari/537.36",
"requestParameters": {
"functionName": "myfunction"
},
"responseElements": null,
"requestID": "ee8e5e7b-3ded-456d-bfc8zzzzzzzzzzz",
"eventID": "45bece99-d1800-4fe5-0000-5db6ecfiwiwjn5",
"readOnly": false,
"eventType": "AwsApiCall",
"managementEvent": true,
"recipientAccountId": "254289409ww88w",
"eventCategory": "Management",
"tlsDetails": {
"tlsVersion": "TLSv1.2",
"cipherSuite": "ECDHE-RSA-AES128-GCM-SHA256",
"clientProvidedHostHeader": "
lambda.eu-north-1.amazonaws.com"
},
"sessionCredentialFromConsole": "true"
}
This is one example for delete function event (from the cloudtrail)
The following sample contains a rule for API calls and a child rule that includes the lambda function reference. I added this to the /var/ossec/etc/rules/local_rules.xml file:
<group name="amazon,aws,">
<rule id="80210" level="3">
<decoded_as>json</decoded_as>
<field name="eventType">AwsApiCall</field>
<options>no_full_log</options>
<description>AWS API Call: $(eventSource) - $(eventName).</description>
<group>aws_api_call,</group>
</rule>
<rule id="80211" level="3">
<if_sid>80210</if_sid>
<field name="requestParameters.functionName"></field>
<options>no_full_log</options>
<description>AWS Lambda Function $(requestParameters.functionName): $(eventSource) - $(eventName).</description>
<group>aws_api_call,aws_lambda_func,</group>
</rule>
</group>
I have added the above to the local_rules.xml file and restarted the manager. The rule is also reflecting in wazuh rules section but I am unable to get the logs in the events section. Please guide if I am missing something.