CVE-2026-33661: Yansongda/pay WeChat Pay Callback Signature Verification Vulnerability

HIGH
Advisory Identifier: GHSA-q938-ghwv-8gvc
CVSS 8.6
CWE-290
Published
Advisory Summary

CVE-2026-33661 is a HIGH (CVSS 8.6) wechat pay callback signature verification vulnerability (CWE-290: Authentication Bypass by Spoofing) affecting Yansongda/pay libraries in the Packagist ecosystem. The issue involves wechat pay callback signature verification bypassed when host header is localhost. Remediation is available by upgrading affected packages to version 3.7.20.

CVE-2026-33661 at a Glance

CVE Identifier CVE-2026-33661
GHSA Identifier GHSA-q938-ghwv-8gvc
Severity HIGH
CVSS v3.1 Base Score 8.6
CWE Classification CWE-290: Authentication Bypass by Spoofing
Affected Product Yansongda/pay
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 8.6

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

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

How to Fix CVE-2026-33661

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

yansongda/pay fixed: 3.7.20
Upgrade yansongda/pay to 3.7.20
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 yansongda/pay

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-33661, inspect your project dependencies for Yansongda/pay:

inspect dependencies for yansongda/pay

Analyze the terminal output to locate any version of Yansongda/pay in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.7.20), 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-290: Authentication Bypass by Spoofing, where this attack-focused weakness is caused by incorrectly implemented authentication schemes that are subject to spoofing attacks. In Yansongda/pay, 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 `verify_wechat_sign()` function in `src/Functions.php` unconditionally **skips all signature verification** when the PSR-7 request reports `localhost` as the host. An attacker can exploit this by sending a crafted HTTP request to the WeChat Pay callback endpoint with a `Host: localhost` header, bypassing the RSA signature check entirely. This allows forging fake WeChat Pay payment success notifications, potentially causing applications to mark orders as paid without actual payment. ## Vulnerable Code **`src/Functions.php` lines 243-246:** ```php function verify_wechat_sign(ResponseInterface|ServerRequestInterface $message, array $params): void { // BYPASS: Returns without any signature check if Host header is localhost if ($message instanceof ServerRequestInterface && 'localhost' === $message->getUri()->getHost()) { return; // No signature verified! } // ... openssl_verify() only reached when Host != localhost $wechatSerial = $message->getHeaderLine('Wechatpay-Serial'); $sign = $message->getHeaderLine('Wechatpay-Signature'); $result = 1 === openssl_verify($content, base64_decode($sign), $public, 'sha256WithRSAEncryption'); } ``` In PSR-7 implementations (Nyholm, Guzzle PSR-7, etc.), `$request->getUri()->getHost()` reads the `Host` HTTP header, which is fully attacker-controlled. ## Proof of Concept ```bash curl -X POST https://merchant.example.com/payment/wechat/callback \ -H "Host: localhost" \ -H "Content-Type: application/json" \ -H "Wechatpay-Serial: any" \ -H "Wechatpay-Timestamp: 1234567890" \ -H "Wechatpay-Nonce: abc" \ -H "Wechatpay-Signature: AAAA" \ -d '{"id":"fake-order","event_type":"TRANSACTION.SUCCESS"}' ``` `verify_wechat_sign()` returns immediately without verifying the signature. The application marks the order as paid. ## Impact - **Payment fraud**: Attacker receives goods/services without actual payment by forging WeChat Pay callbacks - **No authentication required**: Pure network attack, zero privileges needed - **Wide reach**: Affects any application using `yansongda/pay` for WeChat Pay callback validation. However, in most environments, Nginx/Ingress/Cloudflare/WAF will directly reject the forgery of this request header, so there is no need to worry too much.

CVE-2026-33661 Affected Yansongda/pay Versions

1 component(s)
Fixed Versions:
3.7.20
Product / Package Ecosystem Affected Versions Fixed Version
yansongda/pay
Packagist
< 3.7.20
3.7.20

References

Frequently Asked Questions

