Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2026-127222-sglang — Missing Authorization on sglang /load_lora_adapter_from_tensors endpoint (CVE-2026-127222) | Kitploit
Tools/GitHubGitHub/rahulreddykarne/cve-2026-127222-sglang
Authentication & AuthorizationStatic AnalysisVulnerability AnalysisWeb SecurityLearning & EducationAPI Security
GitHubrahulreddykarne/cve-2026-127222-sglang

CVE-2026-127222-sglang

Share

Missing Authorization on sglang /load_lora_adapter_from_tensors endpoint (CVE-2026-127222)

View Repository
2 days agoNot yet reviewed

CVE-2026-127222: Missing Authorization on sglang's /load_lora_adapter_from_tensors Endpoint

Affected: sglang 0.5.8 through 0.5.21 (inclusive)

Fixed in: 0.5.22

CWE: CWE-862 (Missing Authorization)

Component: sglang.srt.entrypoints.http_server → POST /load_lora_adapter_from_tensors

Reported by: Rahul Karne

CNA: VulnCheck


Summary

sglang's HTTP server protects its administrative endpoints with a per-route authorization decorator, @auth_level(AuthLevel.ADMIN_OPTIONAL), enforced by an ASGI middleware.

The endpoint POST /load_lora_adapter_from_tensors is missing that decorator, while both of its sibling LoRA endpoints (/load_lora_adapter and /unload_lora_adapter) have it.

Because an undecorated route resolves to the default AuthLevel.NORMAL, the endpoint does not receive the same authorization treatment as the other LoRA administrative endpoints. In affected key configurations this allows an administrative action to be invoked without the expected credential.

This was a day-one defect: the endpoint and the @auth_level system were both introduced in 0.5.8, and this endpoint was the single administrative route that shipped without the decorator.


Impact

/load_lora_adapter_from_tensors is an administrative endpoint that loads a LoRA adapter into the running model from caller-supplied data. Invoking it without authorization allows an unauthorized caller to:

  • Load attacker-chosen LoRA adapters into the served model, tampering with model behavior and outputs for all users of the instance.
  • Exercise the adapter-loading code path (including its deserialization of the supplied tensor payload) that is intended to be reachable only by an administrator.

The authorization defect is independent of, and compounds, any weakness in the downstream payload-handling code: an endpoint that is supposed to require an admin credential should never be reachable without one.


Affected Configurations (important — read this)

The practical effect of the missing decorator depends on how the server's API keys are configured. This report is deliberately precise about that, because the issue is not "always unauthenticated for everyone."

Server configuration/load_lora_adapter (sibling)/load_lora_adapter_from_tensors (this bug)Effect
--admin-api-key onlyrequires admin keyreachable with NO credentialUnauthenticated access to an admin action
both --api-key and --admin-api-keyrequires admin keyreachable with the low-priv --api-keyPrivilege downgrade (normal key unlocks an admin-only action)
--api-key onlyrequires api keyrequires api keyNo bypass in this configuration
no keys configuredopenopenAuth middleware is not installed at all; unrelated to this bug

The headline case is the first row: with --admin-api-key set, the endpoint is reachable with no credential at all.

Reaching the LoRA code additionally requires the server to be started with --enable-lora. Note also that sglang binds to 127.0.0.1 by default; network exposure depends on the deployment (--host 0.0.0.0, container port mapping, etc.).


Technical Detail

sglang authorizes administrative routes with a decorator defined in sglang/srt/utils/auth.py:

def auth_level(level: AuthLevel):
    """Mark endpoint with auth level (stored in endpoint metadata)."""
    def decorator(func):
        func._auth_level = level
        return func
    return decorator

An ASGI middleware (add_api_key_middleware → _ApiKeyASGIMiddleware) resolves each request to its route, reads that route's _auth_level, and calls decide_request_auth(). A route with no @auth_level decorator resolves to the default:

# _get_auth_level_from_app_and_scope(...)
level = getattr(endpoint, "_auth_level", None)
return level if isinstance(level, AuthLevel) else AuthLevel.NORMAL

And for AuthLevel.NORMAL, when no plain api_key is configured, decide_request_auth() returns allowed:

# decide_request_auth(..., auth_level=AuthLevel.NORMAL)
if api_key:
    return AuthDecision(allowed=_check_bearer_token(authorization_header, api_key))
