Facebook Google Plus Twitter LinkedIn YouTube RSS Menu Search Resource - BlogResource - WebinarResource - ReportResource - Eventicons_066 icons_067icons_068icons_069icons_070

Tenable Blog

Subscribe

Access Undenied on AWS

Tenable Cloud Security

Introducing our new open-source tool: Access Undenied on AWS. The tool parses AWS AccessDenied CloudTrail events, explains the reasons for them and offers actionable fixes.

Introducing AWS Access Undenied

Access Undenied on AWS is an open source CLI tool that analyzes AWS CloudTrail AccessDenied events, scans the environment to identify and explain the reasons for the events and offers actionable least-privilege remediation suggestions. Basically, you give the tool a CloudTrail event with an “Access Denied” outcome, and the tool will tell you how to fix it!

Access Undenied for AWS

What’s the problem?

It’s a beautiful day. You’re building a lambda function, and everything is going exactly as planned. The code looks great. Then you give it a test and…

"errorMessage": "An error occurred (AccessDenied) when calling the ListBuckets operation: Access Denied",

As you know, many things in IAM can cause an action to be denied; here’s a partial list:

  • Missing allow in an identity-based policy
  • Explicit deny in an identity-based policy
  • Missing allow in an resource-based policy
  • Explicit deny in an resource-based policy
  • Missing allow in a service control policy
  • Explicit deny in a service control policy
  • Missing allow in a permission boundary
  • Explicit deny in a permission boundary

And we haven’t yet mentioned VPC endpoint policies, session policies or granular service-specific data access controls.

Even once you know the policy type causing “access denied,” you still have to find the policy and the statement inside the policy causing the denial and potentially replace it with a least-privilege alternative.

AWS to the rescue

When we started working on AccessUndenied, AWS access-denied messages had very little detail on the reasons for which access was being denied. In 2021, for easier permissions troubleshooting, AWS introduced changes to access-denied errors. These changes offered more detailed error messages, such as:

User: arn:aws:iam::777788889999:user/JohnDoe is not authorized to perform:
codecommit:ListRepositories with an explicit deny in a service control policy

Further information can be found in the AWS IAM documentation.

These AWS error message updates have significantly improved the ability of users to troubleshoot Access Denied messages. However, we still find significant use cases for an automated strategy for remediating access-denied situations and facilitating access.

But challenges remain

AWS users trying to resolve Access Denied scenarios still encounter many challenges:

  • Some AccessDenied messages still do not provide details. Among the services for which some, or even many, messages are lacking in details are: S3, IAM, STS, CloudWatch, EFS, DynamoDB, Redshift, Opensearch and ACM. For example:

    An error occurred (AccessDenied) when calling the ListBuckets operation: Access Denied

    And here’s another example:

    "User: arn:aws:iam::123456789012:user/username is not authorized to perform: iam:CreateRole on resource: arn:aws:iam::123456789012:role/role-name"
  • When the reason for AccessDenied is an explicit deny, users can have difficulty tracking down the specific policy and statement that give the explicit deny. Specifically, when the reason is an explicit deny in a service control policy (SCP), it is difficult to find and assess every single policy in the organization that applies to the account.
  • When the problem is a missing allow statement, it can still be challenging to create the least-privilege policy that allows the desired access without granting excessive permissions.

Some of these problems are here to stay. For example, it is quite sensible that AWS does not grant unprivileged actors details on the exact content and identity of the service control policies preventing them from acting in a certain way. The need to maintain a balance between easy troubleshooting for builders and opacity to attackers requires that users do some of the work in troubleshooting more complex scenarios.

Access Undenied on AWS – an automated solution

Access Undenied on AWS is a free open source tool that runs completely locally (or in your environment). It analyzes AWS “access denied” events and offers actionable remediation steps to facilitate access. You completely control its permissions and actions, and it does not send data to anyone. You can use it from the command-line interface (CLI) on a local machine on single events, query and download batches of events for analysis or even run it from a lambda function and have a lambda that receives an event and returns the reason that access was denied.

IssueRemediation
Missing allow in an identity-based policyA least-privilege, resource-granular policy for adding and the identity to attach it to.
Missing allow in a permission boundary or an SCPScanning of all relevant SCPs and permission boundaries, which returns a least-privilege resource-granular policy for adding, and the target (organizational unit, organization root, account, or permission boundary) to attach it to
Missing allow in a resource-based policyA least-privilege, principal-granular policy for adding, and the resource to attach it to.
Explicit deny in any type of policy: identity-based, resource-based, service control or permissions boundaryScanning of all relevant policies to find the specific policy and statement causing explicit deny, and the outputting of that policy for the user to remove or rescope.

