Cloud

10/25/2018
10:30 AM
Caleb Sima
Caleb Sima
Commentary
Connect Directly
Twitter
LinkedIn
RSS
E-Mail vvv
50%
50%

Securing Severless: Defend or Attack?

The best way to protect your cloud infrastructure is to pay attention to the fundamentals of application security, identity access management roles, and follow configuration best-practices.

Part one of a two-part series. Click here to read Ory Segal’s Securing Serverless: Attacking an AWS Account  via a Lambda Function

Lambdashell started as a debate between myself and a friend. His questions were, How do I secure serverless? What vendors can solve this? On the other hand, I took a different perspective and my questions were, Is serverless a security problem? Do you need to secure serverless? What is the actual risk? What are the actual attacks against serverless?

To settle this debate I decided to create www.lambdashell.com, which is a serverless function that is a security nightmare. The function takes a command and goes straight to a command shell. It is remote command execution right into an AWS infrastructure and could be considered the worst security move anyone could make. I then placed a bounty of $1,000 to be able to find an issue in Lambda. Pointed the Internet to it and sat back and watched it play out.

The attacks came in fast and furious — various methods were attempted to break out of lambda or access something outside of the very contained environment. The only issues that came up were "denial of wallet" attacks , where you can write millions of logs, or execute the function millions of times to cause cost of usage to rise. This, by far, became the biggest headache:  putting in preventative controls to ensure that the functionality and purpose of the project were not impaired while also maintaining cost control.

As the project ran, no attackers were unable to do anything of real interest. At this point I started going in and adding more real world scenarios and settings. I added a command history to the page to show what commands attackers were using. This required adding a database and multiple other lambda functions. I changed default permissions to be more permissive, allowing full access to S3 buckets and other execution permissions. I ensured that input for the commands were unfiltered so that injection attacks against the database were possible. At this point I was trying my hardest to enable an attacker to take over my account.

After making these changes and after having my site posted on hackernews ,  I finally started seeing some real attacks. The most fascinating were attempts at running cryptominers — even though the execution was limited to a three seconds before the process was killed. Attackers would continually run jobs in these three-second increments to mine crypto.

My next attack was against loose permissions on AWS logfiles. The attacks started filling up logs and attempting to overwrite existing logs. The one attack that finally succeeded was by Ory Segal, CTO and co-founder at Puresec, who identified that the lambda function had full permission to the S3 bucket that the site ran on. I had hoped that someone would find this and embed something fun in the main page of the site such as a crypto miner. Unfortunately, they ended up deleting the site completely. 

At this point the issue was found, so I restored the site, removed the full write permission, and logged it as the first real finding since putting this out there.

What I learned from this experience re-enforces my feeling about security. Everything is about the fundamentals. At the end of the day, a strong defense is not merely about the newest tech. It's the basic plumbing and wiring around that tech that gives you your biggest bang for the buck. Pay attention to IAM (identity and access management) roles and configuration. If these are done correctly, it sets up a great blast container so even if something horrific happens, (such as remote command execution in your lambda function) the attacker has a very hard time going anywhere else. And even if they can — they will make a lot of noise doing it.

Related Content:

 

Black Hat Europe returns to London Dec 3-6 2018  with hands-on technical Trainings, cutting-edge Briefings, Arsenal open-source tool demonstrations, top-tier security solutions and service providers in the Business Hall. Click for information on the conference and to register.

Caleb Sima has been engaged in the Internet security arena since 1994 and has become widely recognized as a leading expert in web security, penetration testing and the identification of emerging security threats. His pioneering efforts and expertise have helped define the web ... View Full Bio
Comment  | 
Print  | 
More Insights
Comments
Newest First  |  Oldest First  |  Threaded View
Crowdsourced vs. Traditional Pen Testing
Alex Haynes, Chief Information Security Officer, CDL,  3/19/2019
New Mirai Version Targets Business IoT Devices
Dark Reading Staff 3/19/2019
Register for Dark Reading Newsletters
White Papers
Video
Cartoon Contest
Write a Caption, Win a Starbucks Card! Click Here
Latest Comment: Reading Schneier's Friday Squid Blog again?
Current Issue
5 Emerging Cyber Threats to Watch for in 2019
Online attackers are constantly developing new, innovative ways to break into the enterprise. This Dark Reading Tech Digest gives an in-depth look at five emerging attack trends and exploits your security team should look out for, along with helpful recommendations on how you can prevent your organization from falling victim.
Flash Poll
The State of Cyber Security Incident Response
The State of Cyber Security Incident Response
Organizations are responding to new threats with new processes for detecting and mitigating them. Here's a look at how the discipline of incident response is evolving.
Twitter Feed
Dark Reading - Bug Report
Bug Report
Enterprise Vulnerabilities
From DHS/US-CERT's National Vulnerability Database
CVE-2019-6149
PUBLISHED: 2019-03-18
An unquoted search path vulnerability was identified in Lenovo Dynamic Power Reduction Utility prior to version 2.2.2.0 that could allow a malicious user with local access to execute code with administrative privileges.
CVE-2018-15509
PUBLISHED: 2019-03-18
Five9 Agent Desktop Plus 10.0.70 has Incorrect Access Control (issue 2 of 2).
CVE-2018-20806
PUBLISHED: 2019-03-17
Phamm (aka PHP LDAP Virtual Hosting Manager) 0.6.8 allows XSS via the login page (the /public/main.php action parameter).
CVE-2019-5616
PUBLISHED: 2019-03-15
CircuitWerkes Sicon-8, a hardware device used for managing electrical devices, ships with a web-based front-end controller and implements an authentication mechanism in JavaScript that is run in the context of a user's web browser.
CVE-2018-17882
PUBLISHED: 2019-03-15
An Integer overflow vulnerability exists in the batchTransfer function of a smart contract implementation for CryptoBotsBattle (CBTB), an Ethereum token. This vulnerability could be used by an attacker to create an arbitrary amount of tokens for any user.