Skip to main content
Vulnerability Database/CVE-2026-104356

CVE-2026-104356: PictShare Auth Bypass Vulnerability

CVE-2026-104356 is an auth bypass flaw in PictShare caused by weak randomness in delete_code generation. Attackers can predict tokens to delete files without authorization. This post explains its impact, affected versions, and mitigation steps.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-104356 Overview

CVE-2026-104356 is a weak randomness vulnerability in PictShare versions before 3.7.1. The getRandomString() function in src/inc/core.php uses the non-cryptographic rand() pseudo-random number generator (PRNG) to produce the delete_code authorization token. Attackers can predict or recover the PRNG state and guess valid delete codes to remove hosted files without authorization. The flaw is classified under CWE-338: Use of Cryptographically Weak Pseudo-Random Number Generator.

Critical Impact

Remote unauthenticated attackers can delete arbitrary files hosted on a PictShare instance by predicting delete tokens generated with rand().

Affected Products

  • PictShare versions prior to 3.7.1
  • PictShare src/inc/core.phpgetRandomString() function
  • PictShare src/inc/api.class.php info endpoint (secondary leak path)

Discovery Timeline

  • 2026-10-01 - CVE-2026-104356 published to the National Vulnerability Database
  • 2026-10-02 - Last updated in NVD database

Technical Details for CVE-2026-104356

Vulnerability Analysis

PictShare generates a per-upload delete_code that authorizes removal of hosted files. The getRandomString() helper in src/inc/core.php builds this token using PHP's rand() function, which is a linear congruential generator and not suitable for security purposes. Because rand() output is deterministic given its internal state, an attacker who observes a small number of outputs or correlates generated tokens with time-based seeds can recover the state and predict future delete_code values.

A secondary issue compounds the risk. The API info endpoint previously returned the entire metadata record for a given hash, which included the delete code itself. Anyone who knew a file hash could retrieve its delete token directly and issue a deletion request.

Root Cause

The root cause is the use of a non-cryptographic PRNG for a security-sensitive token. rand() provides insufficient entropy and a predictable state, violating the requirement that authorization tokens be unguessable. A separate information-disclosure defect in the metadata API endpoint returned the delete code alongside public fields, broadening the exposure.

Attack Vector

The attack is network-reachable and requires no authentication or user interaction. An attacker enumerates or predicts delete_code values generated by rand() and submits a deletion request for a known hash. Successful exploitation results in unauthorized deletion of hosted files, impacting integrity and availability of uploaded content.

php
// Patch excerpt - src/inc/api.class.php
// Restrict metadata endpoint to safe public fields only
if (!isExistingHash($hash))
    return ['status' => 'err', 'reason' => 'Hash not found'];

// meta.json also holds the delete code, uploader details (ip, useragent, ..), the
// original filename and view stats, so only fields that are safe to show to
// anyone who knows the hash are returned
$public = ['mime', 'size', 'size_human', 'hash', 'sha1', 'uploaded', 'type', 'hashes', 'created'];

return array_intersect_key(getMetadataOfHash($hash) ?: [], array_flip($public));

Source: GitHub Commit ce5fc47

php
// Patch excerpt - src/inc/core.php
// Replace direct code comparison with isValidDeleteCode() and
// prevent empty-code bypass via MASTER_DELETE_IP
$code = substr($el,7);
//@todo: allow MASTER_DELETE_IP to be CIDR range or coma separated
if(isValidDeleteCode($hash,$code) || (defined('MASTER_DELETE_IP') && MASTER_DELETE_IP!='' && MASTER_DELETE_IP==getUserIP()) )
{
    addToLog(getUserIP()." deleted $hash\tIt was deleted by the user\t".$_SERVER['HTTP_USER_AGENT'], ROOT.DS.'logs/deletes.log');
    deleteHash($hash);
}

Source: GitHub Commit ce5fc47

Detect Identity Attacks the Moment Authentication Fails

Singularity™ Identity surfaces credential misuse, lateral movement, and privilege escalation in real time, so you can contain the breach before it spreads.

Stop Identity Attacks

Detection Methods for CVE-2026-104356

Indicators of Compromise

  • Unexpected deletes.log entries referencing hashes that the owner did not request to remove.
  • High volumes of HTTP requests containing delete/<code> path segments from a single source IP.
  • Requests to the metadata or info endpoint for many sequential or enumerated hashes.
  • Missing hashes in the upload directory without a corresponding user-initiated deletion.

Detection Strategies

  • Review PictShare application logs for deletion events, correlating uploader IP against the IP that triggered the delete.
  • Identify bursts of failed deletion attempts, which indicate token guessing against the rand()-generated code space.
  • Alert on access to the metadata endpoint followed within seconds by a delete request for the same hash.

Monitoring Recommendations

  • Forward web server access logs and PictShare logs/deletes.log to a centralized logging platform for correlation.
  • Rate-limit deletion endpoints at the reverse proxy or WAF layer to blunt token-guessing attempts.
  • Track upload-to-delete ratios and alert when deletions spike relative to the baseline.

How to Mitigate CVE-2026-104356

Immediate Actions Required

  • Upgrade PictShare to version 3.7.1 or later, which replaces the vulnerable code paths with isValidDeleteCode() and restricts the metadata endpoint.
  • Restrict public access to PictShare instances pending the upgrade, for example by placing them behind authentication or VPN.
  • Rotate any MASTER_DELETE_CODE values and review MASTER_DELETE_IP configuration for stale or empty values.
  • Audit logs/deletes.log for unauthorized deletion activity and restore files from backup where appropriate.

Patch Information

The fix is included in PictShare release v3.7.1 and the upstream security commit ce5fc474e89769efeae25fee763894bcce3412e3. Additional context is available in the VulnCheck advisory. The patch narrows the metadata API to safe public fields and routes delete authorization through a dedicated validation helper that also blocks empty-code bypass via MASTER_DELETE_IP.

Workarounds

  • Place PictShare behind a reverse proxy that enforces authentication on the delete and info endpoints until the patch is applied.
  • Explicitly set MASTER_DELETE_IP to a non-empty, trusted value, or remove the definition entirely, to prevent empty-code deletion bypass.
  • Apply strict rate limiting on deletion routes to raise the cost of guessing rand()-derived delete codes.
bash
# Example nginx rate limit for PictShare delete paths
http {
    limit_req_zone $binary_remote_addr zone=pictshare_delete:10m rate=5r/m;

    server {
        location ~* /[a-z0-9]+/delete/ {
            limit_req zone=pictshare_delete burst=5 nodelay;
            proxy_pass http://pictshare_upstream;
        }
    }
}

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.