Skip to content

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