Skip to content
Access control Disclosed report Beginner

A potential risk in the aws-lambda-ecs-run-task which can be used to privilege escalation.

The aws-lambda-ecs-run-task sample application creates a Lambda function whose execution role is attached to the AdministratorAccess policy, granting full control over all AWS resources. An attacker who gains control of that function could use those permissions to escalate privileges to effectively root level in the account.

zolaer9527 Follow

Originally disclosed on HackerOne

Medium 6.3 View original
  • Fixed in 8 hours
  • Disclosed after 16 days

Summary: I found a potential risk in the aws-lambda-ecs-run-task when I deployed it in the awslabs repository on GitHub. The application created a function with a role that has too many excessive permissions. A malicious user could leverage these permissions to escalate his/her privilege in multiple ways.

Description: The aws-lambda-ecs-run-task application creates a function named rLambdaFunction, which has a role named rLambdaFunctionRole with the arn:aws:iam::aws:policy/AdministratorAccess policy. The policy allows for any action on all resources. That means the attacker can leverage these permissions to escalate privileges. If a malicious controlled this function, he/she can directly do what he/she wants to do as a root.

Impact

Summary:

A malicious user could leverage these permissions to escalate his/her privilege.

The original report as published on HackerOne, by zolaer9527. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 4 min read.

What the report shows

The target is the aws-lambda-ecs-run-task project in the awslabs GitHub organisation, deployed by the researcher. The feature under scrutiny is the IAM role that the application attaches to the Lambda function it creates.

According to the report, deploying the application produces a function named rLambdaFunction. That function runs under a role named rLambdaFunctionRole, and the role carries the managed policy with the ARN arn:aws:iam::aws:policy/AdministratorAccess. The researcher's point is that this policy grants any action on all resources, so the function's execution identity is effectively an administrator.

The steps, as the report describes them:

  1. Deploy aws-lambda-ecs-run-task from the awslabs repository.
  2. Observe that the deployment creates the function rLambdaFunction.
  3. Inspect the role attached to that function, rLambdaFunctionRole.
  4. Find that the role has arn:aws:iam::aws:policy/AdministratorAccess attached.

The report states the consequence directly: anyone who controls the function can act with those permissions, and the researcher describes this as being able to do what they want "as a root". The report does not include a proof of concept, a request, a command or a captured response, and it does not describe a specific escalation path beyond the general observation about the policy. It also does not record a fix; the platform entry lists the severity as medium with a CVSS score of 6.3, under the weakness "Incorrect Privilege Assignment".

Root cause

The root cause is over-broad privilege assignment: the function's role carries the AdministratorAccess managed policy, which allows any action on all resources. Because the role is the identity the function assumes at runtime, every invocation carries administrator rights, and any path that lets an attacker influence what the function does inherits them.

Impact

The report's claim is privilege escalation: a malicious user who controls the function can use the attached permissions to escalate privileges, in the researcher's words "in multiple ways", and can act with administrator rights. The report does not demonstrate a concrete route from an external attacker to control of the function. The severity recorded for the report is medium.

How this kind of bug works

Serverless and container-orchestration samples usually need a role so the function can call other AWS services. The bug class appears when that role is given more than the task requires, most starkly when a broad managed policy such as AdministratorAccess is attached. The execution role is not a boundary the attacker has to cross; it is the identity the code already holds. If an attacker can influence the function's behaviour, through injected input, a modified deployment artefact, a compromised dependency or control of the invocation path, the code runs their actions under that identity. Administrator rights allow any action on all resources, which is why the escalation is often described as turning a foothold into full control of the account.

The underlying mistake is treating a convenience default as production-ready. Least privilege, scoped inline or customer-managed policies, permission boundaries, and separation of deployment roles from runtime roles all reduce the blast radius. Resource policies and invocation controls that stop untrusted parties from steering the function close the entry path.

How to test for it

