Asalam-0-Alikum,
Completing My RFI Series:
- Beginning of RFI
- Finding And Exploiting RFI vulnerabilities
- Securing RFI vulnerabilities
Secure user inputs!!!!
And not just those you THINK is used in SQL queries or include functions or etc. ALL user inputs should be secured. You do this by strip/disallow words or phrases or symbols in the user inputs. And the most common solution when it comes to RFI is just to make the page less dynamic and hardcode the pages. If you still want to have a dynamical editable page you MUST make sure you secure the user inputs. Check it for the word “http”, check it for the word “www.”, check it for “../”, check it for “?” etc etc. Disable “show PHP errors” in the PHP configuration. Do a file_exists() check. These are all easy things you can do to prevent RFI(and LFI, but that is again another story).
Here is a example on a dynamic page and a hardcoded page. The dynamic one is not secure, the hardcoded one is.
Dynamic:
PHP Code:
if (isset($_GET['page']))
{
include($_GET['page'] . “.php”);
}
else
{
echo('
page1
');
echo('page2
');
echo('page3
');
}
Hardcoded:
PHP Code:
if (isset($_GET['page']))
{
if ($_GET['page'] == “page1”)
include(“1.php”);
if ($_GET['page'] == “page2”)
include(“2.php”);
if ($_GET['page'] == “page3”)
include(“3.php”);
}
else
{
echo('
page1
');
echo('page2
');
echo('page3
');
}
0 Comments :
Post a Comment
Having Confusion ,oH Dear ask me in comments!!