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
'PowerSnitch' Hacks Androids via Power Banks
Kelly Jackson Higgins, Executive Editor at Dark Reading,  12/8/2018
Windows 10 Security Questions Prove Easy for Attackers to Exploit
Kelly Sheridan, Staff Editor, Dark Reading,  12/5/2018
Starwood Breach Reaction Focuses on 4-Year Dwell
Curtis Franklin Jr., Senior Editor at Dark Reading,  12/5/2018
Register for Dark Reading Newsletters
White Papers
Video
Cartoon Contest
Write a Caption, Win a Starbucks Card! Click Here
Latest Comment: New camera 2FA closed loop!
Current Issue
10 Best Practices That Could Reshape Your IT Security Department
This Dark Reading Tech Digest, explores ten best practices that could reshape IT security departments.
Flash Poll
Twitter Feed
Dark Reading - Bug Report
Bug Report
Enterprise Vulnerabilities
From DHS/US-CERT's National Vulnerability Database
CVE-2018-20059
PUBLISHED: 2018-12-11
jaxb/JaxbEngine.java in Pippo 1.11.0 allows XXE.
CVE-2018-20056
PUBLISHED: 2018-12-11
An issue was discovered in /bin/boa on D-Link DIR-619L Rev.B 2.06B1 and DIR-605L Rev.B 2.12B1 devices. There is a stack-based buffer overflow allowing remote attackers to execute arbitrary code without authentication via the goform/formLanguageChange currTime parameter.
CVE-2018-20057
PUBLISHED: 2018-12-11
An issue was discovered in /bin/boa on D-Link DIR-619L Rev.B 2.06B1 and DIR-605L Rev.B 2.12B1 devices. goform/formSysCmd allows remote authenticated users to execute arbitrary OS commands via the sysCmd POST parameter.
CVE-2018-20058
PUBLISHED: 2018-12-11
In Evernote before 7.6 on macOS, there is a local file path traversal issue in attachment previewing, aka MACOSNOTE-28634.
CVE-2018-20050
PUBLISHED: 2018-12-10
Mishandling of an empty string on the Jooan JA-Q1H Wi-Fi camera with firmware 21.0.0.91 allows remote attackers to cause a denial of service (crash and reboot) via the ONVIF GetStreamUri method and GetVideoEncoderConfigurationOptions method.