This is a configuration review rather than a request-and-response test, so the method is inspection plus a controlled demonstration.

  1. Identify the compute identities. For Lambda, look at the function's execution role; for ECS tasks, the task role and task execution role; for other services, the equivalent service role. Deployment templates, IaC files and the cloud console all expose these.
  2. Enumerate the policies attached to each role, both managed and inline, and resolve what actions and resources they allow. Wildcard actions on wildcard resources, or broad managed policies, are the signal.
  3. Compare the granted permissions with what the code actually calls. A function that only starts ECS tasks but holds administrator rights is a finding.
  4. Demonstrate impact safely. Show that the role can perform an action outside its intended purpose, for example by describing the policy and, where the program permits, performing a benign read or a no-op write in a test account. Do not create persistence or touch other tenants.
  5. Record the exact role name, policy ARN and the deployment step that produced them.

A positive result is a role whose effective permissions clearly exceed the function's function, evidenced by the policy document and, ideally, a permitted action that should not be possible. Common false positives: a broad policy that is constrained by a permissions boundary or session policy; a role that is never assumable by attacker-influenced code; a sample or documentation artefact that is not deployed by default; and permissions that look broad but are limited by resource conditions or service control policies.

How it is fixed

Replace the broad managed policy with a scoped policy that lists only the actions and resources the function needs.

Hunting notes

Over-privileged execution roles hide in sample applications, quick-start templates, CI/CD pipelines, and anything generated by a framework that defaults to convenience.

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 7 min read.

What happened, in plain words

This report is about a small sample application published by Amazon's own open-source group, awslabs, on GitHub. The project is called aws-lambda-ecs-run-task. The researcher deployed it and found that it created a function with an over-privileged role.

To follow this, you need two ideas. AWS is Amazon's cloud service: instead of running programs on your own computer, you rent computers from Amazon over the internet. Lambda is one of those services: you give AWS a piece of code, and AWS runs it whenever something triggers it, without you managing a server. A function is that piece of code.

Every Lambda function runs with an identity, called a role. Think of a role as a badge that a member of staff wears. The badge decides which doors open. In AWS, the badge is a set of permissions, and the function uses it automatically every time it runs, so whatever the code does, it does it with the badge's rights.

The researcher found that deploying this sample gives the function a badge that opens every door in the building. The steps were:

  1. Deploy aws-lambda-ecs-run-task from the awslabs repository.
  2. Observe that the deployment creates the function rLambdaFunction.
  3. Inspect the role attached to that function, rLambdaFunctionRole.
  4. Find that the role has arn:aws:iam::aws:policy/AdministratorAccess attached.

Step 4 is the finding. IAM is AWS's system for identities and permissions. A policy is a written list of what is allowed. A managed policy is a ready-made list that AWS maintains and that you can attach to many identities. The name AdministratorAccess says what it does: it allows every action on every resource in the account. The string starting arn:aws:iam::aws:policy/ is the policy's ARN, its unique address, like a catalogue number.

So the function's badge is the administrator badge. The researcher puts the consequence plainly: anyone who controls the function can act with those permissions, and describes this as being able to do what they want "as a root". Root is the all-powerful account owner in the Unix world, and the comparison is apt: the function is not the owner, but its badge is just as powerful.

Why does this matter? Because a function is not a sealed box. It reacts to input from outside: a request, a message, a file. If an attacker can influence what the function does, even slightly, their instructions run with the administrator badge. The report says this could be used to escalate privileges "in multiple ways", but it does not show a specific route, a proof of concept, a request, a command or a captured response. It also does not record a fix. The platform entry lists the severity as medium, with a CVSS score of 6.3, under the weakness "Incorrect Privilege Assignment". CVSS is a standard 0 to 10 score for how serious a flaw is.

The cause is that the function's role carries the full administrator policy rather than a limited set of permissions. Because the role is the identity the function assumes at runtime, every run carries administrator rights.

In general, how this kind of bug works

This is a case of over-privileged execution role, a member of the broader family called incorrect privilege assignment. The everyday comparison is a hotel cleaner who is given a master key to every room, the safe and the manager's office, when all they need is the cleaning cupboard. Nothing is broken; the key is simply too powerful, and if anyone borrows the cleaner's key ring, they get everything.

