Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set secureHeaders property to prevent IP spoofing #15428

Open
wants to merge 1 commit into
base: 5.x
Choose a base branch
from

Conversation

nvdkemp
Copy link

@nvdkemp nvdkemp commented Jul 26, 2024

Description

In the craft\web\Request class the $ipHeaders property overwrites the default values set in the \yii\web\Request class. However the $secureHeaders property is not updated accordingly with the same headers.

This oversight allows users to spoof their IP addresses. For instance, if someone sets a spoofed Forwarded-For header to a random IP address, the method Craft::$app->getRequest()->getUserIP() will return this spoofed IP address instead of the user's real IP. This happens because the Forwarded-For header is not in the $secureHeaders property, making it vulnerable to manipulation.

Tested with Craft version 4.8.7

Related issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant