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.
CVE-2026-33661 is a critical authentication bypass vulnerability in the Pay SDK affecting WeChat payment processing. The vulnerability allows attackers to forge payment success notifications by sending requests with a 'Host: localhost' header, completely bypassing RSA signature verification. This could enable fraudulent transactions and financial loss for e-commerce platforms and payment processors using affected versions prior to 3.7.20.
IMMEDIATE ACTIONS:
1. Identify all systems using Pay SDK versions prior to 3.7.20 by scanning composer.lock and dependency manifests
2. Isolate affected payment processing systems from production if critical
3. Review payment callback logs for suspicious 'Host: localhost' requests in the past 90 days
4. Implement WAF rules to block requests with 'Host: localhost' header to payment endpoints
PATCHING:
1. Update Pay SDK to version 3.7.20 or later immediately: composer update yansongda/pay
2. Test payment callback functionality in staging environment before production deployment
3. Verify signature verification is functioning correctly post-patch
COMPENSATING CONTROLS (if immediate patching not possible):
1. Implement reverse proxy validation to reject requests with 'Host: localhost' header
2. Add IP whitelist validation for WeChat callback servers (only allow WeChat's official IPs)
3. Implement additional HMAC validation layer independent of SDK
4. Enable request logging and alerting for localhost-based payment callbacks
DETECTION:
1. Monitor access logs for HTTP requests to payment callback endpoints with 'Host: localhost'
2. Alert on payment success notifications without corresponding payment gateway confirmations
3. Track discrepancies between WeChat merchant backend and application payment records
الإجراءات الفورية:
1. تحديد جميع الأنظمة التي تستخدم إصدارات Pay SDK السابقة للإصدار 3.7.20 بمسح ملفات composer.lock
2. عزل أنظمة معالجة الدفع المتأثرة عن الإنتاج إذا كانت حرجة
3. مراجعة سجلات رد الاتصال للدفع بحثاً عن طلبات مريبة برأس 'Host: localhost' في آخر 90 يوماً
4. تطبيق قواعد WAF لحجب الطلبات برأس 'Host: localhost' إلى نقاط نهاية الدفع
التصحيح:
1. تحديث Pay SDK إلى الإصدار 3.7.20 أو أحدث فوراً: composer update yansongda/pay
2. اختبار وظيفة رد الاتصال للدفع في بيئة التجريب قبل نشر الإنتاج
3. التحقق من أن التحقق من التوقيع يعمل بشكل صحيح بعد التصحيح
الضوابط البديلة (إذا لم يكن التصحيح الفوري ممكناً):
1. تطبيق التحقق من الخادم الوكيل العكسي لرفض الطلبات برأس 'Host: localhost'
2. إضافة التحقق من قائمة IP البيضاء لخوادم رد الاتصال WeChat
3. تطبيق طبقة التحقق من HMAC الإضافية المستقلة عن SDK
4. تفعيل تسجيل الطلبات والتنبيهات لرد الاتصال للدفع المستند إلى localhost
الكشف:
1. مراقبة سجلات الوصول للطلبات إلى نقاط نهاية رد الاتصال للدفع برأس 'Host: localhost'
2. التنبيه على إشعارات نجاح الدفع بدون تأكيدات بوابة دفع مقابلة
3. تتبع التناقضات بين خادم تاجر WeChat وسجلات الدفع في التطبيق