Full details on the output format can be found in the Access Undenied README.

Challenges

While building this tool we ran into challenges. One of them was in constructing exact permission representations from CloudTrail events. (I made extensive use of Ian Mckay’s iam-dataset project, which we also contribute to). Another challenge was using the basic SimulateCustomPolicy API to simulate more complicated IAM scenarios.

Contributing to Access Undenied

Access Undenied supports resource policies for many resources and some of the most common condition keys, but you can help us and the community make Access Undenied even more awesome by contributing to some good first issues in the repository.

If you stumble across any issues, or wish to suggest features you’d like to see supported in the tool, feel free to open new issues on the GitHub repository.

Feel free to write to me with questions, suggestions and comments.
[email protected] 
Twitter: @NoamDahan

Ready to take it for a spin? Try "Access Undenied" here, or read more about it here.

Related Articles

Cybersecurity News You Can Use

Enter your email and never miss timely alerts and security guidance from the experts at Tenable.

Tenable Vulnerability Management

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy.

Your Tenable Vulnerability Management trial also includes Tenable Lumin and Tenable Web App Scanning.

Tenable Vulnerability Management

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy. Purchase your annual subscription today.

100 assets

Choose Your Subscription Option:

Buy Now

Tenable Vulnerability Management

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy.

Your Tenable Vulnerability Management trial also includes Tenable Lumin and Tenable Web App Scanning.

Tenable Vulnerability Management

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy. Purchase your annual subscription today.

100 assets

Choose Your Subscription Option:

Buy Now

Tenable Vulnerability Management

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy.

Your Tenable Vulnerability Management trial also includes Tenable Lumin and Tenable Web App Scanning.

Tenable Vulnerability Management

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy. Purchase your annual subscription today.

100 assets

Choose Your Subscription Option:

Buy Now

Try Tenable Web App Scanning

Enjoy full access to our latest web application scanning offering designed for modern applications as part of the Tenable One Exposure Management platform. Safely scan your entire online portfolio for vulnerabilities with a high degree of accuracy without heavy manual effort or disruption to critical web applications. Sign up now.

Your Tenable Web App Scanning trial also includes Tenable Vulnerability Management and Tenable Lumin.

Buy Tenable Web App Scanning

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy. Purchase your annual subscription today.

5 FQDNs

$3,578

Buy Now

Try Tenable Lumin

Visualize and explore your exposure management, track risk reduction over time and benchmark against your peers with Tenable Lumin.

Your Tenable Lumin trial also includes Tenable Vulnerability Management and Tenable Web App Scanning.

Buy Tenable Lumin

Contact a Sales Representative to see how Tenable Lumin can help you gain insight across your entire organization and manage cyber risk.

Try Tenable Nessus Professional Free

FREE FOR 7 DAYS

Tenable Nessus is the most comprehensive vulnerability scanner on the market today.

NEW - Tenable Nessus Expert
Now Available

Nessus Expert adds even more features, including external attack surface scanning, and the ability to add domains and scan cloud infrastructure. Click here to Try Nessus Expert.

Fill out the form below to continue with a Nessus Pro Trial.

Buy Tenable Nessus Professional

Tenable Nessus is the most comprehensive vulnerability scanner on the market today. Tenable Nessus Professional will help automate the vulnerability scanning process, save time in your compliance cycles and allow you to engage your IT team.

Buy a multi-year license and save. Add Advanced Support for access to phone, community and chat support 24 hours a day, 365 days a year.

Select Your License

Buy a multi-year license and save.

Add Support and Training

Try Tenable Nessus Expert Free

FREE FOR 7 DAYS

Built for the modern attack surface, Nessus Expert enables you to see more and protect your organization from vulnerabilities from IT to the cloud.

Already have Tenable Nessus Professional?
Upgrade to Nessus Expert free for 7 days.

Buy Tenable Nessus Expert

Built for the modern attack surface, Nessus Expert enables you to see more and protect your organization from vulnerabilities from IT to the cloud.

Select Your License

Buy a multi-year license and save more.

Add Support and Training