API Keys: Do You Know What Is?

Controlling access and ensuring the security of employee and customer data has been one of the biggest security challenges faced by organizations today, and this is intensified when sensitive information and assets are stored where access identifiers are not protected.
Configuring and granting access in cloud environments, for example, has given even the most experienced system administrators a headache. Recently, Imperva, which provides Web Application Firewall (WAF) services – a system that stays between the application server and the internet, protecting against attacks such as SQL Injections, DDoS, and others – gave details on its blog about a security incident that has occurred through the theft of an AWS API key and lead to data being extracted from its customers.
But before talking further on the subject, we need to know some definitions about API keys.
What are API Keys?
First, APIs are instructional codes for an application that allow other software to develop products by adapting the original features to the ways in which their services can be used.
Facebook, Google, Twitter, and other services provide documentation so that their APIs can be used in various applications. As an example, we can mention that when an application offers authentication through a Google account, such application has used a Google API to implement this feature in its code.
Both Google and other API providers use keys to identify and track requests and thus measure how well the application uses their services.
API keys are the access credentials that authorize the use of API-specific features and help prevent their misuse by identifying its permission and sharing necessary data, so the server can block abnormal requests made in association with that API Key.
It is important to mention that the keys identify the application calling the functions and not the user using them. Therefore, they cannot restrict users, but requests, environments, applications, and IPs.
Although there is a possibility of restricting their use, API keys are assets that should be kept secure, as they have no expiration and can be used by anyone who knows them, which becomes a more serious problem when these keys are used to access environments in which critical data is stored.
API Key Storage
Today, many organizations already know the benefits of using the cloud, store data and a lot of sensitive information in this environment, but they use standard or basic configurations that these services offer. In other contexts, they even perform security settings correctly, but when credentials such as accounts, keys, tokens, and other items used to access and handle these environments are not protected, the occurrence of an incident is almost certain.
In the case of AWS – Amazon Cloud Computing Services Platform – access control and keys are integrated into its security. However, many service keys have already been exposed in public repositories or given to developers to expedite task execution, but this is not recommended.
The incident that occurred with Imperva, according to its Chief Technology Officer Kunal Anand, was due to access from an internal instance where the AWS API Key was stored. The chief officer described the decisions that led to the leak:
API keys, in most scenarios, are not the kingdom-wide access keys, but they open the way to the crown jewels. Unfortunately, this valuable item is handled without proper care or relevance, being stored in places accessible to anyone, when instead it should be managed, tracked, protected, and moderately used.
How to Protect API Keys
Protecting any asset in an organization is not a simple task. Some controls, however robust they can be, require additional measures to be effective.
In order to ensure the minimum security of your API Keys, some measures are important:
- Do not put keys in configuration files on the system as they can be found easily.
- Each integration must have its own key.
- Just like credentials and passwords, keys should be changed from time to time, because in case they are compromised, they will be valid for a short time.
- Eliminate keys that are no longer needed to shrink the attack surface.
- Label each key to know which ones work in each application. A key inventory is a good measure.
- API keys should not be emailed so there is no risk of being intercepted.
- Monitor the use of the API for immediate key change when a misuse or abnormal use occurs or is observed.
These and other measures can be taken through a PAM solution, which aims to manage privileged access by using a set of technologies and practices to monitor and manage access to critical data.
A PAM solution can assist in the creation and execution of an access workflow consisting of the request and approval to use the key, as well as requiring authentication for viewing and using the key, preventing an unauthorized user from exploiting it.
As much as API providers make security settings available, organizations should not remain exempt from the responsibility of doing their job to ensure that access and use of assets are done correctly and authentically. In this context, a PAM solution becomes even more necessary when it is up to the organization, not the API provider, to rotate, grant, and revoke the use of keys.
Protecting any kind of access credentials is the foundation for any strategy aimed at securing sensitive information and assets. If accounts, passwords, and keys are not preserved, later controls will not be as effective as they should. It is the implementation of security controls on credentials that will be responsible for reducing the chances of an incident.
REFERENCES
ANAND, Kunal. Security Incident Update. Oct 10, 2019. Available at: https://www.imperva.com/blog/ceoblog/https://www.imperva.com/blog/ceoblog/. Accessed on: Oct 25, 2019.