Welcome Guest, Not a member yet? Register   Sign In
Let's make auto routes disable
#21

(03-25-2022, 09:10 PM)kenjis Wrote:
(03-25-2022, 08:08 PM)ChicagoPhil Wrote: My plan was to get the user status in the base controller constructor and then execute a permissions check in each method by default. That would avoid the pitfalls of using filters or auto routing?

Yes. If you protect the controller method directly, I mean you ensure permissions are always checked,
you won't make this vulnerability of auto routing and filters.

If you check the permissions in the controller constructor, it always runs when the controller is created and it can't be bypassed.
PHP language ensures it.

This vulnerability will be created when a controller method is accessible by a way that a developer does not expect,
and there is a way to bypass a checking, e.g. there is another route with no filters.

Another example is CSRF protection bypass.
The CSRF protection is also implemented as a controller filter, and it does not protect GET requests.
It is specification of the CSRF protection.

And auto routes make all controller methods accessible with GET requests.
So if a attacker makes a visitor to send GET request to an important controller method,
CSRF protection never protects.
But if you check the request method in the controller method, CSRF attack never succeed.
See https://codeigniter4.github.io/CodeIgnit...erequisite

That's helpful information right there. That might have slipped by me. I am getting a message that the getMethod method is deprecated but I just made up a method to run a check. Good deal!
Thanks again.
Reply


Messages In This Thread
Let's make auto routes disable - by kenjis - 02-21-2022, 07:45 PM
RE: Let's make auto routes disable - by iRedds - 02-21-2022, 09:54 PM
RE: Let's make auto routes disable - by kenjis - 02-21-2022, 10:42 PM
RE: Let's make auto routes disable - by InsiteFX - 02-22-2022, 02:06 AM
RE: Let's make auto routes disable - by iRedds - 02-22-2022, 02:11 AM
RE: Let's make auto routes disable - by luckmoshy - 02-22-2022, 05:26 AM
RE: Let's make auto routes disable - by kilishan - 02-22-2022, 07:25 AM
RE: Let's make auto routes disable - by kenjis - 02-22-2022, 04:25 PM
RE: Let's make auto routes disable - by kilishan - 02-22-2022, 09:43 PM
RE: Let's make auto routes disable - by seunex - 02-22-2022, 11:26 PM
RE: Let's make auto routes disable - by kenjis - 02-26-2022, 03:04 AM
RE: Let's make auto routes disable - by luckmoshy - 02-26-2022, 03:36 AM
RE: Let's make auto routes disable - by kenjis - 03-01-2022, 06:02 PM
RE: Let's make auto routes disable - by InsiteFX - 03-02-2022, 01:41 AM
RE: Let's make auto routes disable - by kenjis - 03-25-2022, 04:15 AM
RE: Let's make auto routes disable - by sneakyimp - 02-08-2023, 06:50 PM
RE: Let's make auto routes disable - by kenjis - 03-25-2022, 04:44 PM
RE: Let's make auto routes disable - by kenjis - 03-25-2022, 09:10 PM
RE: Let's make auto routes disable - by ChicagoPhil - 03-26-2022, 12:16 AM
RE: Let's make auto routes disable - by kenjis - 03-26-2022, 02:52 AM
RE: Let's make auto routes disable - by kenjis - 03-30-2022, 07:20 PM
RE: Let's make auto routes disable - by kenjis - 02-08-2023, 06:58 PM



Theme © iAndrew 2016 - Forum software by © MyBB