Skip to content

Instantly share code, notes, and snippets.

@kharissulistiyo
Created November 27, 2024 23:58
Show Gist options
  • Save kharissulistiyo/ae2adb60016ab427a6852202f6d965db to your computer and use it in GitHub Desktop.
Save kharissulistiyo/ae2adb60016ab427a6852202f6d965db to your computer and use it in GitHub Desktop.
Patch PHP Path Traversal vulnerability
<?php
$allowed_subpage = array('dashboard', 'profile', 'settings');
if ( Input::has( 'sub_page' ) ) {
$sub_page = Input::get( 'sub_page' );
if ( in_array( $sub_page, $allowed, true ) ) {
include_once tutor()->path . "views/pages/{$sub_page}.php";
return;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment