Skip to content

Commit

Permalink
Merge pull request #629 from m-fedosov/master
Browse files Browse the repository at this point in the history
file include vulnerabily a better teaching example
  • Loading branch information
digininja committed May 10, 2024
2 parents e5e7e23 + 9eca6f3 commit 0773216
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions vulnerabilities/fi/source/impossible.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,17 @@
$file = $_GET[ 'page' ];

// Only allow include.php or file{1..3}.php
if( $file != "include.php" && $file != "file1.php" && $file != "file2.php" && $file != "file3.php" ) {
// This isn't the page we want!
echo "ERROR: File not found!";
exit;
$configFileNames = [
'include.php',
'file1.php',
'file2.php',
'file3.php',
];

if( !in_array($file, $configFileNames) ) {
// This isn't the page we want!
echo "ERROR: File not found!";
exit;
}

?>

0 comments on commit 0773216

Please sign in to comment.