return AuthDecision(allowed=True)        # <-- no api_key configured => allowed

In the vulnerable releases, http_server.py decorates the siblings but not the target:

@app.api_route("/load_lora_adapter", methods=["POST"])
@auth_level(AuthLevel.ADMIN_OPTIONAL)                 # protected
async def load_lora_adapter(...):
    ...

@app.api_route("/load_lora_adapter_from_tensors", methods=["POST"])
# <-- NO @auth_level decorator : the bug
async def load_lora_adapter_from_tensors(...):
    ...

@app.api_route("/unload_lora_adapter", methods=["POST"])
@auth_level(AuthLevel.ADMIN_OPTIONAL)                 # protected
async def unload_lora_adapter(...):
    ...

So when the server is launched with --admin-api-key (and no plain --api-key), the two siblings require the admin bearer token, while /load_lora_adapter_from_tensors resolves to NORMAL and is allowed through with no credential.


Root Cause

A single administrative route was added without the @auth_level decorator that every other administrative route carries. The authorization model is decorator-opt-in: a route that forgets the decorator silently falls back to the least-restrictive NORMAL level instead of failing closed.


Proof of Concept

poc_sglang_missing_auth.py demonstrates the issue using sglang's own code, two independent ways, with no GPU, no model, and no RCE payload:

  • PART 1 — static, against the real http_server.py: it AST-parses sglang's actual srt/entrypoints/http_server.py at a pinned release tag and prints the three LoRA endpoints with their decorators, showing that /load_lora_adapter_from_tensors is the lone administrative LoRA route missing @auth_level.

  • PART 2 — dynamic, against the real auth.py: it loads sglang's genuine srt/utils/auth.py (the real @auth_level decorator, the real route-level resolver, the real decide_request_auth, and the real add_api_key_middleware ASGI middleware), mounts two endpoints whose decoration is driven by what PART 1 found in the real source, starts the server as --admin-api-key ..., and sends credential-free requests. The protected sibling returns 401; the vulnerable endpoint returns 200 (its handler is reached).

The stubbed 200-returning handler is intentional and sufficient: the vulnerability lives entirely in the authorization layer that runs before the model-loading handler, so a credential-free request reaching the handler at all is itself the proof that authorization was bypassed.

What makes this faithful

The demonstration drives sglang's real authorization module rather than a hand-written imitation. The only thing not executed is the heavyweight model-loading handler body (which requires torch/CUDA), which is exactly the code that authorization is supposed to gate.


Setup

The PoC needs only a few pure-Python packages:

pip install fastapi starlette httpx

It fetches the two sglang source files it analyzes directly from the pinned release tag on GitHub (no sglang install, no GPU). To run entirely offline, point it at a locally extracted sglang source tree with --source/--sglang-src.


Run

Against the default vulnerable tag (v0.5.13.post1):

python poc_sglang_missing_auth.py

Against any affected tag (v0.5.8 … v0.5.21):

python poc_sglang_missing_auth.py --tag v0.5.21

Against a local extracted source tree (offline):

python poc_sglang_missing_auth.py --sglang-src /path/to/sglang
Download Tool

Most Popular

View all →

Discover the most used tools by our community.

  • 1

    OsintHunter

    letox4/osinthunter

    🎯 The ultimate OSINT toolkit: investigation graph, confidence scoring, alias families, map, timeline and reports. 49 modules, 400+ sites, no API keys required.

    960
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    GhostLock One-Tap Execution App (CVE-2026-43499)

    554
  • 3

    redforge

    cybersecurity91/redforge

    Browser-side red team toolkit with 102 offline tools for recon, payload generation, credential attacks, crypto, encoding and engagement reporting.

    349
  • 4

    looking-glass

    anonghosty/looking-glass

    CSIRT platform that ingests Shadowserver reports into MongoDB and replays them as interactive maps, analysis, findings, advisories and executive dashboards.

    343
  • 5

    ARTEX

    baarai/artex

    LLM multi-agent autonomous penetration testing platform with planner/worker agents, asset and exploration graphs, MITM traffic recording, and vulnerability retesting.

    323
  • 6

    CyberStrikeAI

    ed1s0nz/cyberstrikeai

    The system of action for AI-native cybersecurity—where intent becomes governed execution, evidence becomes operational memory, and every operation improves the next.

    295

Explore all tools

Browse our collection of tools

View all tools →