[Bug]: Hard-Coded BigModel API Key Is Used as a Shared Fallback
预期情况
...
实际情况
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
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.ZrYZlQemFpM2UtaYSettings.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.
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
- AgileConfig (CVE-2022-35540): A hard-coded JWT secret enabled remote attackers to forge tokens and obtain administrator access.
- Veeam Recovery Orchestrator (CVE-2024-29855): A hard-coded JWT secret allowed authentication bypass in affected versions.
- GFI Archiver (CVE-2025-35940): The ASP.NET
ArchiverSpaApiused a hard-coded JWT signing key to access protected endpoints; exploitation required a valid user identifier.
ASP.NET Machine-Key Misuse
- DotNetNuke (CVE-2008-6540): Default validation and decryption keys could remain in
web.configafter installation or upgrade, allowing attackers to bypass intended access restrictions. - Microsoft Exchange Server (CVE-2020-0688): Fixed ASP.NET machine keys let an attacker with Exchange Control Panel access forge ViewState and execute code on the server.
- Gladinet CentreStack/Triofox (CVE-2025-30406): A hard-coded machine key contributed to a ViewState deserialization vulnerability exploited in the wild.
- Sitecore products (CVE-2025-53690): Deployments reusing a publicly documented sample machine key were vulnerable to ViewState deserialization and remote code execution.
- KnowledgeDeliver (CVE-2026-5426): Deployments using the vendor's pre-shared ASP.NET machine key were vulnerable to ViewState deserialization and remote code execution.
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
- 是
Source: STranslate/STranslate