Secret leaks often occur when a sensitive piece of authentication data is stored with the source code of an application. Considering the source code is intended to be deployed across multiple assets, including source code repositories or application hosting servers, the secrets might get exposed to an unintended audience.

Why is this an issue?

In most cases, trust boundaries are violated when a secret is exposed in a source code repository or an uncontrolled deployment environment. Unintended people who don’t need to know the secret might get access to it. They might then be able to use it to gain unwanted access to associated services or resources.

The trust issue can be more or less severe depending on the people’s role and entitlement.

What is the potential impact?

Adafruit IO provides an API that allows you to interact with IoT devices. The API can be used to store data, trigger webhook notifications, or modify the layout and information shown on user dashboards.

Below are some real-world scenarios that illustrate some impacts of an attacker exploiting the secret.

Exceeding rate limits

Using a leaked secret, an attacker may be able to make hundreds or thousands of authenticated calls to an online service. It is common for online services to enforce a rate limit to prevent their servers from being overwhelmed.

If an attacker is able to exceed a user-based rate limit, they may be able to cause a denial of service for the user. If this continues over a long period of time, the user may also be subject to additional fees or may have their account terminated.

Chaining of vulnerabilities

Triggering arbitrary workflows can lead to problems ranging from a denial of service to worse, depending on how the webhook’s data is handled. If the webhook performs a specific action that is affected by a vulnerability, the webhook acts as a remote attack vector on the enterprise.

Components affected by this webhook could, for example, experience unexpected failures or excessive resource consumption. If it is a single point of failure (SPOF), this leak is critical.

Modification of application data

Applications may rely on data that cannot be distributed with the application code. This may be due to the size of the data, or because the data is regularly updated. This data is downloaded by the application as it is needed.

If an attacker can gain access to an authentication secret, they may be able to alter or delete this application data. This may cause parts of the application to misbehave or stop working. Maliciously altered data could also contain undesirable content which results in reputational damage.

How to fix it

Revoke the secret

Revoke any leaked secrets and remove them from the application source code.

Before revoking the secret, ensure that no other applications or processes are using it. Other usages of the secret will also be impacted when the secret is revoked.

Use a secret vault

A secret vault should be used to generate and store the new secret. This will ensure the secret’s security and prevent any further unexpected disclosure.

Depending on the development platform and the leaked secret type, multiple solutions are currently available.

Code examples

Noncompliant code example

props.set("adafruit-io-key", "aio_XFKJb9078YvbkljV0879vhjkj7G4") // Noncompliant

Compliant solution

props.set("adafruit-io-key", System.getenv("ADAFRUIT_IO_KEY"))

Resources

Documentation

Standards