WebsiteBaker 2.13.8 is now available!
R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WBhttps://forum.websitebaker.org/index.php/topic,32355.0.html
<?php //color your live ;) if(isset($_POST['page_id']) AND is_numeric($_POST['page_id']) ) { $page_id = mysql_real_escape_string(strip_tags($_POST['page_id'])); } else { $page_id = '';} // create _SELF_ link, For testing hacker attempt below !!// Get page extension - .php $query_main_sett = $database->query("SELECT * FROM `".TABLE_PREFIX."settings` WHERE name = 'page_extension' "); $wb_main_sett = $query_main_sett->fetchRow(); $wb_default_page_extension = $wb_main_sett['value'];// Get PAGES directory $query_main_sett1 = $database->query("SELECT * FROM `".TABLE_PREFIX."settings` WHERE name = 'pages_directory' "); $wb_main_sett1 = $query_main_sett1->fetchRow(); $wb_default_pages_folder = $wb_main_sett1['value'];//Get page name from page_id $query_pages = $database->query("SELECT * FROM `".TABLE_PREFIX."pages` WHERE page_id = '$page_id' "); $this_page = $query_pages->fetchRow(); $self_link = WB_URL.$wb_default_pages_folder.$this_page['link'].$wb_default_page_extension;// Now, for my purposes, I needed additional variable to be icluded in URL string if(isset($_POST['com_id']) AND is_numeric($_POST['com_id']) ) { $com_id = mysql_real_escape_string(strip_tags($_POST['com_id'])); } else { $com_id = '';} // Prevent Hacking POST form $caller = $_SERVER['HTTP_REFERER']; $test = $self_link.'?'.$COMPANIES['FE_ACTION'].'='.$COMPANIES['FE_VIEW_COM'].'&'.$COMPANIES['FE_COM_NAME'].'='.$com_id; if ($caller != $test) { $match = 'bad';} else { $match = 'OK';} if (($com_id == '') OR ($page_id == '') OR ($match == 'bad')) { die(header('Location: ../../index.php')); }
<?php //color your live ;)$test = http://127.0.0.1:4001/xo/me/companies.php?action=see-company&company=2
<?php$ident = mt_rand();$_SESSION['pagename_here_ident'] = $ident;// display form?><form method="post" action="..."><input type="hidden" name="ident" value="<?php echo $ident; ?>">...
<?phpif(!isset($_POST['ident']) || !isset($_SESSION['pagename_here_ident']) || $_POST['ident']!=$_SESSION['pagename_here_ident']) { // form faked die(header("Location: ../../index.php"));}unset($_SESSION['pagename_here_ident']);// rest here
Every upload, field, ... is a form. All forms have to "pass" a Control inside WebsiteBaker. I doesn't matter if such form is in frontend, backend, module or core. Every form get's an individual token, e.g. "add_form_key('guestbook_bigtext');".Then the token gets validated via check_form_key('guestbook_bigtext');So every post is controlled quite good.
Next one - link hashes. First every log-in in backend / frontend get's a link_hash
If that would have been in WB, nobody could use the backup-exploit