1,681 Exposed HuggingFace Tokens Put AI Repositories at Risk
Terminator AI security By What The Future Newsroom · December 5, 2023 · 2 min read

1,681 Exposed HuggingFace Tokens Put AI Repositories at Risk

Lasso Security says it found 1,681 exposed HuggingFace API tokens, including access linked to major organizations and widely used AI repositories. The team warned that compromised tokens could enable model tampering, dataset poisoning, and access to private models and datasets.

Exposed API tokens can give someone the ability to change or retrieve data inside a software platform. An investigation by cybersecurity startup Lasso Security found 1,681 such tokens in GitHub and HuggingFace repositories, including tokens associated with Meta, Microsoft, Google, and VMware.

“Exposed tokens could enable model tampering, dataset poisoning, and access to private AI assets.”Why it scores Terminator

Why these tokens matter

HuggingFace hosts AI models and datasets used by developers, including Meta’s Llama models. Its API lets developers and organizations integrate models and read, create, modify, or delete repositories and files, depending on the access granted to a token.

That range of permissions makes an exposed token more than a misplaced credential. If it allows changes, someone who obtains it could potentially alter material that other developers rely on. If it permits reading private resources, it could expose models or datasets that were not intended to be public.

Lasso said its search gave the team full access to repositories associated with Meta Llama, Bloom, Pythia, and HuggingFace. The finding highlights how a secret embedded in code or a public repository can connect to resources far beyond the file where it appears.

Three risks identified by the investigators

Lasso described several ways exposed tokens could affect users and organizations:

  • Model supply chain risk: Someone with access to accounts such as Meta Llama2, BigScience Workshop, and EleutherAI could potentially change existing models. If altered models were then used by others, the effects could reach applications built on them.
  • Dataset poisoning: Lasso reported write access to 14 datasets with tens and hundreds of thousands of downloads per month. Changes to trusted training data could affect the integrity of models built from those datasets.
  • Private asset exposure: The team said it used the method to access more than ten thousand private AI models and more than 2,500 datasets. Such access could cause economic losses, weaken competitive advantage, or reveal sensitive information.

These are potential consequences described by Lasso, rather than claims that attackers had already carried them out. The central concern is that a credential with broad permissions could make trusted AI resources vulnerable to unauthorized changes or access.

How organizations can reduce exposure

Lasso advised developers not to store API tokens directly in code. Hard-coding a token can make it easier for the credential to appear in a repository or other searchable material. Keeping tokens out of code reduces that particular exposure route.

Organizations can also classify tokens and use security tools that inspect development environments and code reviews. These checks can help identify credentials before code is shared and help teams understand which tokens grant access to sensitive resources.

For HuggingFace, Lasso recommended ongoing scans for publicly exposed API tokens, followed by revocation or notification to the affected users and organizations. That approach would address credentials already exposed as well as help limit the time they remain usable.

What the findings mean for AI development

AI projects often depend on shared models and datasets, so access controls matter across the development chain. A token that allows repository changes can put downstream users at risk if they rely on an altered model or dataset without knowing it.

The investigation underscores the need to treat API tokens as powerful credentials: keep them out of code, review where they are stored, and act promptly when exposure is found. For teams building with HuggingFace resources, protecting access is part of protecting the integrity of the models and data their applications depend on.

← Back to the wire

Read next