我发现了39个Algolia管理密钥暴露在开源文档站点上。
I Found 39 Algolia Admin Keys Exposed Across Open Source Documentation Sites

原始链接: https://benzimmermann.dev/blog/algolia-docsearch-admin-keys

一名安全研究人员在使用DocSearch(一项免费搜索服务)时,在大量开源文档站点中发现了39个暴露的Algolia管理API密钥。这些密钥原本仅用于搜索,却授予了完全控制权——包括修改、删除甚至清除整个搜索索引的能力,从而带来了恶意链接注入和完全搜索中断等风险。 该研究人员通过对超过15,000个站点的前端抓取、GitHub代码搜索以及已提交代码历史的分析,发现了这些密钥。值得注意的是,35个密钥*仅*通过抓取已部署的前端代码发现。受影响的项目包括Home Assistant、KEDA和vcluster等知名项目。 一些项目,如SUSE/Rancher,已经迅速解决了这个问题,而另一些项目,包括Home Assistant,尚未撤销受损的密钥。Algolia已被直接通知,但尚未回应。根本原因在于项目在前端DocSearch配置中无意使用了管理密钥,尽管Algolia已经发布了警告。该研究人员强调,可能存在更多暴露的密钥,并敦促项目验证他们是否在使用仅搜索的API密钥。

一位安全研究人员在各种开源文档站点上发现了39个暴露的Algolia管理密钥,并在Hacker News上报告了此事。 这篇帖子引发了关于负责任的披露和安全实践的讨论。 评论者指出这些密钥可能被滥用,并强调了GitHub的密钥扫描功能,如果提供商与GitHub合作,它可以自动使提交的密钥失效。 一位评论员指出这是必然的,而其他人则澄清说,其意图是建议在公开披露之前使用GitHub Gist作为主动安全措施。 值得注意的是,Algolia似乎尚未实施与GitHub密钥扫描的集成。 这次讨论强调了安全密钥管理的重要性以及快速解决开源项目中广泛暴露问题的挑战。
相关文章

原文

Last October I reported an exposed Algolia admin API key on vuejs.org. The key had full permissions: addObject, deleteObject, deleteIndex, editSettings, the works. Vue acknowledged it, added me to their Security Hall of Fame, and rotated the key.

That should have been the end of it. But it got me thinking: if Vue.js had this problem, how many other DocSearch sites do too?

Turns out, a lot.

How Algolia DocSearch works

Algolia's DocSearch is a free search service for open source docs. They crawl your site, index it, and give you an API key to embed in your frontend. That key is supposed to be search-only, but some ship with full admin permissions.

What I found

Most keys came from frontend scraping. Algolia maintains a public (now archived) repo called docsearch-configs with a config for every site in the DocSearch program, over 3,500 of them. I used that as a starting target list and scraped roughly 15,000 documentation sites for embedded credentials. This catches keys that don't exist in any repo because they're injected at build time and only appear in the deployed site:

APP_RE = re.compile(r'["\']([A-Z0-9]{10})["\']')
KEY_RE = re.compile(r'["\']([\da-f]{32})["\']')

def extract(text, app_ids, api_keys):
    if not ALGOLIA_RE.search(text):
        return
    for a in APP_RE.findall(text):
        if valid_app(a):
            app_ids.add(a)
    api_keys.update(KEY_RE.findall(text))

On top of that I ran GitHub code search to find keys in doc framework configs, then cloned and ran TruffleHog on 500+ documentation site repos to catch keys that had been committed and later removed.

Discovery Method Breakdown

35 of the 39 admin keys came from frontend scraping alone. The remaining 4 were found through git history. Every single one was active at the time of discovery.

The affected projects include some massive open source projects:

Top Affected Projects by GitHub Stars

Home Assistant alone has 85,000 GitHub stars and millions of active installations. KEDA is a CNCF project used in production Kubernetes clusters. vcluster, also Kubernetes infrastructure, had the largest search index of any affected site at over 100,000 records.

What these keys can do

Admin Key Permissions

Nearly all 39 keys share the same permission set: search, addObject, deleteObject, deleteIndex, editSettings, listIndexes, and browse. A few have even broader access including analytics, logs, and NLU capabilities.

In practical terms, anyone with one of these keys can:

  • Add, modify, or delete any record in the search index
  • Delete the entire index
  • Change index settings and ranking configuration
  • Browse and export all indexed content

Someone could poison a project's search results with malicious links, redirect users to phishing pages, or just nuke the entire index and wipe out search for the site completely.

Disclosure

SUSE/Rancher acknowledged the report within two days and rotated the key. That key is now fully revoked. Home Assistant also responded and began remediation, though the original key remains active.

I compiled the full list of affected keys and emailed Algolia directly a few weeks ago. No response. As of today, all remaining keys are still active.

The root cause

This isn't really about 39 individual misconfigurations. Algolia's DocSearch program provides search-only keys, but many sites run their own crawler and end up using their write or admin key in the frontend config instead. Algolia's own docs warn against this, but it clearly happens at scale.

The fix is straightforward: if you're running DocSearch, check what key is in your frontend config and make sure it's search-only. If I found 39 admin keys with a few scripts, the real number is almost certainly higher.

联系我们 contact @ memedata.com