sgl-project SGLang HuggingFace Transformer hf_transformers_utils.py get_tokenizer code injection
A vulnerability was detected in sgl-project SGLang up to 0.5.9. Impacted is the function get_tokenizer of the file python/sglang/srt/utils/hf_transformers_utils.py of the component HuggingFace Transformer Handler. The manipulation of the argument trust_remote_code with the input False as part of Boolean results in code injection. The attack can be executed remotely. A high complexity level is associated with this attack. The exploitability is considered difficult. In get_tokenizer(), when the caller passes trust_remote_code=False and HuggingFace transformers v5 returns a TokenizersBackend instance (the generic fallback for tokenizer classes not in the registry), SGLang silently re-invokes AutoTokenizer.from_pretrained with trust_remote_code=True, overriding the caller's explicit security setting. A model repository containing a malicious tokenizer.py referenced via auto_map in tokenizer_config.json will execute arbitrary Python in the SGLang process during this second call. No log line or warning is emitted. The override affects all current SGLang versions because transformers==5.3.0 is pinned in pyproject.toml. Both tokenizer_mode="auto" and tokenizer_mode="slow" are affected. The exploit is now public and may be used. The vendor was contacted early about this disclosure but did not respond in any way.
Problem Types
| Type | CWE ID | Description |
|---|
| CWE | CWE-94 | Code Injection |
| CWE | CWE-74 | Injection |
Type: CWE
Description: Code Injection
Type: CWE
Description: Injection
Metrics
| Version | Base score | Base severity | Vector |
|---|
| 4.0 | 6.3 | MEDIUM | CVSS:4.0/AV:N/AC:H/AT:N/PR:N/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N/E:X |
| 3.1 | 5.6 | MEDIUM | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L/E:P/RL:X/RC:R |
| 3.0 | 5.6 | MEDIUM | CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L/E:P/RL:X/RC:R |
| 2.0 | 5.1 | N/A | AV:N/AC:H/Au:N/C:P/I:P/A:P/E:POC/RL:ND/RC:UR |
Version: 4.0
Base score: 6.3
Base severity: MEDIUM
Vector: CVSS:4.0/AV:N/AC:H/AT:N/PR:N/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N/E:X
Version: 3.1
Base score: 5.6
Base severity: MEDIUM
Vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L/E:P/RL:X/RC:R
Version: 3.0
Base score: 5.6
Base severity: MEDIUM
Vector: CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L/E:P/RL:X/RC:R
Version: 2.0
Base score: 5.1
Base severity: N/A
Vector: AV:N/AC:H/Au:N/C:P/I:P/A:P/E:POC/RL:ND/RC:UR
Timeline
| Event | Date |
|---|
| Vulnerability found | 2026-04-07 02:00:00 |
| Vendor informed | 2026-04-07 02:00:00 |
| Advisory disclosed | 2026-05-02 00:00:00 |
| VulDB entry created | 2026-05-02 02:00:00 |
| Exploit disclosed | 2026-05-03 02:00:00 |
| VulDB entry last update | 2026-05-04 06:26:28 |
Event: Vulnerability found
Date: 2026-04-07 02:00:00
Event: Vendor informed
Date: 2026-04-07 02:00:00
Event: Advisory disclosed
Date: 2026-05-02 00:00:00
Event: VulDB entry created
Date: 2026-05-02 02:00:00
Event: Exploit disclosed
Date: 2026-05-03 02:00:00
Event: VulDB entry last update
Date: 2026-05-04 06:26:28