How to Prevent Code Injection Vulnerabilities in Serverless Applications (Part 1/2)
Recently Serverless application architectures are a trending model for web application development. This is …
In November 2020, an outage of Amazon Web Services (AWS) in the us-east-1 region rendered Roomba vacuum cleaners, Ring doorbells, and even Christmas lights dysfunctional for thousands of people in the US. For one full day, popular websites like Flickr, Adobe, and the Washington Post were unreachable.1
It didn’t take long for people to tweet about the issue :)
My f—ing doorbell doesn’t work because AWS us-east-1 is having issues
I… can’t vacuum… because us-east-1 is down
While this incident might seem funny at first, it is also a true testament of how extremely dependent we are on cloud computing nowadays.
In fact, within the last 15 years, cloud computing has become a must-have for almost every company developing or using software.
As an increasing number of organizations rely on cloud services or even start to go full cloud-native, cloud security has become a hot topic in the security community.
Unfortunately, the amount of cyber-attacks targeting cloud systems has also increased.
To raise awareness of the threats that lurk in the cloud world, below we present five common security threats in the cloud and illustrate their risks with real-world examples. The five identified threats are based on the Cloud Security Alliance Report Top Threats to Cloud Computing - The Egregious 112, the OWASP Serverless Top 103, and the Cloud Native Computing Foundation Security Whitepaper4:
A leading cause of data breaches are cloud (security) misconfigurations, enabling data breaches, or the corruption of company networks. Cloud resources like micro-services, object and database storage solutions, or networking components are the subject of such misconfiguration. Typical examples of misconfigurations are:
Such issues are a concern in cloud environments as in any other architecture. Nevertheless, the fast pace at which cloud infrastructure regularly changes, makes it difficult to find and control these issues. Whereas in traditional applications changes in the infrastructure and assets involved multiple roles and approvals to reach production, the cloud infrastructure is much more flexible and dynamic. Modern technologies and tools for provisioning, maintaining, and changing an infrastructure like Infrastructure-as-Code enable rapid changes in the infrastructure.
The use of multiple cloud providers and the combination of private and public clouds, surely does not make tracking down misconfigurations easy.
Since misconfigurations are easy to make but difficult to spot in complex cloud environments, they are the root cause of several recent and massive data breaches. In the following, we can only present a small subset of data breaches showing the impact of misconfigurations.
In 2018, an unsecured Elasticsearch database of the marketing company Exactis exposed nearly 340 million individual records containing personal information of American adults as well as millions of businesses. The database server was erroneously configured to be publicly accessible.5
In 2019, the personal information of thousands of hotel guests including members of the US government and military was publicly exposed due to an open Elasticsearch database of AutClerk, which is a combined reservations system for hotels, accommodation providers, travel agencies.6
In 2020, the personal and payment information of 7 million users of the mobile payment app Bharat Interface Money (BHIM) was exposed. The breach was caused by a misconfigured AWS S3 bucket. In fact, user data was stored unencrypted on a publicly accessible S3 bucket, making it vulnerable to misuse for frauds and theft.7
In 2020, the companies Advantage Capital Funding and Argus Capital Funding didn’t set up encryption, authentication, or access credentials for their database, which contained highly sensitive financial and personal data. As a result, almost half a million gigabytes of confidential legal and financial documents were leaked.8
Even a simple cloud-native application can consist of dozens or hundreds of micro-services. Each reading, writing, and updating different databases, object storage, data streams, and APIs. A secure orchestration of the micro-services and assets requires a careful access control configuration for each of the resources, which is tedious. However, attackers target over-permissioned cloud resources to escalate their privileges and to gain unauthorized access to other resources in the account rather than having control over these resources directly. Unnecessary cloud resources or excessive permissions on resources are a potential backdoor that can lead to data leakage from not only the over-permissioned resources themselves but also from their related resources. And, in the worst-case, they may even give an attacker full control over cloud resources or the whole account.
An example in which an over-permissioned cloud resource caused a massive data breach is the Capital One hack. In 2019, an attacker gained access to 80,000 account numbers, 140,000 Social Security numbers, and 1 million Canadian Social Insurance Numbers by abusing an over-permissioned web application firewall (WAF).
By abusing the over-permissioned WAF the attacker could craft a Server-Side-Request Forgery (SSRF) attack to steal the data.
The attack involved multiple steps visualized in the figure and described in a report of the MIT9, which we cite here:
One of the biggest threats to cloud security is human error when handling credentials or sensitive information. Sensitive data like secrets, access tokens, and passwords can be accidentally uploaded to a Git repo, put on a public bucket, or even hard-coded in application code. Since cloud systems are often globally and publicly available, stolen credentials can be easily abused by attackers. Typical examples are:
In 2014, attackers scraped public GitHub repositories for cloud service credentials and hijacked accounts to mine cryptocurrency at other people’s expense. The attackers were able to discover and misuse the cloud service provider credentials within 36 hours of the credentials being pushed to GitHub accidentally.10
Almost every cloud application exposes its services in the form of APIs or UIs. Since they act as the front door of the system, they are attacked and scanned continuously. Thus, the API of each system must follow established security guidelines and all APIs must be protected by adequate means of authentication and authorization.
In 2018, Facebook experienced a breach that was the result of a credential theft vulnerability introduced as a feature back in 2017. This breach affected more than 50 million accounts. Facebook admitted that it didn’t know what information was stolen, nor how many user accounts were compromised.
This threat is neither bound to cloud applications nor cloud environments, but a general threat every application developer and security expert should be aware of. Nowadays, applications are not re-written from scratch but contain a sustainable amount of third-party/open-source libraries and frameworks to execute the desired tasks. Even for commercial applications easily as much as 75% of the code comes from open-source libraries and frameworks.11 Vulnerabilities in the used (open-source) components are a common risk and attackers target applications that make use of vulnerabilities in included open-source components, as they are easy to exploit - often even publicly accessible exploits exist.
An (in)famous example, which shows the impact of vulnerable libraries, is the data breach of the largest consumer credit reporting agency Equifax in 2017.1213 Attackers exploited a vulnerability (CVE-2017-5638) in the open-source framework Apache Struts2 - which had already been patched but not updated on Equifax’s server - to gain access to the corporate network. The attackers pulled personal data including Social Security numbers, birth dates, and residential addresses of an estimated 152 million American, 44 million British, and 8000 Canadian residents. In the end, the data breach cost Equifax more than 1.7 billion US dollar and Equifax’s Chief Security Officer (CSO) and Chief Information Officer (CIO) resigned.
https://www.dailymail.co.uk/sciencetech/article-8994907/Widespread-Amazon-cloud-service-outage-disables-Roombas-Ring-doorbells-Christmas-lights.html ↩︎
Cloud Security Alliance (CSA), Report 2020, Top Threats to Cloud Computing - The Egregious 11 ↩︎
Cloud Native Computing Foundation (CNCF), Report 2020, Security Whitepaper ↩︎
https://www.wired.com/story/exactis-database-leak-340-million-records/ ↩︎
https://www.itpro.co.uk/security/34671/us-military-data-exposed-in-179gb-autoclerk-leak ↩︎
https://www.newindianexpress.com/nation/2020/jun/01/hackers-claim-to-have-found-vulnerability-in-bhim-app-npci-denies-data-compromise-2150840.html ↩︎
https://www.zdnet.com/article/financial-apps-leak-425gb-in-company-data-through-open-database/ ↩︎
MIT, A Case Study of the Capital One Data Breach, http://web.mit.edu/smadnick/www/wp/2020-16.pdf ↩︎ ↩︎
https://www.forbes.com/sites/runasandvik/2014/01/14/attackers-scrape-github-for-cloud-service-credentials-hijack-account-to-mine-virtual-currency/?sh=4e9c9e263196 ↩︎
L. Heinemann et al., On the extent and nature of software reuse in open source java projects ↩︎
https://medium.com/cloud-security/cves-security-vulnerabilities-1830aee64904 ↩︎
Recently Serverless application architectures are a trending model for web application development. This is …
Within the last 15 years, cloud computing has become a must-have for almost every company developing or using …
This article is Part 2 of a series. Here, I’m going to explain how to secure Serverless applications from …