Necuima 18 Posted June 19, 2017 Report Share Posted June 19, 2017 Hi Larry, I recently came across an attempted hack via the index.php module (pages 57...). I checked the logs and they added additional stuff to the $_GET['p'] data. In case it is of interest, I think the code I have added should avoid that in the future: if (isset($_GET['p'])) { $p = $_GET['p']; // if there's any characters in there that shouldn't be, exit if (!preg_match("/^[a-z\_]/", $p)) { exit ("Invalid attempt to access this module"); } } else $p = NULL; Can you suggest a better way? Thanks, and Cheers Quote Link to post Share on other sites
Necuima 18 Posted June 19, 2017 Author Report Share Posted June 19, 2017 That regex should be /^[a-z\_]+$/ Oops Quote Link to post Share on other sites
Larry 428 Posted June 21, 2017 Report Share Posted June 21, 2017 That sounds good, however, I'm not sure it's necessary. The code as written, I believe, checks against static values and serves a default value if there's no match. So it doesn't matter what a user provides that doesn't match. But if you want to use the regex, that's fine, too, just make sure you keep it up to date as you add or change modules. (Or make sure your modules always fit within that definition.) Quote Link to post Share on other sites
Necuima 18 Posted June 22, 2017 Author Report Share Posted June 22, 2017 Thanks for your thoughts, Larry. They are always appreciated. Cheers Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.