VAITP Dataset

← Back to the dataset

CVE-2026-125362

Weak randomness in Seahub share link passwords allows state recovery and prediction.

  • CVSS 2.3
  • CWE-338
  • Cryptographic
  • Remote

Seahub through 14.0.10 contains a weak randomness vulnerability in MultiShareLinksBatch.post() that generates batch share link passwords using Python's non-cryptographic random.choices(). Authenticated users permitted to create share links can request many generated passwords via the multi-share-links batch endpoint, recover the Mersenne Twister state, and predict other users' share link passwords.

CVSS base score
2.3
Published
2026-11-10
OWASP
A02 Cryptographic Failures
Orthogonal defect classification
Algorithm
Code defect classification
Incorrect Algorithm
Category
Cryptographic
Subcategory
Inadequate random number generation
Accessibility scope
Remote
Impact
Unauthorized Access
Affected component
Python

Solution

Upgrade Seahub to version 14.0.11 or later, which replaces the non‑cryptographic random generator with a secure one for batch share‑link passwords.

Vulnerable code sample

import random
from typing import List, Dict

class MultiShareLinksBatch:
    def __init__(self, db):
        self.db = db

    def post(self, user_id: int, targets: List[Dict]) -> List[str]:
        """Create share links for multiple targets and return passwords."""
        passwords = []
        for target in targets:
            # VULNERABLE: uses non‑cryptographic RNG for passwords
            pwd = ''.join(random.choices('abcdefghijklmnopqrstuvwxyz0123456789', k=8))
            self.db.execute(
                "INSERT INTO share_links (user_id, target_id, password) VALUES (?, ?, ?)",
                (user_id, target['id'], pwd)
            )
            passwords.append(pwd)
        return passwords

Patched code sample

import random
import secrets
from typing import List, Dict

class MultiShareLinksBatch:
    def __init__(self, db):
        self.db = db

    def post(self, user_id: int, targets: List[Dict]) -> List[str]:
        """Create share links for multiple targets and return passwords."""
        passwords = []
        for target in targets:
            # FIX: uses cryptographically secure RNG for passwords
            pwd = ''.join(secrets.choice('abcdefghijklmnopqrstuvwxyz0123456789') for _ in range(8))
            self.db.execute(
                "INSERT INTO share_links (user_id, target_id, password) VALUES (?, ?, ?)",
                (user_id, target['id'], pwd)
            )
            passwords.append(pwd)
        return passwords

Published fix

Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.

Cite this entry

@misc{vaitp:cve2026125362,
  title        = {{Weak randomness in Seahub share link passwords allows state recovery and prediction.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-125362},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-125362/}}
}

Download this entry as JSON Download the whole dataset

Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.

The supreme art of war is to subdue the enemy without fighting.

Sun Tzu – “The Art of War”

:: Shaping the future through research and ingenuity ::

Before you use the VAITP AI models

Please read and accept the following disclaimer:

By choosing "I understand and accept", you acknowledge that you understand and agree to these terms.