/

CVE-2026-31843

Severity:

CRITICAL RISK

(9.8)

Broken / Missing Access Control in goodoneuz/pay-uz Laravel

CVE-2026-31843

Deferred

Vulnerability type

Category:

Broken / Missing Access Control

CWE:

CWE-284

Impact:

Remote Code Execution via Unauthenticated Payment Hook Overwrite

Severity:

CRITICAL RISK

(9.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

The goodoneuz/pay-uz Laravel package exposes an unauthenticated endpoint that lets remote attackers overwrite PHP payment hook files with arbitrary content.

Because these modified hooks are later executed via require() during normal payment processing, an attacker can achieve remote code execution without valid credentials.

Affected context

This vulnerability affects Laravel applications that integrate the goodoneuz/pay-uz package (version 2.2.24 and below) and expose the /payment/api/editable/update route.

The issue appears when:

  • The route is registered with Route::any() and no authentication or authorization middleware
  • The application relies on PHP hook files for payment callbacks and business logic
  • The deployment assumes that payment hook files are trusted and executable during payment processing

Under these common conditions, an external party can reach the endpoint over HTTP(S) and alter executable PHP code used in payment flows.

Exploit preconditions

  • Attack surface: Publicly accessible /payment/api/editable/update HTTP endpoint exposed by the Laravel application.
  • Required access: None; the route is unauthenticated and callable by any remote client that can reach the server.
  • Trigger point: Sending crafted POST/PUT/ANY requests that control the file path/name (if exposed) and especially the PHP content written via file_put_contents().
  • Why exploitation is possible:
  • The endpoint is registered with Route::any() without authentication middleware.
  • User-controlled input is directly persisted into PHP files that reside in a location later loaded with require() as part of the payment workflow.
  • The payment "secret token" mentioned by the vendor is not enforced for this route and does not gate access to the vulnerable behavior.

Why this happens

The core bug is a missing or ineffective access control on a highly sensitive operation: editing executable PHP hook files.

This maps to CWE-284: Improper Access Control, where the application exposes functionality that should be restricted (code modification) without enforcing authentication or authorization.

Architecturally, the system:

  • Treats HTTP clients as trusted editors of server-side PHP payment hooks
  • Writes user-controlled string input directly to files using file_put_contents()
  • Executes those same files via require() in normal payment processing paths

This creates a direct path from untrusted HTTP input to server-side code execution, turning a content-editing feature into a remote shell vector.

Potential impact

  • Remote execution of arbitrary PHP code under the web server or PHP-FPM user
  • Complete compromise of the affected application, including access to databases and sensitive payment-related data
  • Modification or suppression of payment callbacks, leading to fraud, payment misrouting, or denial of legitimate transactions
  • Implanting persistent webshells within payment hook files for long-term access
  • Pivoting to other internal systems reachable from the compromised application environment

General mitigation guidance

Effective mitigation focuses on eliminating unauthenticated write access to executable code and hardening payment hook handling patterns:

  • Require strong authentication and authorization for any endpoint that can modify server-side scripts or configuration, applying least-privilege principles.
  • Separate code from content: avoid designs where HTTP endpoints can directly write executable PHP files; treat hooks as code deployed through controlled release pipelines.
  • If runtime customization is necessary, store dynamic behavior as structured configuration (e.g., JSON rules, templates) rather than raw executable code.
  • Constrain file write locations to non-executable directories and avoid subsequently including them via require(), include(), or similar constructs.
  • Enforce input validation on any file-related parameters, rejecting unexpected file paths or extensions and preventing directory traversal.
  • Run the application with least-privilege filesystem permissions and disable execution where only data should reside.

How teams detect issues like this

Detection strategies can combine code-level and runtime observations:

  • Static analysis/code review:
  • Flag routes that:
  • Use Route::any() without authentication middleware
  • Call file_put_contents() or other file-write APIs with request-derived data
  • Later require() or include() files that can be influenced by user input
  • Review payment integration modules for patterns where "editable" or "configurable" hooks are implemented as executable PHP files.
  • Policy enforcement:
  • Establish internal policies that prohibit direct modification of executable code via HTTP endpoints.
  • Enforce middleware checks (auth, CSRF where applicable, authorization gates) on all routes capable of modifying server-side files.
  • Runtime monitoring:
  • Monitor for unusual writes to payment hook directories and unexpected changes to PHP files.
  • Use file integrity monitoring (FIM) to alert on modifications to hook scripts outside of deployment windows.
  • Automated code scanning tools and CI checks can be configured to detect dangerous combinations of file writes and dynamic includes before deployment.

Sources

SourceLink
github.comgithub.com/goodoneuz/pay-uz/blob/master/src/Http/Controllers/ApiController.php
github.comgithub.com/goodoneuz/pay-uz/blob/master/src/routes/web.php
github.comgithub.com/shaxzodbek-uzb/pay-uz
packagist.orgpackagist.org/packages/goodoneuz/pay-uz

Frequently asked

questions

Yes. The vulnerable /payment/api/editable/update endpoint is exposed without authentication, so any remote user who can reach the server over the network can attempt to exploit it.

No. The payment secret token referenced by the vendor is not enforced for this endpoint. Exploitation does not require user accounts, API keys, or shared secrets under the described behavior.

The safest pattern is to remove unauthenticated write access to PHP hook files entirely: protect the endpoint with strong authentication and authorization, or better, redesign the system so that editable entities are non-executable data and hook code is only changed through secure deployment processes.

Prevent similar issues by enforcing strict access control on any feature that modifies server-side files, avoiding architectures where HTTP clients can edit executable code, implementing least-privilege filesystem and runtime policies, and including automated checks that flag routes combining user input, file writes, and dynamic code inclusion.

Find out what's already
exploitable in your codebase.