Dark Reading is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them.Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.

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
US Turning Up the Heat on North Korea's Cyber Threat Operations
Jai Vijayan, Contributing Writer,  9/16/2019
Fed Kaspersky Ban Made Permanent by New Rules
Dark Reading Staff 9/11/2019
NetCAT Vulnerability Is Out of the Bag
Dark Reading Staff 9/12/2019
Register for Dark Reading Newsletters
White Papers
Video
Cartoon Contest
Current Issue
7 Threats & Disruptive Forces Changing the Face of Cybersecurity
This Dark Reading Tech Digest gives an in-depth look at the biggest emerging threats and disruptive forces that are changing the face of cybersecurity today.
Flash Poll
The State of IT Operations and Cybersecurity Operations
The State of IT Operations and Cybersecurity Operations
Your enterprise's cyber risk may depend upon the relationship between the IT team and the security team. Heres some insight on what's working and what isn't in the data center.
Twitter Feed
Dark Reading - Bug Report
Bug Report
Enterprise Vulnerabilities
From DHS/US-CERT's National Vulnerability Database
CVE-2019-16199
PUBLISHED: 2019-09-17
eQ-3 Homematic CCU2 before 2.47.18 and CCU3 before 3.47.18 allow Remote Code Execution by unauthenticated attackers with access to the web interface via an HTTP POST request to certain URLs related to the ReGa core process.
CVE-2019-16391
PUBLISHED: 2019-09-17
SPIP before 3.1.11 and 3.2 before 3.2.5 allows authenticated visitors to modify any published content and execute other modifications in the database. This is related to ecrire/inc/meta.php and ecrire/inc/securiser_action.php.
CVE-2019-16392
PUBLISHED: 2019-09-17
SPIP before 3.1.11 and 3.2 before 3.2.5 allows prive/formulaires/login.php XSS via error messages.
CVE-2019-16393
PUBLISHED: 2019-09-17
SPIP before 3.1.11 and 3.2 before 3.2.5 mishandles redirect URLs in ecrire/inc/headers.php with a %0D, %0A, or %20 character.
CVE-2019-16394
PUBLISHED: 2019-09-17
SPIP before 3.1.11 and 3.2 before 3.2.5 provides different error messages from the password-reminder page depending on whether an e-mail address exists, which might help attackers to enumerate subscribers.