We continue reproducing the attack from the post above 🔼

More in General
- We helped Apple fix a vulnerability in the kernel of its operating systems
We helped Apple fix a vulnerability in the kernel of its operating systems PT ESC expert…
- Recovering EVTX records: carving methods
Recovering EVTX records: carving methods 🧩 When investigating incidents where attackers encrypt virtual machine images, a…
- Operation Chewbacca
At the end of June, the PT ESC team, during incident investigations, discovered a new group…
- Your Zimbra server is at risk
Recently, our PT ESC IR team encountered a new attack by ransomware groups on Zimbra mail…
- He's not your gsocket
He's not gsocket to you 😑 During the investigation of one of the incidents, PT ESC…
3️⃣ Creating a public API Gateway trigger (screenshot 1)
At the end, we need to expose the function to the internet. We added an API Gateway trigger to the Lambda function, specifying
Security: Open in the settings. A public URL is created, which became the backdoor. It will look something like this:https://abcdef123.execute-api.eu-central-1.amazonaws.com/default/create-backdoor-user-poc
Code language: YAML (yaml)Note: since the cold start and three API calls can take a noticeable amount of time, we increased the Lambda function timeout from the default 3 to 15 seconds.
4️⃣ Executing the attack
Now it’s enough to simply navigate to the URL generated by API Gateway. In response, the browser receives JSON with fresh credentials of the new administrator (screenshot 2):
{
"AccessKeyId": "AKIAS22MVUU75MYRNT3U",
"SecretAccessKey": "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",
"UserName": "backdoor-user-20250921-155854"
}
Code language: JSON / JSON with Comments (json)When checking the result in AWS, we see the newly created user with the
AdministratorAccess policy attached (screenshot 3).👣 Digital footprint
Analysis of AWS CloudTrail logs showed that reliable detection requires tracking the entire chain of events.
1️⃣ CreateRole event (creating a role for Lambda)
At the first stage, a log entry appears for the creation of an IAM role with the telling name lambda-backdoor-role, intended for the Lambda service. This action by itself is not malicious, but it is where the chain begins.
•
eventName: CreateRole — the action itself.•
requestParameters.roleName: lambda-backdoor-role — the role name.•
userIdentity.userName — who exactly created this role.2️⃣ CreateFunction event (creating the Lambda function)
Next, we see that the very role created in the first step is attached to the new function create-backdoor-user-poc (requestParameters.role).
•
eventName: CreateFunction20150331 — the action of creating the function.•
requestParameters.functionName: create-backdoor-user-poc — the function name.•
requestParameters.role: arn:aws:iam::***:role/lambda-backdoor-role — shows that the very role created in the first step is attached to the new function.3️⃣ CreateApi event (creating the API Gateway trigger)
Here a public API is created. The key indicator in the log is the field userIdentity.invokedBy with the value AWS Internal and requestParameters.description equal to Created by AWS Lambda. This indicates that the API was created automatically through the Lambda interface, which is characteristic of this attack.
4️⃣ CreateUser event (creating the backdoor user)
In the log we see an event of a new user being created, but the field
userIdentity.sessionContext.sessionIssuer.userName contains the name of our role lambda-backdoor-role. This is an anomaly: a service role suddenly started creating users.•
eventName: CreateUser — the action itself.•
userIdentity.type: AssumedRole — indicates that the action was performed not directly by a user, but by a role.•
userIdentity.sessionContext.sessionIssuer.userName: lambda-backdoor-role — the initiating user is not a human, but the Lambda service role. This is an anomaly.•
requestParameters.userName: backdoor-user-20250921-155854 — the name of the created user.• At the very bottom of the userIdentity object there is a special block
inScopeOf. The field "issuerType": "AWS::Lambda::Function" — this indicates that the temporary credentials used for this API call were issued specifically to the Lambda function.• Another very strong indicator is userAgent: the presence of the substring
exec-env/AWS_Lambda. This string is added by the Lambda runtime and shows that the code that made the API call was executed specifically in the Lambda environment.If the post gets three likes, then in the next one we’ll share an idea for a correlation rule in SIEM 😉


#detect #tip #reverse
@ptescalator
More in General
- We helped Apple fix a vulnerability in the kernel of its operating systems
We helped Apple fix a vulnerability in the kernel of its operating systems PT ESC expert…
- Recovering EVTX records: carving methods
Recovering EVTX records: carving methods 🧩 When investigating incidents where attackers encrypt virtual machine images, a…
- Operation Chewbacca
At the end of June, the PT ESC team, during incident investigations, discovered a new group…
- Your Zimbra server is at risk
Recently, our PT ESC IR team encountered a new attack by ransomware groups on Zimbra mail…
- He's not your gsocket
He's not gsocket to you 😑 During the investigation of one of the incidents, PT ESC…







