The vulnerability lies in the incorrect handling of the client's IP address for rate-limiting purposes. The getClientIp function in src/lib/auth/loginLimiter.js improperly trusts the user-controllable X-Forwarded-For header. This allows an attacker to bypass the brute-force protection of the login form. The POST function in src/app/api/auth/login/route.js is the API endpoint that consumes the vulnerable getClientIp function, making it the entry point for the attack. The patch addresses this by introducing a custom-server.js that intercepts requests, extracts the real IP address from the socket, and places it in a trusted header (x-9r-real-ip). The getClientIp function was modified to prioritize this new trusted header, effectively ignoring any spoofed X-Forwarded-For headers unless the server is explicitly configured to trust a proxy.