Axios is a promise based HTTP client for the browser and Node.js. Prior to 1.15.1 and 0.31.1, toFormData recursively walks nested objects with no depth limit, so a deeply nested value passed as request data crashes the Node.js process with a RangeError. This vulnerability is fixed in 1.15.1 and 0.31.1.
Axios versions prior to 1.15.1 and 0.31.1 contain a denial-of-service vulnerability in the toFormData function that lacks recursion depth limits, allowing attackers to crash Node.js processes with deeply nested objects. This affects all Node.js applications using vulnerable Axios versions for HTTP requests. The vulnerability is actively exploitable and poses significant risk to web services and APIs across Saudi organizations.
IMMEDIATE ACTIONS:
1. Identify all Node.js applications using Axios in your environment
2. Check current Axios version: npm list axios
3. Implement input validation to reject deeply nested objects before passing to Axios
4. Deploy rate limiting and request size restrictions on API endpoints
PATCHING GUIDANCE:
1. Upgrade Axios to version 1.15.1 or 0.31.1 or later: npm update axios
2. For applications unable to upgrade immediately, pin maximum nesting depth in request payloads
3. Test thoroughly in staging environment before production deployment
4. Monitor npm security advisories for additional patches
COMPENSATING CONTROLS:
1. Implement request payload size limits (e.g., max 1MB)
2. Add JSON schema validation to reject nested objects exceeding depth threshold (recommend max depth: 5-10 levels)
3. Deploy Web Application Firewall (WAF) rules to detect and block deeply nested JSON payloads
4. Configure API gateway request inspection
DETECTION RULES:
1. Monitor Node.js process crashes with RangeError in logs
2. Alert on HTTP requests with JSON nesting depth > 10 levels
3. Track Axios version usage across infrastructure
4. Monitor for repeated failed requests from same source IP
الإجراءات الفورية:
1. تحديد جميع تطبيقات Node.js التي تستخدم Axios في بيئتك
2. التحقق من إصدار Axios الحالي: npm list axios
3. تنفيذ التحقق من صحة المدخلات لرفض الكائنات المتداخلة بعمق قبل تمريرها إلى Axios
4. نشر تحديد معدل الطلب وقيود حجم الطلب على نقاط نهاية API
إرشادات التصحيح:
1. ترقية Axios إلى الإصدار 1.15.1 أو 0.31.1 أو أحدث: npm update axios
2. بالنسبة للتطبيقات غير القادرة على الترقية فوراً، حدد الحد الأقصى لعمق التداخل في حمولات الطلب
3. اختبر بدقة في بيئة التجريب قبل نشر الإنتاج
4. راقب تنبيهات أمان npm للحصول على تصحيحات إضافية
الضوابط البديلة:
1. تنفيذ حدود حجم حمولة الطلب (على سبيل المثال، 1 ميجابايت كحد أقصى)
2. إضافة التحقق من صحة مخطط JSON لرفض الكائنات المتداخلة التي تتجاوز حد العمق (يوصى به: الحد الأقصى للعمق: 5-10 مستويات)
3. نشر قواعد جدار حماية تطبيقات الويب (WAF) للكشف عن حمولات JSON المتداخلة بعمق وحجبها
4. تكوين فحص طلب بوابة API
قواعد الكشف:
1. مراقبة أعطال عملية Node.js مع RangeError في السجلات
2. تنبيه على طلبات HTTP مع عمق تداخل JSON > 10 مستويات
3. تتبع استخدام إصدار Axios عبر البنية الأساسية
4. مراقبة الطلبات الفاشلة المتكررة من نفس عنوان IP المصدر