What is CVE-2026-33661?
CVE-2026-33661 is a security vulnerability in Yansongda/pay involving WeChat Pay callback signature verification bypassed when Host header is localhost under CWE-290: Authentication Bypass by Spoofing.
Which Yansongda/pay versions are affected?
Affected versions include releases prior to 3.7.20 across affected packages: yansongda/pay.
What version fixes CVE-2026-33661?
Upgrading to 3.7.20 (or the latest patched release for your respective branch) resolves the vulnerability.
Is yansongda/pay affected?
Yes, yansongda/pay is affected in releases prior to 3.7.20. Upgrade your dependency to 3.7.20 or later.
What is the CVSS score of CVE-2026-33661?
CVE-2026-33661 has a CVSS v3.1 base score of 8.6 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:H/A:N.
What CWE is associated with CVE-2026-33661?
CVE-2026-33661 is classified under CWE-290: Authentication Bypass by Spoofing (This attack-focused weakness is caused by incorrectly implemented authentication schemes that are subject to spoofing attacks.).
How can I check Packagist dependencies for CVE-2026-33661?
Run the dependency tree command: 'inspect dependencies for yansongda/pay'. 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-q938-ghwv-8gvc",
  "modified" : "2026-03-27T22:10:51Z",
  "published" : "2026-03-25T19:30:09Z",
  "aliases" : [ "CVE-2026-33661" ],
  "summary" : "WeChat Pay callback signature verification bypassed when Host header is localhost",
  "details" : "## Summary\n\nThe `verify_wechat_sign()` function in `src/Functions.php` unconditionally **skips all signature verification** when the PSR-7 request reports `localhost` as the host. An attacker can exploit this by sending a crafted HTTP request to the WeChat Pay callback endpoint with a `Host: localhost` header, bypassing the RSA signature check entirely.\n\nThis allows forging fake WeChat Pay payment success notifications, potentially causing applications to mark orders as paid without actual payment.\n\n## Vulnerable Code\n\n**`src/Functions.php` lines 243-246:**\n```php\nfunction verify_wechat_sign(ResponseInterface|ServerRequestInterface $message, array $params): void\n{\n    // BYPASS: Returns without any signature check if Host header is localhost\n    if ($message instanceof ServerRequestInterface && 'localhost' === $message->getUri()->getHost()) {\n        return;  // No signature verified!\n    }\n\n    // ... openssl_verify() only reached when Host != localhost\n    $wechatSerial = $message->getHeaderLine('Wechatpay-Serial');\n    $sign = $message->getHeaderLine('Wechatpay-Signature');\n    $result = 1 === openssl_verify($content, base64_decode($sign), $public, 'sha256WithRSAEncryption');\n}\n```\n\nIn PSR-7 implementations (Nyholm, Guzzle PSR-7, etc.), `$request->getUri()->getHost()` reads the `Host` HTTP header, which is fully attacker-controlled.\n\n## Proof of Concept\n\n```bash\ncurl -X POST https://merchant.example.com/payment/wechat/callback \\\n  -H \"Host: localhost\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Wechatpay-Serial: any\" \\\n  -H \"Wechatpay-Timestamp: 1234567890\" \\\n  -H \"Wechatpay-Nonce: abc\" \\\n  -H \"Wechatpay-Signature: AAAA\" \\\n  -d '{\"id\":\"fake-order\",\"event_type\":\"TRANSACTION.SUCCESS\"}'\n```\n\n`verify_wechat_sign()` returns immediately without verifying the signature. The application marks the order as paid.\n\n## Impact\n\n- **Payment fraud**: Attacker receives goods/services without actual payment by forging WeChat Pay callbacks\n- **No authentication required**: Pure network attack, zero privileges needed\n- **Wide reach**: Affects any application using `yansongda/pay` for WeChat Pay callback validation. However, in most environments, Nginx/Ingress/Cloudflare/WAF will directly reject the forgery of this request header, so there is no need to worry too much.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "yansongda/pay"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.7.20"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 3.7.19"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/yansongda/pay/security/advisories/GHSA-q938-ghwv-8gvc"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-33661"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/yansongda/pay/commit/26987ebf789f1e7f0a85febb640986ab4289fd7f"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/yansongda/pay"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/yansongda/pay/releases/tag/v3.7.20"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-290" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-03-25T19:30:09Z",
    "nvd_published_at" : "2026-03-26T22:16:29Z"
  }
}