Vulnerability DatabaseGHSA-835v-w4x6-rh9j

GHSA-835v-w4x6-rh9j: 
PHP vulnerability analysis and mitigation

Summary

When a 2FA account is shared with another user, the single-account read endpoint GET /api/v1/twofaccounts/{id}?withOtp=1 honours a caller-supplied at timestamp and returns the TOTP code valid at that time. A share recipient can advance at into the future and collect codes that are valid at those future times. Because revoking a share does not rotate the account's TOTP secret, every pre-collected code keeps working after the share is revoked. None of these reads dispatch the OtpGenerated event, so they never appear in the owner's OTP log which is the owner's only visibility into recipient activity. Breaks revocation and auditability (Moderate since it needs sharing enabled)

Details

Type of issue: broken access control / incorrect authorization, plus an audit-logging gap. Verified on master @ 84eb0e00847b043d0a245427dda2216127046660 (release 9.0.2):

  • app/Api/v1/Resources/TwoFAccountReadResource.php:50 — $otp = $this->getOtp($request->at); passes the client-supplied at straight into code generation, unclamped.
  • app/Api/v1/Controllers/TwoFAccountController.php:79 (show) — authorises with the view ability, which allows share recipients (app/Policies/TwoFAccountPolicy.php:33: isOwnedBy($user) || isSharedWith($user)).
  • app/Models/TwoFAccount.php:535 — getOTP($time) uses that timestamp (generated_at = $time ?: time()), so any at yields that window's valid code.
  • app/Api/v1/Resources/TwoFAccountCollection.php:38 — the list endpoint deliberately does $request->merge(['at' => now()->timestamp]); the single-account show path has no such clamp. This shows "return the current code" was the intent, and the show path simply forgot to clamp.
  • app/Api/v1/Controllers/TwoFAccountController.php:335 — OtpGenerated::dispatch(...) fires only on the dedicated GET /twofaccounts/{id}/otp endpoint; the show+withOtp path never dispatches it, so app/Listeners/LogOtpGeneration.php writes no audit row for these reads. Root cause: a share recipient reaches the single-account read (the view ability includes recipients), that read honours an arbitrary at, and it is the one OTP-returning path that is not audited.

Proof of concept

Configuration required: account sharing enabled (enableSharing, off by default), and the owner has shared at least one account with the attacker (user-scoped share, or an "all users" share). Steps (all over the public API; the recipient's own session can issue them):

  1. As the recipient: GET /api/v1/twofaccounts/{id}?withOtp=1&at=<now> → returns the valid current code.
  2. Repeat with future timestamps (at = now+3600, now+86400, now+2592000, ...) → each response is the valid code for that window. Store them.
  3. As the owner, revoke the share: DELETE /api/v1/twofaccounts/{id}/shares/{userId} → HTTP 204.
  4. As the recipient, re-read the account → HTTP 403 (access cut off going forward). Yet each code stored in step 2 is still the correct code for its window, because revocation did not change the secret.
  5. As the owner, GET /api/v1/twofaccounts/{id}/otp-logs → no entry for any of the step 1/2 reads. (One call to GET /twofaccounts/{id}/otp produces exactly one log row, for contrast.) Verified against 2fauth/2fauth:9.0.1, with every app-returned code cross-checked against an independent RFC-6238 computation (+1h, +24h, +30d all matched; the +30d code harvested before revocation was still valid after; otp_logs stayed at 0 across all reads). A self-contained reproduction script (poc-share-otp.sh) and a run transcript (EVIDENCE.txt) are attached below.

Impact

Who is impacted: any 2FAuth instance using the account-sharing feature. The attacker is a user the owner has shared an account with (a lower-privileged party for e.g. a contractor, or a colleague given temporary access). Impact: in seconds the recipient can download a long run of future codes. After the owner revokes the share, they believe that the is gone but the recipient still holds working second-factor codes for every window they harvested (the PoC shows 30 days), and the owner's audit log shows nothing. In effect it is a durable, invisible copy of the shared second factor that survives revocation, breaking both guarantees the sharing feature is built on (revocation and auditability). Suggested remediation:

  1. In TwoFAccountReadResource, ignore or clamp at on the show/withOtp path (mirror the list path's at = now), or honour a caller at only for the account owner.
  2. Dispatch OtpGenerated on the resource read path so recipient reads are audited like the dedicated /otp endpoint.
  3. Optionally document that revoking a share does not invalidate already-generated codes, and prompt the owner to rotate the secret if the recipient was untrusted. Please credit "Neev Mehta, Reware Labs" (https://rewarelabs.com) and contact neev@rewarelabs.com. I'd appreciate a CVE being assigned, and I'm happy to assist with the MITRE/GHSA details.

Source: NVD

Related PHP vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

GHSA-r66h-vhqv-h27fHIGH8.3
  • PHP logoPHP
  • bubka/2fauth
NoYesNov 23, 2026
GHSA-qjrw-7726-v758HIGH7.1
  • PHP logoPHP
  • code16/sharp
NoYesNov 23, 2026
GHSA-835v-w4x6-rh9jMEDIUM6.5
  • PHP logoPHP
  • bubka/2fauth
NoYesNov 23, 2026
GHSA-c4w6-v59v-38v5LOWN/A
  • PHP logoPHP
  • yiisoft/validator
NoYesNov 23, 2026
GHSA-2gm6-xjf3-cqmmHIGHN/A
  • PHP logoPHP
  • exceedone/exment
NoYesNov 23, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Additional Wiz resources

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management