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
Where Businesses Waste Endpoint Security Budgets
Kelly Sheridan, Staff Editor, Dark Reading,  7/15/2019
US Mayors Commit to Just Saying No to Ransomware
Robert Lemos, Contributing Writer,  7/16/2019
Register for Dark Reading Newsletters
White Papers
Video
Cartoon Contest
Current Issue
Building and Managing an IT Security Operations Program
As cyber threats grow, many organizations are building security operations centers (SOCs) to improve their defenses. In this Tech Digest you will learn tips on how to get the most out of a SOC in your organization - and what to do if you can't afford to build one.
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-2002-0390
PUBLISHED: 2019-07-21
** REJECT ** DO NOT USE THIS CANDIDATE NUMBER. ConsultIDs: CVE-2002-0639. Reason: This candidate is a reservation duplicate of CVE-2002-0639. Notes: All CVE users should reference CVE-2002-0639 instead of this candidate. All references and descriptions in this candidate have been removed to prevent ...
CVE-2018-17210
PUBLISHED: 2019-07-20
An issue was discovered in PrinterOn Central Print Services (CPS) through 4.1.4. The core components that create and launch a print job do not perform complete verification of the session cookie that is supplied to them. As a result, an attacker with guest/pseudo-guest level permissions can bypass t...
CVE-2019-12934
PUBLISHED: 2019-07-20
An issue was discovered in the wp-code-highlightjs plugin through 0.6.2 for WordPress. wp-admin/options-general.php?page=wp-code-highlight-js allows CSRF, as demonstrated by an XSS payload in the hljs_additional_css parameter.
CVE-2019-9229
PUBLISHED: 2019-07-20
An issue was discovered on AudioCodes Mediant 500L-MSBR, 500-MBSR, M800B-MSBR and 800C-MSBR devices with firmware versions F7.20A to F7.20A.251. An internal interface exposed to the link-local address 169.254.254.253 allows attackers in the local network to access multiple quagga VTYs. Attackers can...
CVE-2019-12815
PUBLISHED: 2019-07-19
An arbitrary file copy vulnerability in mod_copy in ProFTPD up to 1.3.5b allows for remote code execution and information disclosure without authentication, a related issue to CVE-2015-3306.