Serverless samples usually need a role so the function can call other AWS services. The mistake appears when that role is given more than the task requires, most starkly when a broad managed policy such as AdministratorAccess is attached. The role is not a wall the attacker has to climb; it is the identity the code already holds. If an attacker can steer the function, through injected input, a modified deployment file, a compromised dependency or control of whatever triggers it, their actions run under that identity. Administrator rights allow any action on all resources, which is why the escalation is often described as turning a small foothold into full control of the account. That is why the escalation is often described as turning a small foothold into full control of the account.

The underlying mistake is treating a convenience default as production-ready. Least privilege, the principle of granting only what is needed, scoped policies, permission boundaries (a hard ceiling on what a role can ever do, even if a policy says more), and keeping deployment roles separate from runtime roles all reduce the damage. Controls that stop untrusted parties from steering the function close the entry path.

How to test for it

This is a configuration review rather than a request-and-response test, so the method is inspection plus a controlled demonstration.

  1. Identify the compute identities. For Lambda, look at the function's execution role; for ECS tasks, the task role and task execution role; for other services, the equivalent service role. Deployment templates, infrastructure-as-code files and the cloud console all expose these.
  2. Enumerate the policies attached to each role, both managed and inline, and work out what actions and resources they allow. Wildcard actions on wildcard resources, or broad managed policies, are the signal.
  3. Compare the granted permissions with what the code actually calls. A function that only starts ECS tasks but holds administrator rights is a finding.
  4. Demonstrate impact safely. Show that the role can perform an action outside its intended purpose, for example by describing the policy and, where the program permits, performing a harmless read or a no-op write in a test account. Do not create persistence or touch other customers.
  5. Record the exact role name, policy ARN and the deployment step that produced them.

A positive result is a role whose effective permissions clearly exceed the function's purpose, evidenced by the policy document and, ideally, a permitted action that should not be possible. Common false positives: a broad policy constrained by a permissions boundary or session policy; a role that attacker-influenced code can never assume; a sample or documentation artefact that is not deployed by default; and permissions that look broad but are limited by resource conditions or service control policies.

How it is fixed

Replace the broad managed policy with a scoped policy that lists only the actions and resources the function needs.

Hunting notes

Over-privileged execution roles hide in sample applications, quick-start templates, CI/CD pipelines, and anything generated by a framework that defaults to convenience. CI/CD means automated build and release pipelines.

Glossary

  • AWS: Amazon Web Services, a cloud platform where you rent computers and services over the internet.
  • Lambda: an AWS service that runs your code on demand without you managing a server.
  • Function: a single piece of code that Lambda runs when triggered.
  • Role: an identity with a set of permissions that a function or service uses automatically when it runs.
  • IAM: Identity and Access Management, AWS's system for identities and permissions.
  • Policy: a written list of which actions are allowed on which resources.
  • Managed policy: a ready-made policy maintained by AWS and attachable to many identities.
  • ARN: Amazon Resource Name, the unique address of an AWS resource or policy.
  • AdministratorAccess: an AWS managed policy that allows every action on every resource.
  • Root: the all-powerful owner account in Unix-like systems; used here as a comparison for full control.
  • Privilege escalation: gaining more rights than you were meant to have.
  • Incorrect privilege assignment: giving an identity more permissions than its task requires.
  • Over-privileged execution role: a role used by running code that holds far more permissions than the code needs.
  • Least privilege: the principle of granting only the permissions actually needed.
  • Permission boundary: a hard ceiling on the maximum permissions a role can ever have.
  • ECS: Elastic Container Service, an AWS service for running containers.
  • Container: a packaged unit of software and its dependencies that runs in isolation.
  • Serverless: a model where you supply code and the provider handles the servers.
  • Infrastructure as code: describing servers and permissions in files so they can be deployed automatically.
  • CI/CD: automated pipelines that build, test and release software.
  • CVSS: a standard 0 to 10 score for the severity of a security flaw.
  • Proof of concept: a practical demonstration that a flaw can actually be exploited.
  • False positive: a finding that looks like a problem but is not, once context is considered.
  • Service control policy: an organisation-level rule in AWS that limits what accounts can do.

More by zolaer9527

View all

2 more disclosed reports, best first.

More from AWS VDP

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.