Skip to content
langgenius/dify·Indexed by this site · Originally published· Event →· Its place in the scan record →

Under the default Docker deployment, forging the CF-Connecting-IP header can bypass Dify's IP-based rate limiting

Per-IP Rate Limit Bypass via Spoofable X-Forwarded-For and CF-Connecting-IP Headers

AI summary

Dify published security advisory GHSA-6j8g-rp8v-55vr: extract_remote_ip() treats the client-forgeable CF-Connecting-IP or X-Forwarded-For header as the client IP, and all IP-based rate limiting is keyed on it, so an attacker can defeat rate limiting by rotating that header on each request. In the default Docker deployment, nginx does not clear CF-Connecting-IP, and the first entry of X-Forwarded-For is controlled by the attacker. In a test of the default docker compose deployment of Dify 1.17.1, all 70 requests from a fixed IP were blocked with 429, while after rotating X-Forwarded-For on each request, all 70 requests passed. An attacker can use this to bypass EMAIL_SEND_IP_LIMIT_PER_MINUTE (default 50) and send password reset emails to 10,000 different addresses in under 5 minutes, making the true origin hard to trace, but this bypass alone cannot take over an account.

Read originalgithub.com