Back to Insights Penetration Testing

The Danger of Exposed API Keys: A Case Study That Could Change the Rules

The Danger of Exposed API Keys: A Case Study That Could Change the Rules

How exposing API keys in application code can lead to severe security breaches
In information security testing, vulnerabilities are often discovered that do not necessarily originate within the application itself, but rather from the insecure use of external resources. In this article, we will discuss a case discovered during an Android application penetration test for one of our clients, where an API key for an external service was found embedded within the application code. This exposure allowed access to sensitive data on the external service and the creation of new users with high-level privileges.

The Key to a Successful Attack – Exposed API Keys
How visible API keys in code can expose the entire system
Many applications utilize external services for various functions, such as payment system integration, logging, or messaging. Occasionally, application developers tend to integrate these API keys directly into the source code—a dangerous practice once the application is distributed to the general public.

Creating Highly Privileged Users in External Services
How the attacker exploited the key to create users with administrative permissions
During the test, we attempted to create a new user using the API key found in the application code. To our surprise, we discovered that it was possible to grant the user full administrative permissions. As a result, we gained access to all of our client’s business correspondence, including attachments and other sensitive information, as well as information regarding additional projects and clients of the software development firm.

Severe Security Implications
How this exposure endangers all corporate systems
The exposure of an API key in the application code led to a breach of a sensitive external service. An attacker could have gained access to critical business information, created new high-privilege users, and even accessed sensitive data belonging to other companies. This vulnerability does not only affect our client but also all other clients of the developing software house.

Insights from IPV Security Cyber Experts
Steps to protect your system from similar breaches:
* Secure Storage of API Keys: API keys should never be embedded in application code in plaintext. It is recommended to use encryption methods or Secrets Management systems.
* Least Privilege Access: Ensure that API keys grant only limited permissions, without access to administrative functions.
* Security Controls for External Services: Every external service should undergo rigorous security testing, and access to it should be monitored continuously.
* Frequent Code Reviews: Periodic security scans of the application code are recommended to identify potential key exposures.

Summary
How protecting API keys can prevent similar exposures
Integrating API keys into visible code is a real danger to system security. The case described highlights the importance of secure key management and restricted access to external services to prevent serious security breaches in the future.

To consult with an expert or to order an application penetration test,

Continue the Conversation

Facing a cybersecurity challenge? Let's talk about how a managed program can strengthen your resilience.

Start a conversation