-
Notifications
You must be signed in to change notification settings - Fork 11.7k
Open
Description
Laravel Version
12.x
PHP Version
8.2
Database Driver & Version
No response
Description
The url()->previousPath() function is intended to return the path of the previous url - this is derived from the referer header from the url()->previous() function. As the client sends the referer header, it is untrustworthy and it can be different from the apps url, which it is assumed to always be.
This can be simulated like so:
// assuming config('app.url') is `https://myapp.local/`
// client could technically send whatever referer
request()->headers->set('referer', 'http://www.google.com/blah');
// unexpected full url, not path
dd(url()->previousPath()); // "http://www.google.com/blah"
// expected: "/blah", or possibly exception?
This is possibly a security vulnerability if developers expect previousPath() to not only return paths, but also restrict it from returning if the url is different to the apps one.
Steps To Reproduce
--
iz-ahmad
Metadata
Metadata
Assignees
Labels
No labels