[Bug]: Hard-Coded BigModel API Key Is Used as a Shared Fallback

Author: 28HusCreated Oct 1, 2026Updated Oct 1, 2026
Labelsbug

预期情况

...

实际情况

Hard-Coded BigModel API Key Is Used as a Shared Fallback

Hello STranslate maintainers,

The BigModel plugin silently uses a hard-coded API key whenever Settings.ApiKey is empty. New settings default to an empty key, so users who do not configure their own key share this credential. Anyone can recover it from the public source and sign API requests as the same BigModel account. If the credential remains active, this can allow unauthorized API usage and consume that account's balance or resource quota.

CWE-798 — Use of Hard-coded Credentials. Impact is conditional on the provider still accepting this key and the account having usable quota or balance. This review did not send a live API request, so current credential validity and account balance are unverified.

This is a third-party API credential and resource-consumption risk, not an STranslate login or authorization bypass. The plugin sends the text selected for translation to BigModel by design. This source review found no path from this key to STranslate accounts or other users' data.

Evidence

Image

At the reviewed main revision (75f616a257bcf34d78d8929152fb579886d1d8e5), Main.cs#L16-L17 stores the credential as character codes and reconstructs a Base64 string. Decoding it yields this API key:

fa82c39704535a86961cb2fe9d499928.ZrYZlQemFpM2UtaY

Settings.cs#L5-L6 defaults ApiKey to an empty string and the URL to https://open.bigmodel.cn/. On first load, the plugin storage creates settings from the default model (PluginContext.cs#L43-L53, StorageBase.cs#L141-L181).

Main.cs#L167-L176 substitutes the fallback whenever the configured key is blank, signs a bearer JWT, and sends the translation request. BigModelAuthenication.cs#L9-L38 places the API key ID in the token and signs it with the secret using HS256. The same fallback is used by the settings validation action (SettingsViewModel.cs#L158-L167).

BigModel's first-party authentication guidance describes this {id}.{secret} key format and warns against exposing API keys in client applications (MetaGLM client authentication guide). BigModel documents that API calls can consume cash balance and resource packages (usage and benefits).

Proof of Concept

This locally creates a bearer token using the committed credential. It does not send a request to BigModel.

python
import time
import jwt

api_key = "fa82c39704535a86961cb2fe9d499928.ZrYZlQemFpM2UtaY"
key_id, secret = api_key.split(".", 1)
now = int(time.time())
token = jwt.encode(
    {"api_key": key_id, "exp": now + 3600, "timestamp": now},
    secret,
    algorithm="HS256",
    headers={"sign_type": "SIGN"},
)
print(token)

Remediation

Remove the embedded fallback. Require each user to provide their own API key and fail closed when it is empty. Revoke or rotate the exposed key with BigModel. If shared access is an intended feature, place the credential behind a controlled service with per-user authentication, quotas, and abuse monitoring; a desktop client cannot keep a shipped key secret.

Related Works

Hard-Coded JWT Signing Secrets

ASP.NET Machine-Key Misuse

This report is part of my ongoing research. If you have any questions, please feel free to reach out or tag me here. I would be glad if this small contribution could help improve the security of STranslate.

复现方法

...

日志信息

...

额外信息

...

使用的版本号

2.0.10

我确认已更新至最新版本

  • 是

我确认已查询历史issues

  • 是