| 标题 | hankcs HanLP 2.1.6 Deserialization |
|---|
| 描述 | A vulnerability was found in hankcs HanLP up to 2.1.6. This issue affects the function load_language_model of the class RNNLanguageModel in the file hanlp/layers/embeddings/contextual_string_embedding.py. The function loads a model with torch.load(model_file) without setting weights_only=True, so a crafted .pt file executes arbitrary code during deserialization through Python pickle. The model path is obtained via get_resource(), which downloads remote URLs, so the loaded forward.pt and backward.pt can originate from an attacker-influenced source. This leads to remote code execution. The vulnerability is reachable from the public API: ContextualStringEmbedding(field, path) -> ContextualStringEmbeddingModule.init (path = get_resource(path)) -> RNNLanguageModel.load_language_model(path/'forward.pt') -> torch.load(model_file). The attack can be initiated remotely. A proof of concept is available at the reference URL. This issue is distinct from CVE-2026-112079 (load_word2vec_as_vocab_tensor) and CVE-2026-112081 (hanlp.load classpath): it is a different function and, unlike the sibling loaders in torch_component.py and torch_util.py, it was not hardened with weights_only=True. Remediation: load with torch.load(model_file, weights_only=True) and audit every torch.load reached via get_resource for the same gap. |
|---|
| 来源 | ⚠️ https://gist.github.com/zewolkt3939/8f665b80c0878e5efde324c255d1abcd |
|---|
| 用户 | kubao4664 (UID 102326) |
|---|
| 提交 | 2026-10-22 11時21分 (1 月前) |
|---|
| 管理 | 2026-11-20 15時31分 (29 days later) |
|---|
| 状态 | 已接受 |
|---|
| VulDB条目 | 441459 [hankcs HanLP 直到 2.1.6 contextual_string_embedding.py RNNLanguageModel.load_language_model model_file 权限提升] |
|---|
| 积分 | 20 |
|---|