<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.owasp.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Rahul+Chaudhary</id>
		<title>OWASP - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.owasp.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Rahul+Chaudhary"/>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php/Special:Contributions/Rahul_Chaudhary"/>
		<updated>2026-05-06T12:04:58Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.27.2</generator>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Tainted_String_Library&amp;diff=157615</id>
		<title>Tainted String Library</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Tainted_String_Library&amp;diff=157615"/>
				<updated>2013-08-31T10:55:47Z</updated>
		
		<summary type="html">&lt;p&gt;Rahul Chaudhary: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h4&amp;gt;Introduction:&amp;lt;/h4&amp;gt;&lt;br /&gt;
In any programming language, handling strings is definitely one of the most daunting and challenging work as they pose some very serious threats in any program. Even in PHP, there are many forms of strings that have the capacity to fully crack the application. What we need in these scenarios is to check each string for contaminated values and we also need a way to flag strings to indicate that these strings are &amp;quot;Tainted&amp;quot;.&lt;br /&gt;
&amp;lt;BR&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Need for this library:&amp;lt;/h4&amp;gt;&lt;br /&gt;
The only mode of the prevalent injection attacks are strings and thus they are very dangerous. Attackers craft many dangerous strings that can destroy the whole system. Thus, the program and applications need to work with safe strings. For this, we have developed this library that can flag a warning to the users when a dangerous string is used. With this library in use, all the strings that the developers thinks can cause problems - such as input fields, they can mark these strings as &amp;quot;tainted&amp;quot; and future use of these strings will generate an error if these strings are used anywhere in program without first decontaminating them.&lt;br /&gt;
&amp;lt;BR&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;PHPSEC Tainted String Implementation:&amp;lt;/h4&amp;gt;&lt;br /&gt;
To &amp;quot;taint&amp;quot; a string, we created a &amp;quot;Tainted&amp;quot; class which is an abstract class that defines functions to contaminate and decontaminate a string. In other words they create or remove flags from strings to show them that they are &amp;quot;tainted&amp;quot; or not. Another class that derives the &amp;quot;Tainted&amp;quot; class is called &amp;quot;TaintedString&amp;quot; class and is responsible to actually taint/un-taint a string.&lt;br /&gt;
&amp;lt;BR&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Tainted class&amp;lt;/b&amp;gt; contains the following functions:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;b&amp;gt;Is: &amp;lt;/b&amp;gt;This function tells if the string is marked as &amp;quot;tainted&amp;quot; or not. If the string is indeed marked as &amp;quot;tainted&amp;quot; then that means that other classes that uses this value will have to be careful before using it.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;b&amp;gt;contaminate: &amp;lt;/b&amp;gt;This function marks the string as &amp;quot;tainted&amp;quot;. I.e. if the user passes a string to this function, then this function will mark this string as &amp;quot;tainted&amp;quot; and future use of this string will generate warnings and developers will have to be careful in using this function.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;b&amp;gt;decontaminate: &amp;lt;/b&amp;gt;This function does the exact opposite of the &amp;quot;contaminte()&amp;quot; function. It removes the field that marks this particular string as &amp;quot;tainted&amp;quot;. It means that once the string becomes un-tainted then it can be used without worries and is safe for all purpose.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;TaintedString class&amp;lt;/b&amp;gt; contains the following functions:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;b&amp;gt;__construct: &amp;lt;/b&amp;gt;Being the constructor of this class, the job of this function is to store the string upon which this whole class is called upon. It takes the user given string and simply stores it for future use.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;b&amp;gt;__toString: &amp;lt;/b&amp;gt;This function overrides the &amp;quot;toString()&amp;quot; method in PHP. With the use of this function, the use of a tainted string will trigger an error that would warn the use of this string.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Other Helpful Links:&amp;lt;/h4&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahul Chaudhary</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Tainted_String_Library&amp;diff=157614</id>
		<title>Tainted String Library</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Tainted_String_Library&amp;diff=157614"/>
				<updated>2013-08-31T09:43:35Z</updated>
		
		<summary type="html">&lt;p&gt;Rahul Chaudhary: Created page with &amp;quot;&amp;lt;h4&amp;gt;Introduction:&amp;lt;/h4&amp;gt; In any programming language, handling strings is definately the most daunting and challenging work as they pose some very serios threats to any program....&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h4&amp;gt;Introduction:&amp;lt;/h4&amp;gt;&lt;br /&gt;
In any programming language, handling strings is definately the most daunting and challenging work as they pose some very serios threats to any program. Even in PHP, there are many forms of strings that have the capacity to fully crack the application. What we need in these scenarios is to check each string for contaminated values and we also need a way to flag strings to indicate that these strings are &amp;quot;Tainted&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Rahul Chaudhary</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Projects/OWASP_PHP_Security_Project/Roadmap&amp;diff=157613</id>
		<title>Projects/OWASP PHP Security Project/Roadmap</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Projects/OWASP_PHP_Security_Project/Roadmap&amp;diff=157613"/>
				<updated>2013-08-31T08:38:53Z</updated>
		
		<summary type="html">&lt;p&gt;Rahul Chaudhary: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;OWASP PHP Security project’s objective is to secure PHP libraries, and provide a full featured framework of standalone libraries for secure web applications in PHP, releasing them both as separate decoupled libraries and as a whole secure web application framework; where sample configuration and usage can be observed. Many aspects of this project are already handled, and are either added or being added to OWASP.&lt;br /&gt;
&amp;lt;BR&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== At present following libraries are supported (In alphabetical order): ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Access Control Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; RBAC Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Database Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Phpsec/Secure Database Library|Secure Database Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Exception and Error Control Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Error Handler Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''HTTP Protocol Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Phpsec/HTTP Request Handling Library|HTTP Request Handling Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[HTTP Response Handling Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Log Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Logs Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Scanner Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Static Scanner Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Sensitive Data Protection Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Secure Application Configuration and State Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Tainted String Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Secure Output Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Session Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Session Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Time and Randomness Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Time and Randomness Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''User Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[User Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[User Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Basic Password Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Advanced Password Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahul Chaudhary</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Projects/OWASP_PHP_Security_Project/Roadmap&amp;diff=157612</id>
		<title>Projects/OWASP PHP Security Project/Roadmap</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Projects/OWASP_PHP_Security_Project/Roadmap&amp;diff=157612"/>
				<updated>2013-08-31T08:38:16Z</updated>
		
		<summary type="html">&lt;p&gt;Rahul Chaudhary: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;OWASP PHP Security project’s objective is to secure PHP libraries, and provide a full featured framework of standalone libraries for secure web applications in PHP, releasing them both as separate decoupled libraries and as a whole secure web application framework; where sample configuration and usage can be observed. Many aspects of this project are already handled, and are either added or being added to OWASP.&lt;br /&gt;
&amp;lt;BR&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== At present following libraries are supported (In alphabetical order): ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Access Control Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; RBAC Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Database Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Phpsec/Secure Database Library|Secure Database Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Exception and Error Control Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Error Handler Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''HTTP Protocol Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Phpsec/HTTP Request Handling Library|HTTP Request Handling Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[HTTP Response Handling Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Log Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Logs Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Scanner Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Static Scanner Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Tainted String Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Secure Output Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Sensitive Data Protection Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Secure Application Configuration and State Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Session Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Session Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Time and Randomness Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Time and Randomness Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''User Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[User Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[User Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Basic Password Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Advanced Password Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahul Chaudhary</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Error_Handler_Library&amp;diff=157611</id>
		<title>Error Handler Library</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Error_Handler_Library&amp;diff=157611"/>
				<updated>2013-08-31T08:25:58Z</updated>
		
		<summary type="html">&lt;p&gt;Rahul Chaudhary: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h4&amp;gt;Introduction:&amp;lt;/h4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unlike other languages like Java, in PHP &amp;quot;Exceptions&amp;quot; are handled in a different way than &amp;quot;Errors&amp;quot;. In PHP, any anomaly in the logic such as &amp;quot;Divide by zero&amp;quot; are considered as errors and things such as &amp;quot;Trying to access a private property&amp;quot; is considered as &amp;quot;Exceptions&amp;quot;. &amp;quot;Exceptions&amp;quot; are thrown in PHP like any other language, but &amp;quot;Errors&amp;quot; are not thrown and they need to be converted to &amp;quot;Exceptions&amp;quot; and thrown accordingly by the programmer. This introduces many confusion among developers as they are accustomed to treat everything as an &amp;quot;Exception&amp;quot; and expect them to be thrown automatically.&lt;br /&gt;
&amp;lt;BR&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Need for this Library:&amp;lt;/h4&amp;gt;&lt;br /&gt;
PHP has a mechanism that allows the developers to set functions that they can register in case any error is generated. This function, once registered, is called whenever an error is generated and then it will be converted to an &amp;quot;Exception&amp;quot; and then will be thrown. In this library we take this task to register the function and to convert them to an &amp;quot;Exception&amp;quot; from the developers and do it ourselves so that they do not have to worry about this. This library first registers the function that converts &amp;quot;Errors&amp;quot; to &amp;quot;Exceptions&amp;quot; so that PHP can call this function and handle it properly in case any &amp;quot;Error&amp;quot; is generated. This function also has the job to convert the PHP &amp;quot;Error&amp;quot; to &amp;quot;Exception&amp;quot;. The name of the exception that is produced after the conversion is &amp;lt;b&amp;gt;&amp;quot;ErrorException&amp;quot;&amp;lt;/b&amp;gt;.&lt;br /&gt;
&amp;lt;BR&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;PHPSEC Error Handling Implementation:&amp;lt;/h4&amp;gt;&lt;br /&gt;
As per PHP requirements, we first need to define functions to register the function and then to shutdown the function. Then we need to define other methods such as method to convert the error to exceptions. Below is the list of all the function and their uses:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;b&amp;gt;enable: &amp;lt;/b&amp;gt;This method sets the phpsec error handler as error handler. What we mean is that once the developers calls this function, the PHP's own error handler passes the authority to handle PHP errors to this function. This function checks if the function is already registered or not and if not registered, this method registers our error handler using PHP's &amp;quot;set_error_handler&amp;quot; function. Similarly it also checks if the shutdown function is registered or not and if not registered, it registers our own shutdown function using &amp;quot;register_shutdown_function&amp;quot;. In addition to all the above mentioned task, it also saves the PHP's current error reporting state for in case the user wants to turn off our error reporting mechanism, they can go back to their own PHP's error reporting mechanism.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;b&amp;gt;disable: &amp;lt;/b&amp;gt;This function does the exact opposite of the &amp;quot;Enable&amp;quot; function. It first checks if the methods have been register or not and if registered, then it un-register them and reverts back to PHP's old error mechanism using &amp;quot;error_reporting()&amp;quot; and &amp;quot;restore_error_handler()&amp;quot; method.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;b&amp;gt;isActive: &amp;lt;/b&amp;gt;This function checks the if our error mechanism is currently active or not.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;b&amp;gt;_shutdown: &amp;lt;/b&amp;gt;This is registered as a shutdown function to catch fatal errors. It means that if PHP encounters some fatal errors that is causing the whole application to fail, then it calls this shutdown function before failing, thus giving the application a last chance to correct the fatal error and to save the application or to handle the error gracefully. Our implementation of this function only considers &amp;lt;b&amp;gt;&amp;quot;E_ERROR&amp;quot;, &amp;quot;E_CORE_ERROR&amp;quot;, &amp;quot;E_PARSE&amp;quot;, &amp;quot;E_COMPILE_ERROR&amp;quot; and &amp;quot;E_USER_ERROR&amp;quot;&amp;lt;/b&amp;gt; as fatal and simply warns the user of this error before failing the application.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;b&amp;gt;_errorToException: &amp;lt;/b&amp;gt;This function converts the PHP's error to &amp;quot;Exceptions&amp;quot;. The exception that is generated is called &amp;lt;b&amp;gt;&amp;quot;ErrorException&amp;quot;&amp;lt;/b&amp;gt;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;b&amp;gt;dump: &amp;lt;/b&amp;gt;It dumps an exception in readable format&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Other Helpful Links:&amp;lt;/h4&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahul Chaudhary</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Error_Handler_Library&amp;diff=157610</id>
		<title>Error Handler Library</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Error_Handler_Library&amp;diff=157610"/>
				<updated>2013-08-31T08:01:07Z</updated>
		
		<summary type="html">&lt;p&gt;Rahul Chaudhary: Created page with &amp;quot;&amp;lt;h4&amp;gt;Introduction:&amp;lt;/h4&amp;gt;  Unlike other languages like Java, in PHP &amp;quot;Exceptions&amp;quot; are handled in a different way than &amp;quot;Errors&amp;quot;. In PHP, any anomaly in the logic such as &amp;quot;Divide by...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h4&amp;gt;Introduction:&amp;lt;/h4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unlike other languages like Java, in PHP &amp;quot;Exceptions&amp;quot; are handled in a different way than &amp;quot;Errors&amp;quot;. In PHP, any anomaly in the logic such as &amp;quot;Divide by zero&amp;quot; are considered as errors and things such as &amp;quot;Trying to access a private property&amp;quot; is considered as &amp;quot;Exceptions&amp;quot;. &amp;quot;Exceptions&amp;quot; are thrown in PHP like any other language, but &amp;quot;Errors&amp;quot; are not thrown and they need to be converted to &amp;quot;Exceptions&amp;quot; and thrown accordingly by the programmer. This introduces many confusion among developers as they are accustomed to treat everything as an &amp;quot;Exception&amp;quot; and expect them to be thrown automatically.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Need for this Library:&amp;lt;/h4&amp;gt;&lt;br /&gt;
PHP has a mechanism that allows the developers to set functions that they can register in case any error is generated. This function, once registered, is called whenever an error is generated and then it will be converted to an &amp;quot;Exception&amp;quot; and then will be thrown. In this library we take this task to register the function and to convert them to an &amp;quot;Exception&amp;quot; from the developers and do it ourselves so that they do not have to worry about this. This library first registers the function that converts &amp;quot;Errors&amp;quot; to &amp;quot;Exceptions&amp;quot; so that PHP can call this function and handle it properly in case any &amp;quot;Error&amp;quot; is generated. This function also has the job to convert the PHP &amp;quot;Error&amp;quot; to &amp;quot;Exception&amp;quot;. The name of the exception that is produced after the conversion is &amp;lt;b&amp;gt;&amp;quot;ErrorException&amp;quot;&amp;lt;/b&amp;gt;.&lt;/div&gt;</summary>
		<author><name>Rahul Chaudhary</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Projects/OWASP_PHP_Security_Project/Roadmap&amp;diff=157609</id>
		<title>Projects/OWASP PHP Security Project/Roadmap</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Projects/OWASP_PHP_Security_Project/Roadmap&amp;diff=157609"/>
				<updated>2013-08-31T07:44:12Z</updated>
		
		<summary type="html">&lt;p&gt;Rahul Chaudhary: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;OWASP PHP Security project’s objective is to secure PHP libraries, and provide a full featured framework of standalone libraries for secure web applications in PHP, releasing them both as separate decoupled libraries and as a whole secure web application framework; where sample configuration and usage can be observed. Many aspects of this project are already handled, and are either added or being added to OWASP.&lt;br /&gt;
&amp;lt;BR&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== At present following libraries are supported (In alphabetical order): ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Access Control Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; RBAC Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Database Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Phpsec/Secure Database Library|Secure Database Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Exception and Error Control Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Error Handler Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''HTTP Protocol Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Phpsec/HTTP Request Handling Library|HTTP Request Handling Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[HTTP Response Handling Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Sensitive Date Protection Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Secure Application Configuration and State Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Session Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Session Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Time and Randomness Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Time and Randomness Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''User Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[User Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[User Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Basic Password Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Advanced Password Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahul Chaudhary</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=HTTP_Response_Handling_Library&amp;diff=156048</id>
		<title>HTTP Response Handling Library</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=HTTP_Response_Handling_Library&amp;diff=156048"/>
				<updated>2013-07-26T07:30:38Z</updated>
		
		<summary type="html">&lt;p&gt;Rahul Chaudhary: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h4&amp;gt;Introduction&amp;lt;/h4&amp;gt;&lt;br /&gt;
Secure PHP Static HTTP Response Handling Library is to control the downloadable contents in the library. With control we mean the download speed with which the files are served to the users. Developers can use this library to set a speed limit on the files. This library also contains functions to resume download which is supported in most of the browsers and assists download managers.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;Functions in this library&amp;lt;/h4&amp;gt;&lt;br /&gt;
Lists of functions in this library and their uses are as follows:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;MIME: &amp;lt;/b&amp;gt;This function is used to find out the extension of files and to determine their types from their extensions.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;isModifiedSince: &amp;lt;/b&amp;gt;This function is used to calculate if the file has changed since the user last visited that page. If the file has been changed since the last visit, then true is returned indicating the browser to re-download the file.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;calculateHTTPRange: &amp;lt;/b&amp;gt;This function is used to calculate which parts of file have been downloaded and which parts have NOT been downloaded. With this knowledge, the browsers and the download managers can be instructed to download only the remaining parts.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;download: &amp;lt;/b&amp;gt;This function is used to download a file. This function is the central function that uses all of the above functions and many others to impose limits on the file download speed and to serve only those parts of file which needs to be downloaded. This function also rewrites the HTTP headers for indicating the browsers about the details of the content it is serving.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;serveData: &amp;lt;/b&amp;gt;This function is used to serve some data to the client. This is different from serving a file. There is no limit nor restrictions on the download of this chunk of data. This chunk of data is served as a whole and not in parts.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;Other Helpful Links&amp;lt;/h4&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahul Chaudhary</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=HTTP_Response_Handling_Library&amp;diff=156047</id>
		<title>HTTP Response Handling Library</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=HTTP_Response_Handling_Library&amp;diff=156047"/>
				<updated>2013-07-26T06:55:36Z</updated>
		
		<summary type="html">&lt;p&gt;Rahul Chaudhary: Created page with &amp;quot;&amp;lt;h4&amp;gt;Introduction&amp;lt;/h4&amp;gt; Secure PHP Static HTTP Response Handling Library is to control the downloadable contents in the library. With control we mean the download speed with whi...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h4&amp;gt;Introduction&amp;lt;/h4&amp;gt;&lt;br /&gt;
Secure PHP Static HTTP Response Handling Library is to control the downloadable contents in the library. With control we mean the download speed with which the files are served to the users. Developers can use this library to set a speed limit on the files. This library also contains functions to resume download which is supported in most of the browsers and assists download managers.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;Functions in this library&amp;lt;/h4&amp;gt;&lt;br /&gt;
Lists of functions in this library and their uses are as follows:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;MIME :&amp;lt;/b&amp;gt;This function is used to find out the extension of the files and to determine the type of the files from their extensions.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahul Chaudhary</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Projects/OWASP_PHP_Security_Project/Roadmap&amp;diff=156046</id>
		<title>Projects/OWASP PHP Security Project/Roadmap</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Projects/OWASP_PHP_Security_Project/Roadmap&amp;diff=156046"/>
				<updated>2013-07-26T06:44:28Z</updated>
		
		<summary type="html">&lt;p&gt;Rahul Chaudhary: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;OWASP PHP Security project’s objective is to secure PHP libraries, and provide a full featured framework of standalone libraries for secure web applications in PHP, releasing them both as separate decoupled libraries and as a whole secure web application framework; where sample configuration and usage can be observed. Many aspects of this project are already handled, and are either added or being added to OWASP.&lt;br /&gt;
&amp;lt;BR&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== At present following libraries are supported (In alphabetical order): ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Access Control Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; RBAC Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Database Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Secure Database Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Exception and Error Control Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Error Handler Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''HTTP Protocol Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; HTTP Request Handling Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[HTTP Response Handling Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Sensitive Date Protection Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Secure Application Configuration and State Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Session Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Session Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Time and Randomness Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Time and Randomness Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''User Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[User Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[User Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Basic Password Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Advanced Password Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahul Chaudhary</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Secure_Application_Configuration_and_State_Library&amp;diff=156045</id>
		<title>Secure Application Configuration and State Library</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Secure_Application_Configuration_and_State_Library&amp;diff=156045"/>
				<updated>2013-07-26T04:25:11Z</updated>
		
		<summary type="html">&lt;p&gt;Rahul Chaudhary: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h4&amp;gt;Introduction&amp;lt;/h4&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;new \PDO (&amp;quot;mysql:dbname='pdo_mysql';host='localhost';&amp;quot;, &amp;quot;root&amp;quot;, &amp;quot;myPassword&amp;quot;);&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
In any application there are several lines, as the one given above, that contains some data that are extremely sensitive and not to be seen. Nevertheless, they have to be in files and codes for the application to work properly (In the above case, to create a successful connection to the DB). These confidential data if compromised, has the potential to end the life-time of the application. The attackers can use the password for anything ranging from passive monitoring to actively deleting all the data. That's enough to bring a company down. For this reason, these sensitive data needs to be protected. The function of this library is to protect these data from being stolen.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;What is sensitive ?&amp;lt;/h4&amp;gt;&lt;br /&gt;
A sensitive piece of data is any data that if known publicly, can aid in unauthorized access or kind of malfunction in the system. The range of this data can be from &amp;quot;passwords&amp;quot; to &amp;quot;configuration files&amp;quot;. Data such as version no, file locations etc can be harmful. Thus, they can also be treated as sensitive. Overall, the term is very vague and its meaning cannot be made clearer until a context is provided. Thus, the developers can assume any data to be sensitive which they feel no one else must know.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;Requirements&amp;lt;/h4&amp;gt;&lt;br /&gt;
For this library to work, there is one and only one requirement - that '''the files must be writable'''. We also understand that in main server this is not true for most of the time. In those cases, the developers must encrypt the values by hand and the decryption will be performed by the function. If however, the files are writable, this function will work and will encrypt the sensitive values in replace them in the file.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;PHPSEC Secure Application Configuration and State Library Implementation&amp;lt;/h4&amp;gt;&lt;br /&gt;
This work-flow of this library is pretty simple, but yet powerful. When the file is run for the first time in the server, it will contain sensitive data. However all those places which are sensitive, will be using this function &amp;quot;confidentialString()&amp;quot;. So, in the first run, this function, wherever found, will replace that sensitive value with its corresponding encrypted value. Since second run, wherever this value is needed, the encrypted value will again pass through this function, get decrypted and used. Please note that the value in the file is not getting replaced again with the decrypted value, but is used as a variable which gets destroyed once the program execution stops.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
For encryption we are using PHP's &amp;quot;mcrypt()&amp;quot; function. Default cipher used is &amp;quot;MCRYPT_RIJNDAEL_256&amp;quot; in &amp;quot;cbc&amp;quot; mode. However, these parts are configurable. The developers are free to choose their own schemes. As described earlier, this function needs the files to be writable. If not, this function throws a &amp;quot;FileNotWritable&amp;quot; exception. If that is the case, then the developers will need to place the encrypted value of the confidential strings manually everywhere.&lt;br /&gt;
&amp;lt;BR&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;Other Helpful Links&amp;lt;/h4&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahul Chaudhary</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Secure_Application_Configuration_and_State_Library&amp;diff=156025</id>
		<title>Secure Application Configuration and State Library</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Secure_Application_Configuration_and_State_Library&amp;diff=156025"/>
				<updated>2013-07-25T14:12:35Z</updated>
		
		<summary type="html">&lt;p&gt;Rahul Chaudhary: Created page with &amp;quot;&amp;lt;h4&amp;gt;Introduction&amp;lt;/h4&amp;gt; new \PDO (&amp;quot;mysql:dbname='pdo_mysql';host='localhost';&amp;quot;, &amp;quot;root&amp;quot;, &amp;quot;myPassword&amp;quot;); &amp;lt;BR&amp;gt; In any application there are several lines, as the one given above, t...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h4&amp;gt;Introduction&amp;lt;/h4&amp;gt;&lt;br /&gt;
new \PDO (&amp;quot;mysql:dbname='pdo_mysql';host='localhost';&amp;quot;, &amp;quot;root&amp;quot;, &amp;quot;myPassword&amp;quot;);&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
In any application there are several lines, as the one given above, that contains some data that are extremely sensitive and not to be seen. Nevertheless, they have to be in files and codes for the application to work properly (In the above case, to create a successful connection to the DB). These confidential data if compromised, has the potential to end the life-time of the application. The attackers can use the password for anything ranging from passive monitoring to actively deleting all the data. That's enough to bring a company down. For this reason, these sensitive data needs to be protected. The function of this library is to protect these data from being stolen.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;What is sensitive ?&amp;lt;/h4&amp;gt;&lt;br /&gt;
A sensitive piece of data is any data that if known publicly, can aid in unauthorized access or kind of malfunction in the system. The range of this data can be from &amp;quot;passwords&amp;quot; to &amp;quot;configuration files&amp;quot;. Data such as version no, file locations etc can be harmful. Thus, they can also be treated as sensitive. Overall, the term is very vague and its meaning cannot be made clearer until a context is provided. Thus, the developers can assume any data to be sensitive which they feel no one else must know.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahul Chaudhary</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Projects/OWASP_PHP_Security_Project/Roadmap&amp;diff=156024</id>
		<title>Projects/OWASP PHP Security Project/Roadmap</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Projects/OWASP_PHP_Security_Project/Roadmap&amp;diff=156024"/>
				<updated>2013-07-25T13:56:08Z</updated>
		
		<summary type="html">&lt;p&gt;Rahul Chaudhary: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;OWASP PHP Security project’s objective is to secure PHP libraries, and provide a full featured framework of standalone libraries for secure web applications in PHP, releasing them both as separate decoupled libraries and as a whole secure web application framework; where sample configuration and usage can be observed. Many aspects of this project are already handled, and are either added or being added to OWASP.&lt;br /&gt;
&amp;lt;BR&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== At present following libraries are supported (In alphabetical order): ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Access Control Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; RBAC Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Database Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Secure Database Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Exception and Error Control Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Error Handler Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''HTTP Protocol Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; HTTP Request Handling Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; HTTP Response Handling Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Sensitive Date Protection Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Secure Application Configuration and State Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Session Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Session Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Time and Randomness Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Time and Randomness Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''User Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[User Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[User Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Basic Password Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Advanced Password Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahul Chaudhary</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Time_and_Randomness_Management_Library&amp;diff=156023</id>
		<title>Time and Randomness Management Library</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Time_and_Randomness_Management_Library&amp;diff=156023"/>
				<updated>2013-07-25T13:49:59Z</updated>
		
		<summary type="html">&lt;p&gt;Rahul Chaudhary: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h4&amp;gt;Introduction&amp;lt;/h4&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Time: &amp;lt;/b&amp;gt;This library is a wrapper library for PHPs own &amp;quot;time()&amp;quot; function. With the use of this library, our aim was to isolate our system with the &amp;quot;system clock&amp;quot; which is used by the PHP's &amp;quot;time()&amp;quot; function. A separate wrapper for time lets us move time forward (future) or backwards (past) without changing the actual system time. This central library can be reset-ed to a different time and that time would be reflected in all of the application, without having to change any other component in the system or application.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Random: &amp;lt;/b&amp;gt;This library is the central library to generate random numbers and strings for the whole application. Using this library we can generate cryptographically random strings of any length. This function also produces random integers.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;Need for Time and Randomness Library&amp;lt;/h4&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Time: &amp;lt;/b&amp;gt;With time, developers often feel the need to change the system time - maybe for testing purpose or for different time-zones. Whatever is the case, developers find a hard time using normal PHP's &amp;quot;time()&amp;quot; function. To change time to some other time, they have to change system time, which is not only insecure, but will also affect many functions inside the host operating systems which heavily depend on time, such as Cron jobs and time-triggered events. This also is not recommended on main servers as this can corrupt other authentication servers such as &amp;quot;Kerberos&amp;quot;. Also it may give an attacker a window to launch some attacks to time-dependent functions. Thus, for all the reasons stated above, we strongly felt the need to generate a wrapper for time, so that change of time within an application can be isolated and controlled. With this we mean that change in time in one application must not affect any other application or system outside the scope of the application. To keep consistency between our application and PHP, we created our &amp;quot;time()&amp;quot; function with the same name as PHP's &amp;quot;time()&amp;quot; function. Thus within our library, calling &amp;quot;time()&amp;quot; function automatically calls PHPSEC's time() function rather than PHP's time() function.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Random: &amp;lt;/b&amp;gt;Similarly the need of randomness is crucial in an application. With random strings being so important in a secure application and because not having a separate function in PHP's library for generating a cryptographically secure random string of desired length, we decided to create a separate central library that can provide random strings of desired length. With this library the developers can create secure strings of desired length and can also generate a random integer within a desired range. To keep consistency between our application and PHP, we created our &amp;quot;rand()&amp;quot; function with the same name as PHP's &amp;quot;rand()&amp;quot; function. Thus within our library, calling &amp;quot;rand()&amp;quot; function automatically calls PHPSEC's rand() function rather than PHP's rand() function.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;PHPSEC Time and Randomness Library Implementation&amp;lt;/h4&amp;gt;&lt;br /&gt;
Time and Randomness libraries are core libraries. Unlike other libraries, core libraries are used by mostly all of the other libraries for various functions. With time and randomness being core, we can use their time() and rand() function wherever they are needed in the application. These libraries do not depend on any other component of the application and are truly stand-alone libraries. Their implementation details are as follows:&lt;br /&gt;
&amp;lt;BR&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Time: &amp;lt;/b&amp;gt;Time library contains one function inside &amp;quot;phpsec&amp;quot; namespace - &amp;quot;time()&amp;quot;. This library takes two arguments - the first argument is &amp;quot;mode&amp;quot; and the next argument is &amp;quot;desired time&amp;quot;. By default &amp;quot;mode&amp;quot; is &amp;quot;CURR&amp;quot; and &amp;quot;desired time&amp;quot; is &amp;quot;0&amp;quot;. Types of mode that are possible in our time() function are:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;b&amp;gt;CURR: &amp;lt;/b&amp;gt;Used to request current time as specified. i.e. if the developer has set time to March 7, Sun, 1971, then this mode will return the current time that has passed since that time was kept.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;b&amp;gt;SET: &amp;lt;/b&amp;gt;Used to set time to a desired time. The second argument here takes the desired time in unix timestamp format.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;b&amp;gt;RESET: &amp;lt;/b&amp;gt;Used to reset time to the original system time.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;b&amp;gt;MOV: &amp;lt;/b&amp;gt;Used to move time backward. The second argument here takes the time difference that is to be moved. e.g. 3600 will move the clock backward 3600 seconds.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;b&amp;gt;SYS: &amp;lt;/b&amp;gt;Used to request system time. This mode will return the correct system time irrespective of the fact that the clock is moved forward or backward. Note the this does not changes the user-defined time. This just returns the correct system time.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Random: &amp;lt;/b&amp;gt;Random library contains two functions inside &amp;quot;phpsec&amp;quot; namespace - &amp;quot;rand()&amp;quot; and &amp;quot;randstr()&amp;quot;. The former method is used to get random integer between a specified range and the latter function is used to get a random string of specified length. The &amp;quot;rand()&amp;quot; function takes two parameters - &amp;quot;min (Defaults to 0)&amp;quot; and &amp;quot;max (Defaults to null)&amp;quot;. The other function &amp;quot;randstr()&amp;quot; takes only one parameter - the length of the string desired (defaults to 32). To generate a random string, we use the openssl function (openssl_random_pseudo_bytes). If that function is somehow not present, we use (posix_getpid()) and (memory_get_usage()) to generate the random string.&lt;br /&gt;
&amp;lt;BR&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;Other Helpful Links&amp;lt;/h4&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahul Chaudhary</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Time_and_Randomness_Management_Library&amp;diff=156022</id>
		<title>Time and Randomness Management Library</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Time_and_Randomness_Management_Library&amp;diff=156022"/>
				<updated>2013-07-25T12:55:33Z</updated>
		
		<summary type="html">&lt;p&gt;Rahul Chaudhary: Created page with &amp;quot;&amp;lt;h4&amp;gt;Introduction&amp;lt;/h4&amp;gt; &amp;lt;ul&amp;gt; &amp;lt;li&amp;gt; &amp;lt;b&amp;gt;Time: &amp;lt;/b&amp;gt;This library is a wrapper library for PHPs own &amp;quot;time()&amp;quot; function. With the use of this library, our aim was to isolate our system ...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h4&amp;gt;Introduction&amp;lt;/h4&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Time: &amp;lt;/b&amp;gt;This library is a wrapper library for PHPs own &amp;quot;time()&amp;quot; function. With the use of this library, our aim was to isolate our system with the &amp;quot;system clock&amp;quot; which is used by the PHP's &amp;quot;time()&amp;quot; function. A separate wrapper for time lets us move time forward (future) or backwards (past) without changing the actual system time. This central library can be reset-ed to a different time and that time would be reflected in all of the application, without having to change any other component in the system or application.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Random: &amp;lt;/b&amp;gt;This library is the central library to generate random numbers and strings for the whole application. Using this library we can generate cryptographically random strings of any length. This function also produces random integers.&lt;br /&gt;
&amp;lt;BR&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;Need for Time and Randomness Library&amp;lt;/h4&amp;gt;&lt;br /&gt;
With time, developers often feel the need to change the system time - maybe for testing purpose or for different time-zones. Whatever is the case, developers find a hard time using normal PHP's &amp;quot;time()&amp;quot; function. To change time to some other time, they have to change system time, which is not only insecure, but will also affect many functions inside the host operating systems which heavily depend on time, such as Cron jobs and time-triggered events. This also is not recommended on main servers as this can corrupt other authentication servers such as &amp;quot;Kerberos&amp;quot;. Also it may give an attacker a window to launch some attacks to time-dependent functions. Thus, for all the reasons stated above, we strongly felt the need to generate a wrapper for the time, so that change of time within an application can be isolated and controlled. With this we mean that change in time in one application must not affect any other application or system outside the scope of the application.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Similarly the need of randomness is crucial in an application. With random strings being so important in a secure application and because not having a separate function in PHP's library for generating a cryptographically secure random string of desired length, we decided to create a separate central library that can provide random strings of desired length. With this library the developers can create secure strings of desired length and can also generate a random integer within a desired range.&lt;/div&gt;</summary>
		<author><name>Rahul Chaudhary</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Projects/OWASP_PHP_Security_Project/Roadmap&amp;diff=156009</id>
		<title>Projects/OWASP PHP Security Project/Roadmap</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Projects/OWASP_PHP_Security_Project/Roadmap&amp;diff=156009"/>
				<updated>2013-07-25T10:21:08Z</updated>
		
		<summary type="html">&lt;p&gt;Rahul Chaudhary: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;OWASP PHP Security project’s objective is to secure PHP libraries, and provide a full featured framework of standalone libraries for secure web applications in PHP, releasing them both as separate decoupled libraries and as a whole secure web application framework; where sample configuration and usage can be observed. Many aspects of this project are already handled, and are either added or being added to OWASP.&lt;br /&gt;
&amp;lt;BR&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== At present following libraries are supported (In alphabetical order): ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Access Control Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; RBAC Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Database Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Secure Database Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Exception and Error Control Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Error Handler Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''HTTP Protocol Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; HTTP Request Handling Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; HTTP Response Handling Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Sensitive Date Protection Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Secure Application Configuration and State Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Session Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Session Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Time and Randomness Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Time and Randomness Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''User Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[User Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[User Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Basic Password Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Advanced Password Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahul Chaudhary</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Advanced_Password_Management_Library&amp;diff=155660</id>
		<title>Advanced Password Management Library</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Advanced_Password_Management_Library&amp;diff=155660"/>
				<updated>2013-07-18T23:35:43Z</updated>
		
		<summary type="html">&lt;p&gt;Rahul Chaudhary: Created page with &amp;quot;&amp;lt;h4&amp;gt;Introduction&amp;lt;/h4&amp;gt; Advanced Password Management Library works on top of &amp;quot;Basic Password Management Library&amp;quot;. It provides additional functionality to help developers mit...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h4&amp;gt;Introduction&amp;lt;/h4&amp;gt;&lt;br /&gt;
Advanced Password Management Library works on top of &amp;quot;[[Basic Password Management Library]]&amp;quot;. It provides additional functionality to help developers mitigate the risks of password theft and misuse. Though advised to use this library in conjunction with &amp;quot;[[Basic Password Management Library]]&amp;quot;, this library is a stand-alone library. It can also be imported directly in existing projects and its functions can be used directly. This library provides few, but advanced functions to catch misuse of passwords and to assist advanced authentication mechanisms. These terms are described below in detail.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;PHPSEC Advanced Password Management Implementation&amp;lt;/h4&amp;gt;&lt;br /&gt;
This following type of functions are provided in this library:&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Brute Force Detection: &amp;lt;/b&amp;gt;This function has the capability to detect if a brute-search is in progress. It monitors the time difference between two login attempts and calculates if the login attempt was made by a human or a bot.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Temporary Password: &amp;lt;/b&amp;gt;Function to generate a temporary password. Developers can use this function in various cases. For e.g. in case if a user forgets his/her password, developer can device functions to generate a temporary password using this function to be sent to the user's email to reset their password. Additionally, this function can be used for two-factor authentications where for sensitive transactions, a separate temporary password is needed to be sent to user in their email/other device/mobile phones, etc. Possibilities are endless.&lt;br /&gt;
&amp;lt;BR&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;Other Helpful Links&amp;lt;/h4&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Password Storage Cheat Sheet]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Forgot Password Cheat Sheet]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahul Chaudhary</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Projects/OWASP_PHP_Security_Project/Roadmap&amp;diff=155659</id>
		<title>Projects/OWASP PHP Security Project/Roadmap</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Projects/OWASP_PHP_Security_Project/Roadmap&amp;diff=155659"/>
				<updated>2013-07-18T23:12:21Z</updated>
		
		<summary type="html">&lt;p&gt;Rahul Chaudhary: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;OWASP PHP Security project’s objective is to secure PHP libraries, and provide a full featured framework of standalone libraries for secure web applications in PHP, releasing them both as separate decoupled libraries and as a whole secure web application framework; where sample configuration and usage can be observed. Many aspects of this project are already handled, and are either added or being added to OWASP.&lt;br /&gt;
&amp;lt;BR&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== At present following libraries are supported (In alphabetical order): ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Access Control Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; RBAC Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Database Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Secure Database Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Exception and Error Control Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Error Handler Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''HTTP Protocol Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; HTTP Request Handling Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; HTTP Response Handling Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Sensitive Date Protection Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Secure Application Configuration and State Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Session Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Session Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Time and Randomness Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Time and Randomness Management Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''User Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[User Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[User Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Basic Password Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Advanced Password Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahul Chaudhary</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Basic_Password_Management_Library&amp;diff=155658</id>
		<title>Basic Password Management Library</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Basic_Password_Management_Library&amp;diff=155658"/>
				<updated>2013-07-18T23:12:00Z</updated>
		
		<summary type="html">&lt;p&gt;Rahul Chaudhary: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h4&amp;gt;Introduction&amp;lt;/h4&amp;gt;&lt;br /&gt;
If web-application is a dungeon, then passwords are the dragons guarding entrance to the application. They are the single entities that keeps a user safe. There are so many things that could go wrong with passwords. There are also many challenges that needs to be addressed to make passwords safe from prying eyes. Right from generation of password to storing of passwords, everything has to be perfect, otherwise attackers would be able to crack it. No wonder hackers target password cracking as a high target - the payoff is too rich. With passwords cracked there are no or very few mechanisms in place to stop you from accessing the account. This library of ours provides developers some functions that helps them create a strong password, verify them, and store them in a correct manner. In this library, you can also find a rich variety of functions that helps identify patterns in your password that are exploited most by the attackers. &lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;Where things go wrong ?&amp;lt;/h4&amp;gt;&lt;br /&gt;
To demonstrate how passwords are exploited and to differentiate between a strong and a weak password, here are few points :&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Many users follow a common pattern in their passwords such as their birth-dates, their phone number, their nick-names etc. This common behavior is not so random as it seems to the user and attackers use this behavior to crack their passwords by trying combination of their personal data.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; With advanced computing power and massive parallel processing, passwords of shorter length can easily be guessed using brute search. Weak passwords can be cracked now only in few hours.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Passwords must be stored in system using &amp;quot;Hashing&amp;quot;. Storing plain passwords in your database is unethical, wrong and extremely dangerous. Therefore, passwords must be hashed before storing them. Also the hashing algorithm used must be cryptographically secure and must produce a long random string, otherwise they can be cracked.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Recent events have proved that plain hashing of passwords is not enough. That can be easily cracked. Techniques such as &amp;quot;rainbow tables&amp;quot; and &amp;quot;Pre-compiled Passwords&amp;quot; makes cracking of plain hashed passwords very easy. Therefore it is necessary to first &amp;quot;salt&amp;quot; the plain password and then use hashing algorithms on them. Salting a password means to mix a random value to all the passwords so that their hashes can be changed. Salts are not sensitive data. They are just simple random values used to change the hash of a password so that pre-compiled tables cannot be used for cracking. To be more secure, it is advised to use dynamic salts in conjunction to a static salts i.e. the passwords must be mixed with a static string that all other passwords are salted with and also a dynamic string unique to that password only. This way the attackers won't be able to crack passwords even if they know the static salt beforehand.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; To secure a password, it is necessary for them to at-least contain some degree of randomness. A password secure if it is random. A non-random password will get cracked irrespective of their length.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;PHPSEC Basic Password Management Implementation&amp;lt;/h4&amp;gt;&lt;br /&gt;
This library contains many functions to detect specific patterns in a string, calculates randomness in a string, password hashing and salting etc. These functions helps developer to calculate strength in a string or they can use our provided functions. Here is a list of common types of functions that you could find in this library:&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Password Hashing: &amp;lt;/b&amp;gt;Function to properly mix static and dynamic salt to a password and then to calculate its hash.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Password Verification: &amp;lt;/b&amp;gt;Function to calculate the hash of the new string and to compare it with the hash of the old password to check if the new string and the user's password are same.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Password Entropy: &amp;lt;/b&amp;gt;Function to calculate &amp;quot;randomness&amp;quot; in a string. Using this function, developers can quantify &amp;quot;randomness&amp;quot; in a string.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Pattern Recognition in Strings: &amp;lt;/b&amp;gt;Set of functions that are capable to recognizing specific patterns in a string. Patterns such as as &amp;quot;phone no&amp;quot;, &amp;quot;dates&amp;quot;, &amp;quot;alphabetic characters such as abcde&amp;quot;, &amp;quot;keyboard characters such as qwerty&amp;quot; etc.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Password Strength: &amp;lt;/b&amp;gt;Function to check the strength of a string on scale 0 to 1. This function uses above methods to calculate score of a password.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Password Generation: &amp;lt;/b&amp;gt;Function to generate a password of specified strength. Strength can be between 0 and 1.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Misc Functions: &amp;lt;/b&amp;gt;Other functions that provides common functions necessary for this library to work. &lt;br /&gt;
&amp;lt;BR&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;Other Helpful Links&amp;lt;/h4&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Password Storage Cheat Sheet]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Forgot Password Cheat Sheet]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahul Chaudhary</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Session_Management_Library&amp;diff=155657</id>
		<title>Session Management Library</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Session_Management_Library&amp;diff=155657"/>
				<updated>2013-07-18T22:52:08Z</updated>
		
		<summary type="html">&lt;p&gt;Rahul Chaudhary: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h4&amp;gt;Introduction&amp;lt;/h4&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
A session management library is used to manage multiple sessions. Sessions are used in web-application to store some user data. Since HTTP connections are connection-less, the application needs a way to associate all transactions to its user to make the application dynamic in nature. For e.g. take the scenario of an online marketing website selling some goods. This application has many customs and they do a lot of transaction. Since the HTTP connection is connection-less, the application cannot differentiate between each connection and cannot know what the user did previously. Hence sessions are used on top of the HTTP protocol to remember data about clients. In sessions, during the client-server handshake process, the server allocates an unique ID to the client. Usually client stores this ID in its cookies. After the first connection, the client can produce this ID to the server so that the server can pull records from the application about this user. This way the servers associate transactions with users in an application.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;With many users (each user can have multiple sessions and they might be using multiple devices to access the application) the task of keeping track of sessions, storing and retrieving data, expiring sessions, etc. become a challenging task. This is where &amp;quot;Session Management Library&amp;quot; steps in. Its sole purpose is to look and manage sessions in an application so that security risks can be mitigated from the abusive and careless use of sessions.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;Problems with Sessions&amp;lt;/h4&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
There is no denying that sessions give applications huge amount of power. But with great power comes great responsibility. Hence its important to keep the sessions safe. Failing to do so creates security holes in the application so severe that security of the whole application can be compromised. There are many reasons to keep the sessions safe:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sessions represents a user identity. If these gets leaked, then an attacker can pose as a legitimate client and can ask server for user data.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Several attacks such as &amp;quot;Session Hijacking&amp;quot; and &amp;quot;Session Fixation&amp;quot; persists.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sessions often are stored in cookies, and cookies can be stolen via several methods. Hence all cookie related attacks automatically affects sessions.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Stolen sessions are very hard to detect by the system, because stolen sessions acts as normal sessions and there is no anomaly whatsoever. There are methods such as &amp;quot;User-behavior detection&amp;quot;, but they are not very much effective until a strong anomaly is detected.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;PHPSEC Session Management Implementation&amp;lt;/h4&amp;gt;&lt;br /&gt;
In this library we have tried to eradicate all of the possible vulnerabilities inside sessions. To ease the process of session management, we have provided several simple functions which makes the task easy and more efficient to handle. These functions internally use a number of methods to handle session vulnerabilities. Each of those methods are over-viewed here in each paragraph.&lt;br /&gt;
&amp;lt;BR&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Databases over cookies: &amp;lt;/b&amp;gt;The first issue that I would like to address is the use of cookies and its harmful effects. The server stores all the session data inside path defined under &amp;quot;session.save_path&amp;quot;. But the session IDs are stored in client's browser, inside cookies. Its the client's responsibility to send this cookie to the server each time. Now every time the client sends this sensitive piece of information, there is a chance that this might be hijacked using some means. e.g. passive attacks, because in HTTP connections, nothing is encrypted. Therefore we decided to control this situation using databases to store session IDs instead of cookies. Also the session data is stored in databases instead in files and folders. This way the user does not have to send their IDs each time. The application itself can access session data using the user's username. The application can also create several sessions for user in the database and link them with user's username.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Session Timeouts: &amp;lt;/b&amp;gt;We have provided functions to delete a session after a certain period of time. This introduces a time-frame to attackers because after that time-frame, the stolen session ID will be destroyed. There are two ways to delete a session. First is &amp;lt;b&amp;gt;Session Inactivity Timeout&amp;lt;/b&amp;gt;, where the session gets deleted if a user was not active for a certain period of time. Second is &amp;lt;b&amp;gt;Session Expiry Timeout&amp;lt;/b&amp;gt;, where the session gets deleted once its maximum lifetime has reached.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Session Length and Randomness: &amp;lt;/b&amp;gt;With modern day computing power and advancement in parallel processing, its trivial to break a short string via brute-search. However a long string cannot guarantee your safety if its not random. Hence, we need long and cryptographically secure random strings to be able to defend against these kinds of attacks. In our library, we generate strings of length &amp;gt;= 32 which are also cryptographically random, thus making our session IDs safe from those attacks.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Session Refresh: &amp;lt;/b&amp;gt;Sessions can be refreshed in a number of events - such as user activity before time expires. Therefore we have provided functions to refresh a session. This makes the sessions as good as new by updating its &amp;quot;creation date&amp;quot; and &amp;quot;User Last Activity&amp;quot; time.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Session Rolling: &amp;lt;/b&amp;gt;Sessions are distributed to users as soon as they visit the application. However there are events within the application which can change the privilege level of the user. E.g. An anonymous user logs in. This event definitely changes the privilege level of the user. Now the user has access to more sensitive data before they were logged in. Most of the time, the session IDs are used to access data within the application which is logical because a session ID represents a user. Thus if sessions are not replaced at the time of these sensitive events, then an unprivileged session would be able to access data that it was not supposed to. So, this function &amp;quot;session rolling&amp;quot; is to be called whenever events like this happens. This function deletes the old session and copies that session's data to a new session. This ensures that the session IDs change every time a privilege promotion/demotion happens.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Session Management: &amp;lt;/b&amp;gt;With all the useful functions that makes our session implementation safe, we also have created other important functions to manage all the sessions. Some of these functions are to &amp;quot;delete a session&amp;quot;, &amp;quot;delete all sessions related to a user&amp;quot;, &amp;quot;get all sessions for a user from the DB&amp;quot;, &amp;quot;GET/STORE session data from the DB&amp;quot; etc. With all these functions, the task of session management reduces only to a few lines for the developers.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;Other Helpful Links&amp;lt;/h4&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Session Management Cheat Sheet]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahul Chaudhary</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Basic_Password_Management_Library&amp;diff=155647</id>
		<title>Basic Password Management Library</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Basic_Password_Management_Library&amp;diff=155647"/>
				<updated>2013-07-18T10:46:03Z</updated>
		
		<summary type="html">&lt;p&gt;Rahul Chaudhary: Created page with &amp;quot;&amp;lt;h4&amp;gt;Introduction&amp;lt;/h4&amp;gt; If web-application is a dungeon, then passwords are the dragons guarding entrance to the application. There are the single entities that keeps a user saf...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h4&amp;gt;Introduction&amp;lt;/h4&amp;gt;&lt;br /&gt;
If web-application is a dungeon, then passwords are the dragons guarding entrance to the application. There are the single entities that keeps a user safe. There are so many things that could go wrong with passwords. There are also many challenges that needs to be addressed to make passwords safe from prying eyes.&lt;/div&gt;</summary>
		<author><name>Rahul Chaudhary</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Projects/OWASP_PHP_Security_Project/Roadmap&amp;diff=155646</id>
		<title>Projects/OWASP PHP Security Project/Roadmap</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Projects/OWASP_PHP_Security_Project/Roadmap&amp;diff=155646"/>
				<updated>2013-07-18T10:42:03Z</updated>
		
		<summary type="html">&lt;p&gt;Rahul Chaudhary: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;OWASP PHP Security project’s objective is to secure PHP libraries, and provide a full featured framework of standalone libraries for secure web applications in PHP, releasing them both as separate decoupled libraries and as a whole secure web application framework; where sample configuration and usage can be observed. Many aspects of this project are already handled, and are either added or being added to OWASP.&lt;br /&gt;
&amp;lt;BR&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== At present following libraries are supported (In alphabetical order): ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Access Control Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; RBAC Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Database Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Secure Database Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Exception and Error Control Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Error Handler Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''HTTP Protocol Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; HTTP Request Handling Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; HTTP Response Handling Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Sensitive Date Protection Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Secure Application Configuration and State Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Session Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Session Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Time and Randomness Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Time and Randomness Management Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''User Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[User Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[User Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Basic Password Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Advanced Password Management Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahul Chaudhary</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=User_Management_Library&amp;diff=155645</id>
		<title>User Management Library</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=User_Management_Library&amp;diff=155645"/>
				<updated>2013-07-18T10:41:00Z</updated>
		
		<summary type="html">&lt;p&gt;Rahul Chaudhary: Created page with &amp;quot;&amp;lt;h4&amp;gt;Introduction&amp;lt;/h4&amp;gt; As the name implies, User Management Library is a collection of functions aiming to manage users in a system. This library works on top of the &amp;quot;[[User Li...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h4&amp;gt;Introduction&amp;lt;/h4&amp;gt;&lt;br /&gt;
As the name implies, User Management Library is a collection of functions aiming to manage users in a system. This library works on top of the &amp;quot;[[User Library]]&amp;quot; that we have defined in our framework. The basic difference between the two library is that the &amp;quot;[[User Library]]&amp;quot; is used to handle individual users. On the other hand, &amp;quot;User Management&amp;quot; is all about managing all those users. This library provides some basic functions such as &amp;quot;login&amp;quot; and &amp;quot;logout&amp;quot; that simplifies the functions in &amp;quot;[[User Library]]&amp;quot;. On top of that, there are other functions that helps the developer to manage all the users in the database such &amp;quot;getting all users in the database&amp;quot; and &amp;quot;enumerating all the devices that the user is logged in from&amp;quot;. So it can be said that this library is a wrapper library for &amp;quot;User Library&amp;quot; and in addition provides more functions to manage them.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;Extending User Management Library&amp;lt;/h4&amp;gt;&lt;br /&gt;
We have not provided and do not intend to provide all the functions that can be used with this library. We understand that there might be functions specific to the application that might be needed by the developers. Hence this library can be extended using the PHP's &amp;quot;extends&amp;quot; keyword. The extended class can contain the specific functions needed by the developers.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;PHPSEC User Management Implementation&amp;lt;/h4&amp;gt;&lt;br /&gt;
We have created this library in the most simplest sense we could, providing the developers functions that are secure and simple to use. Simple functions make this library more open and transparent. Some common functions in this library are: &lt;br /&gt;
&amp;lt;b&amp;gt; User Exists: &amp;lt;/b&amp;gt;Function to check if a user exists or not in the system.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Create User: &amp;lt;/b&amp;gt;Simplified function to create a user.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Delete User: &amp;lt;/b&amp;gt;Simplified function to delete a user.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Log-In Status: &amp;lt;/b&amp;gt;Function to check if a user is logged in or not.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Devices Logged In: &amp;lt;/b&amp;gt;Function to count the number of devices that the user is logged in from.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Log In: &amp;lt;/b&amp;gt;Function for user to log-in in the system.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Log Out: &amp;lt;/b&amp;gt;Function for user to log-out from the system.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Force Log In: &amp;lt;/b&amp;gt;Simplified function to force log-in a user.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Log Out from all devices: &amp;lt;/b&amp;gt;Function to log-out from all the devices at once.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Misc Functions: &amp;lt;/b&amp;gt;Other functions that provides common functions necessary for this library to work.&lt;br /&gt;
&amp;lt;BR&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;Other Helpful Links&amp;lt;/h4&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahul Chaudhary</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=User_Library&amp;diff=155644</id>
		<title>User Library</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=User_Library&amp;diff=155644"/>
				<updated>2013-07-18T10:39:24Z</updated>
		
		<summary type="html">&lt;p&gt;Rahul Chaudhary: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h4&amp;gt;Introduction&amp;lt;/h4&amp;gt;&lt;br /&gt;
A User Library is for individual users in a system. This library aims to provide functions that could ease the process of creation, maintenance and termination of users easily and safely. Users are the key component in any web application. Thus storing their identity in the system is of utmost important. The users make a base for all other components to work on them. A weakness in user system or improper use of its data may lead to data theft or permanent loss of data. In this library, we have created a basic user system that provides most necessary data about users to be stored such as userID, password, account creation time, etc. and secure functions to manipulate these data and to keep them safe such as &amp;quot;create user&amp;quot;, &amp;quot;verification&amp;quot;, &amp;quot;password reset&amp;quot; etc. With the help of this library, developers can create their own user database with a few lines without worrying about the underlying implementation.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;Extending User Library&amp;lt;/h4&amp;gt;&lt;br /&gt;
As already said, the user library in itself is very plain and simple, with the minimum amount of functionality necessary to create a separate library of its own. The functions and data that is stored in the DB, is very limited. Thus, we have created the library keeping in mind that it needs to be extended. The developers wanting more functionality or more data storage needs such as storing names and age of a user, can extend this library and can create their desired functions on top of this.&lt;br /&gt;
To extend this library, one can just use the PHP's &amp;quot;extends&amp;quot; keyword, and then can use the DB to store and retrieve data. In their newly created child class, they can add more functions as they see fit. The whole purpose of this library is not to arm developers with all the functions they MIGHT need, but our aim is to provide them with the basic functionality so that they can move on from these tasks to more demanding business.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;PHPSEC User Library Implementation&amp;lt;/h4&amp;gt;&lt;br /&gt;
We have created this user library in the most simplest sense we could, providing the developers functions that are secure and simple to use. Simple functions make this library more open and transparent. Some common functions in this library are:&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Create a new User: &amp;lt;/b&amp;gt;This function is used to create a new user.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Get Existing User: &amp;lt;/b&amp;gt;This function is used to request object of an existing user from the system.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Force Login: &amp;lt;/b&amp;gt;Function to validate a user without their credentials.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Verify Password: &amp;lt;/b&amp;gt;Function to verify a user given string as his password.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Reset Password: &amp;lt;/b&amp;gt;Function to reset a user's password to some new password.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Delete Password: &amp;lt;/b&amp;gt;Function to delete a user from a system.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Remember Me: &amp;lt;/b&amp;gt;Function to imitate the behavior of &amp;quot;remember me&amp;quot; function which allows the users to skip entering their credentials each time they visit the application.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Misc Functions: &amp;lt;/b&amp;gt;Other functions that provides common functions to user such as &amp;quot;get Account Creation Time&amp;quot; etc and functions necessary for this library to work.&lt;br /&gt;
&amp;lt;BR&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;Other Helpful Links&amp;lt;/h4&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahul Chaudhary</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Projects/OWASP_PHP_Security_Project/Roadmap&amp;diff=155642</id>
		<title>Projects/OWASP PHP Security Project/Roadmap</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Projects/OWASP_PHP_Security_Project/Roadmap&amp;diff=155642"/>
				<updated>2013-07-18T09:43:39Z</updated>
		
		<summary type="html">&lt;p&gt;Rahul Chaudhary: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;OWASP PHP Security project’s objective is to secure PHP libraries, and provide a full featured framework of standalone libraries for secure web applications in PHP, releasing them both as separate decoupled libraries and as a whole secure web application framework; where sample configuration and usage can be observed. Many aspects of this project are already handled, and are either added or being added to OWASP.&lt;br /&gt;
&amp;lt;BR&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== At present following libraries are supported (In alphabetical order): ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Access Control Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; RBAC Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Database Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Secure Database Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Exception and Error Control Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Error Handler Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''HTTP Protocol Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; HTTP Request Handling Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; HTTP Response Handling Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Sensitive Date Protection Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Secure Application Configuration and State Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Session Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Session Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Time and Randomness Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Time and Randomness Management Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''User Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[User Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[User Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Basic Password Management Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Advanced Password Management Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahul Chaudhary</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=User_Library&amp;diff=155641</id>
		<title>User Library</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=User_Library&amp;diff=155641"/>
				<updated>2013-07-18T09:43:09Z</updated>
		
		<summary type="html">&lt;p&gt;Rahul Chaudhary: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h4&amp;gt;Introduction&amp;lt;/h4&amp;gt;&lt;br /&gt;
A User Library is for individual users in a system. This library aims to provide functions that could ease the process of creation, maintenance and termination of users easily and safely. Users are the key component in any web application. Thus storing their identity in the system is of utmost important. The users make a base for all other components to work on them. A weakness in user system or improper use of its data may lead to data theft or permanent loss of data. In this library, we have created a basic user system that provides most necessary data about users to be stored such as userID, password, account creation time, etc. and secure functions to manipulate these data and to keep them safe such as &amp;quot;create user&amp;quot;, &amp;quot;verification&amp;quot;, &amp;quot;password reset&amp;quot; etc. With the help of this library, developers can create their own user database with a few lines without worrying about the underlying implementation.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;Extending User Library&amp;lt;/h4&amp;gt;&lt;br /&gt;
As already said, the user library in itself is very plain and simple, with the minimum amount of functionality necessary to create a separate library of its own. The functions and data that is stored in the DB, is very limited. Thus, we have created the library keeping in mind that it needs to be extended. The developers wanting more functionality or more data storage needs such as storing names and age of a user, can extend this library and can create their desired functions on top of this.&lt;br /&gt;
To extend this library, one can just use the PHP's &amp;quot;extends&amp;quot; keyword, and then can use the DB to store and retrieve data. In their newly created child class, they can add more functions as they see fit. The whole purpose of this library is not to arm developers with all the functions they MIGHT need, but our aim is to provide them with the basic functionality so that they can move on from these tasks to more demanding business.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;PHPSEC User Library Implementation&amp;lt;/h4&amp;gt;&lt;br /&gt;
We have created this user library in the most simplest sense we could, providing the developers functions that are secure and simple to use. Simple functions make this library more open and transparent. Some common functions in this library are:&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Create a new User: &amp;lt;/b&amp;gt;This function is used to create a new user.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Get Existing User: &amp;lt;/b&amp;gt;This function is used to request object of an existing user from the system.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Force Login: &amp;lt;/b&amp;gt;Function to validate a user without their credentials.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Verify Password: &amp;lt;/b&amp;gt;Function to verify a user given string as his password.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Reset Password: &amp;lt;/b&amp;gt;Function to reset a user's password to some new password.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Delete Password: &amp;lt;/b&amp;gt;Function to delete a user from a system.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Remember Me: &amp;lt;/b&amp;gt;Function to imitate the behavior of &amp;quot;remember me&amp;quot; function which allows the users to skip entering their credentials each time they visit the application.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt; Misc Functions: &amp;lt;/b&amp;gt;Other functions that provided common functions to user such as &amp;quot;get Account Creation Time&amp;quot; etc and functions necessary for this library to work.&lt;br /&gt;
&amp;lt;BR&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;Other Helpful Links&amp;lt;/h4&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahul Chaudhary</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Session_Management_Library&amp;diff=155640</id>
		<title>Session Management Library</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Session_Management_Library&amp;diff=155640"/>
				<updated>2013-07-18T09:42:54Z</updated>
		
		<summary type="html">&lt;p&gt;Rahul Chaudhary: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h4&amp;gt;Introduction&amp;lt;/h4&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
A session management library is used to manage multiple sessions. Sessions are used in web-application to store some user data. Since HTTP connections are connection-less, the application needs a way to associate all transactions to its user to make the application dynamic in nature. For e.g. take the scenario of an online marketing website selling some goods. This application has many customs and they do a lot of transaction. Since the HTTP connection is connection-less, the application cannot differentiate between each connection and cannot know what the user did previously. Hence sessions are used on top of the HTTP protocol to remember data about clients. In sessions, during the client-server handshake process, the server allocates an unique ID to the client. Usually client stores this ID in its cookies. After the first connection, the client can produce this ID to the server so that the server can pull records from the application about this user. This way the servers associate transactions with users in an application.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;With many users (each user can have multiple sessions and they might be using multiple devices to access the application) the task of keeping track of sessions, storing and retrieving data, expiring sessions, etc. become a challenging task. This is where &amp;quot;Session Management Library&amp;quot; steps in. Its sole purpose is to look and manage sessions in an application so that security risks can be mitigated from the abusive and careless use of sessions.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;Problems with Sessions&amp;lt;/h4&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
There is no denying that sessions give applications huge amount of power. But with great power comes great responsibility. Hence its important to keep the sessions safe. Failing to do so creates security holes in the application so severe that security of the whole application can be compromised. There are many reasons to keep the sessions safe:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sessions represents a user identity. If these gets leaked, then an attacker can pose as a legitimate client and can ask server for user data.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Several attacks such as &amp;quot;Session Hijacking&amp;quot; and &amp;quot;Session Fixation&amp;quot; persists.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sessions often are stored in cookies, and cookies can be stolen via several methods. Hence all cookie related attacks automatically affects sessions.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Stolen sessions are very hard to detect by the system, because stolen sessions acts as normal sessions and there is no anomaly whatsoever. There are methods such as &amp;quot;User-behavior detection&amp;quot;, but they are not very much effective until a strong anomaly is detected.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;PHPSEC Session Management Implementation&amp;lt;/h4&amp;gt;&lt;br /&gt;
In this library we have tried to eradicate all of the possible vulnerabilities inside sessions. To ease the process of session management, we have provided several simple functions which makes the task easy and more efficient to handle. These functions internally use a number of methods to handle session vulnerabilities. Each of those methods are over-viewed here in each paragraph.&lt;br /&gt;
&amp;lt;BR&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Databases over cookies: &amp;lt;/b&amp;gt;The first issue that I would like to address is the use of cookies and its harmful effects. The server stores all the session data inside path defined under &amp;quot;session.save_path&amp;quot;. But the session IDs are stored in client's browser, inside cookies. Its the client's responsibility to send this cookie to the server each time. Now every time the client sends this sensitive piece of information, there is a chance that this might be hijacked using some means. e.g. passive attacks, because in HTTP connections, nothing is encrypted. Therefore we decided to control this situation using databases to store session IDs instead of cookies. Also the session data is stored in databases instead in files and folders. This way the user does not have to send their IDs each time. The application itself can access session data using the user's username. The application can also create several sessions for user in the database and link them with user's username.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Session Timeouts: &amp;lt;/b&amp;gt;We have provided functions to delete a session after a certain period of time. This introduces a time-frame to attackers because after that time-frame, the stolen session ID will be destroyed. There are two ways to delete a session. First is &amp;lt;b&amp;gt;Session Inactivity Timeout&amp;lt;/b&amp;gt;, where the session gets deleted if a user was not active for a certain period of time. Second is &amp;lt;b&amp;gt;Session Expiry Timeout&amp;lt;/b&amp;gt;, where the session gets deleted once its maximum lifetime has reached.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Session Length and Randomness: &amp;lt;/b&amp;gt;With modern day computing power and advancement in parallel processing, its trivial to break a short string via brute-search. However a long string cannot guarantee your safety if its not random. Hence, we need long and cryptographically secure random strings to be able to defend against these kinds of attacks. In our library, we generate strings of length &amp;gt;= 32 which are also cryptographically random, thus making our session IDs safe from those attacks.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Session Refresh: &amp;lt;/b&amp;gt;Sessions can be refreshed in a number of events - such as user activity before time expires. Therefore we have provided functions to refresh a session. This makes the sessions as good as new by updating its &amp;quot;creation date&amp;quot; and &amp;quot;User Last Activity&amp;quot; time.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Session Rolling: &amp;lt;/b&amp;gt;Sessions are distributed to users as soon as they visit the application. However there are events within the application which can change the privilege level of the user. E.g. An anonymous user logs in. This event definitely changes the privilege level of the user. Now the user has access to more sensitive data before they were logged in. Most of the time, the session IDs are used to access data within the application which is logical because a session ID represents a user. Thus if sessions are not replaced at the time of these sensitive events, then an unprivileged session would be able to access data that it was not supposed to. So, this function &amp;quot;session rolling&amp;quot; is to be called whenever events like this happens. This function deletes the old session and copies that session's data to a new session. This ensures that the session IDs change every time a privilege promotion/demotion happens.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Session Management: &amp;lt;/b&amp;gt;With all the useful functions that makes our session implementation safe, we also have created other important functions to manage all the sessions. Some of these functions are to &amp;quot;delete a session&amp;quot;, &amp;quot;delete all sessions related to a user&amp;quot;, &amp;quot;get all sessions for a user from the DB&amp;quot;, &amp;quot;GET/STORE session data from the DB&amp;quot; etc. With all these functions, the task of session management reduces only to a few lines for the developers.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;Other Helpful Links&amp;lt;/h4&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; https://www.owasp.org/index.php/Session_Management_Cheat_Sheet&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahul Chaudhary</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=User_Library&amp;diff=155635</id>
		<title>User Library</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=User_Library&amp;diff=155635"/>
				<updated>2013-07-18T06:40:54Z</updated>
		
		<summary type="html">&lt;p&gt;Rahul Chaudhary: Created page with &amp;quot;&amp;lt;h4&amp;gt;Introduction&amp;lt;/h4&amp;gt; A User Library is for individual users in a system.&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h4&amp;gt;Introduction&amp;lt;/h4&amp;gt;&lt;br /&gt;
A User Library is for individual users in a system.&lt;/div&gt;</summary>
		<author><name>Rahul Chaudhary</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Projects/OWASP_PHP_Security_Project/Roadmap&amp;diff=155634</id>
		<title>Projects/OWASP PHP Security Project/Roadmap</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Projects/OWASP_PHP_Security_Project/Roadmap&amp;diff=155634"/>
				<updated>2013-07-18T06:38:40Z</updated>
		
		<summary type="html">&lt;p&gt;Rahul Chaudhary: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;OWASP PHP Security project’s objective is to secure PHP libraries, and provide a full featured framework of standalone libraries for secure web applications in PHP, releasing them both as separate decoupled libraries and as a whole secure web application framework; where sample configuration and usage can be observed. Many aspects of this project are already handled, and are either added or being added to OWASP.&lt;br /&gt;
&amp;lt;BR&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== At present following libraries are supported (In alphabetical order): ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Access Control Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; RBAC Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Database Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Secure Database Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Exception and Error Control Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Error Handler Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''HTTP Protocol Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; HTTP Request Handling Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; HTTP Response Handling Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Sensitive Date Protection Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Secure Application Configuration and State Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Session Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Session Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Time and Randomness Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Time and Randomness Management Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''User Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[User Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; User Management Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Basic Password Management Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Advanced Password Management Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahul Chaudhary</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Session_Management_Library&amp;diff=155633</id>
		<title>Session Management Library</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Session_Management_Library&amp;diff=155633"/>
				<updated>2013-07-18T06:36:58Z</updated>
		
		<summary type="html">&lt;p&gt;Rahul Chaudhary: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h4&amp;gt;Introduction&amp;lt;/h4&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
A session management library is used to manage multiple sessions. Sessions are used in web-application to store some user data. Since HTTP connections are connection-less, the application needs a way to associate all transactions to its user to make the application dynamic in nature. For e.g. take the scenario of an online marketing website selling some goods. This application has many customs and they do a lot of transaction. Since the HTTP connection is connection-less, the application cannot differentiate between each connection and cannot know what the user did previously. Hence sessions are used on top of the HTTP protocol to remember data about clients. In sessions, during the client-server handshake process, the server allocates an unique ID to the client. Usually client stores this ID in its cookies. After the first connection, the client can produce this ID to the server so that the server can pull records from the application about this user. This way the servers associate transactions with users in an application.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;With many users (each user can have multiple sessions and they might be using multiple devices to access the application) the task of keeping track of sessions, storing and retrieving data, expiring sessions, etc. become a challenging task. This is where &amp;quot;Session Management Library&amp;quot; steps in. Its sole purpose is to look and manage sessions in an application so that security risks can be mitigated from the abusive and careless use of sessions.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;Problems with Sessions&amp;lt;/h4&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
There is no denying that sessions give applications huge amount of power. But with great power comes great responsibility. Hence its important to keep the sessions safe. Failing to do so creates security holes in the application so severe that security of the whole application can be compromised. There are many reasons to keep the sessions safe:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sessions represents a user identity. If these gets leaked, then an attacker can pose as a legitimate client and can ask server for user data.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Several attacks such as &amp;quot;Session Hijacking&amp;quot; and &amp;quot;Session Fixation&amp;quot; persists.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sessions often are stored in cookies, and cookies can be stolen via several methods. Hence all cookie related attacks automatically affects sessions.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Stolen sessions are very hard to detect by the system, because stolen sessions acts as normal sessions and there is no anomaly whatsoever. There are methods such as &amp;quot;User-behavior detection&amp;quot;, but they are not very much effective until a strong anomaly is detected.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;PHPSEC Session Management Implementation&amp;lt;/h4&amp;gt;&lt;br /&gt;
In this library we have tried to eradicate all of the possible vulnerabilities inside sessions. To ease the process of session management, we have provided several simple functions which makes the task easy and more efficient to handle. These functions internally use a number of methods to handle session vulnerabilities. Each of those methods are over-viewed here in each paragraph.&lt;br /&gt;
&amp;lt;BR&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Databases over cookies: &amp;lt;/b&amp;gt;The first issue that I would like to address is the use of cookies and its harmful effects. The server stores all the session data inside path defined under &amp;quot;session.save_path&amp;quot;. But the session IDs are stored in client's browser, inside cookies. Its the client's responsibility to send this cookie to the server each time. Now every time the client sends this sensitive piece of information, there is a chance that this might be hijacked using some means. e.g. passive attacks, because in HTTP connections, nothing is encrypted. Therefore we decided to control this situation using databases to store session IDs instead of cookies. Also the session data is stored in databases instead in files and folders. This way the user does not have to send their IDs each time. The application itself can access session data using the user's username. The application can also create several sessions for user in the database and link them with user's username.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Session Timeouts: &amp;lt;/b&amp;gt;We have provided functions to delete a session after a certain period of time. This introduces a time-frame to attackers because after that time-frame, the stolen session ID will be destroyed. There are two ways to delete a session. First is &amp;lt;b&amp;gt;Session Inactivity Timeout&amp;lt;/b&amp;gt;, where the session gets deleted if a user was not active for a certain period of time. Second is &amp;lt;b&amp;gt;Session Expiry Timeout&amp;lt;/b&amp;gt;, where the session gets deleted once its maximum lifetime has reached.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Session Length and Randomness: &amp;lt;/b&amp;gt;With modern day computing power and advancement in parallel processing, its trivial to break a short string via brute-search. However a long string cannot guarantee your safety if its not random. Hence, we need long and cryptographically secure random strings to be able to defend against these kinds of attacks. In our library, we generate strings of length &amp;gt;= 32 which are also cryptographically random, thus making our session IDs safe from those attacks.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Session Refresh: &amp;lt;/b&amp;gt;Sessions can be refreshed in a number of events - such as user activity before time expires. Therefore we have provided functions to refresh a session. This makes the sessions as good as new by updating its &amp;quot;creation date&amp;quot; and &amp;quot;User Last Activity&amp;quot; time.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Session Rolling: &amp;lt;/b&amp;gt;Sessions are distributed to users as soon as they visit the application. However there are events within the application which can change the privilege level of the user. E.g. An anonymous user logs in. This event definitely changes the privilege level of the user. Now the user has access to more sensitive data before they were logged in. Most of the time, the session IDs are used to access data within the application which is logical because a session ID represents a user. Thus if sessions are not replaced at the time of these sensitive events, then an unprivileged session would be able to access data that it was not supposed to. So, this function &amp;quot;session rolling&amp;quot; is to be called whenever events like this happens. This function deletes the old session and copies that session's data to a new session. This ensures that the session IDs change every time a privilege promotion/demotion happens.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Session Management: &amp;lt;/b&amp;gt;With all the useful functions that makes our session implementation safe, we also have created other important functions to manage all the sessions. Some of these functions are to &amp;quot;delete a session&amp;quot;, &amp;quot;delete all sessions related to a user&amp;quot;, &amp;quot;get all sessions for a user from the DB&amp;quot;, &amp;quot;GET/STORE session data from the DB&amp;quot; etc. With all these functions, the task of session management reduces only to a few lines for the developers.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;Other Helpful Links:&amp;lt;/h4&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; https://www.owasp.org/index.php/Session_Management_Cheat_Sheet&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahul Chaudhary</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Session_Management_Library&amp;diff=155632</id>
		<title>Session Management Library</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Session_Management_Library&amp;diff=155632"/>
				<updated>2013-07-18T06:34:39Z</updated>
		
		<summary type="html">&lt;p&gt;Rahul Chaudhary: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Session Management Library ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Introduction&amp;lt;/h4&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
A session management library is used to manage multiple sessions. Sessions are used in web-application to store some user data. Since HTTP connections are connection-less, the application needs a way to associate all transactions to its user to make the application dynamic in nature. For e.g. take the scenario of an online marketing website selling some goods. This application has many customs and they do a lot of transaction. Since the HTTP connection is connection-less, the application cannot differentiate between each connection and cannot know what the user did previously. Hence sessions are used on top of the HTTP protocol to remember data about clients. In sessions, during the client-server handshake process, the server allocates an unique ID to the client. Usually client stores this ID in its cookies. After the first connection, the client can produce this ID to the server so that the server can pull records from the application about this user. This way the servers associate transactions with users in an application.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;With many users (each user can have multiple sessions and they might be using multiple devices to access the application) the task of keeping track of sessions, storing and retrieving data, expiring sessions, etc. become a challenging task. This is where &amp;quot;Session Management Library&amp;quot; steps in. Its sole purpose is to look and manage sessions in an application so that security risks can be mitigated from the abusive and careless use of sessions.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;Problems with Sessions&amp;lt;/h4&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
There is no denying that sessions give applications huge amount of power. But with great power comes great responsibility. Hence its important to keep the sessions safe. Failing to do so creates security holes in the application so severe that security of the whole application can be compromised. There are many reasons to keep the sessions safe:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sessions represents a user identity. If these gets leaked, then an attacker can pose as a legitimate client and can ask server for user data.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Several attacks such as &amp;quot;Session Hijacking&amp;quot; and &amp;quot;Session Fixation&amp;quot; persists.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sessions often are stored in cookies, and cookies can be stolen via several methods. Hence all cookie related attacks automatically affects sessions.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Stolen sessions are very hard to detect by the system, because stolen sessions acts as normal sessions and there is no anomaly whatsoever. There are methods such as &amp;quot;User-behavior detection&amp;quot;, but they are not very much effective until a strong anomaly is detected.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;PHPSEC Session Management Implementation&amp;lt;/h4&amp;gt;&lt;br /&gt;
In this library we have tried to eradicate all of the possible vulnerabilities inside sessions. To ease the process of session management, we have provided several simple functions which makes the task easy and more efficient to handle. These functions internally use a number of methods to handle session vulnerabilities. Each of those methods are over-viewed here in each paragraph.&lt;br /&gt;
&amp;lt;BR&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Databases over cookies: &amp;lt;/b&amp;gt;The first issue that I would like to address is the use of cookies and its harmful effects. The server stores all the session data inside path defined under &amp;quot;session.save_path&amp;quot;. But the session IDs are stored in client's browser, inside cookies. Its the client's responsibility to send this cookie to the server each time. Now every time the client sends this sensitive piece of information, there is a chance that this might be hijacked using some means. e.g. passive attacks, because in HTTP connections, nothing is encrypted. Therefore we decided to control this situation using databases to store session IDs instead of cookies. Also the session data is stored in databases instead in files and folders. This way the user does not have to send their IDs each time. The application itself can access session data using the user's username. The application can also create several sessions for user in the database and link them with user's username.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Session Timeouts: &amp;lt;/b&amp;gt;We have provided functions to delete a session after a certain period of time. This introduces a time-frame to attackers because after that time-frame, the stolen session ID will be destroyed. There are two ways to delete a session. First is &amp;lt;b&amp;gt;Session Inactivity Timeout&amp;lt;/b&amp;gt;, where the session gets deleted if a user was not active for a certain period of time. Second is &amp;lt;b&amp;gt;Session Expiry Timeout&amp;lt;/b&amp;gt;, where the session gets deleted once its maximum lifetime has reached.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Session Length and Randomness: &amp;lt;/b&amp;gt;With modern day computing power and advancement in parallel processing, its trivial to break a short string via brute-search. However a long string cannot guarantee your safety if its not random. Hence, we need long and cryptographically secure random strings to be able to defend against these kinds of attacks. In our library, we generate strings of length &amp;gt;= 32 which are also cryptographically random, thus making our session IDs safe from those attacks.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Session Refresh: &amp;lt;/b&amp;gt;Sessions can be refreshed in a number of events - such as user activity before time expires. Therefore we have provided functions to refresh a session. This makes the sessions as good as new by updating its &amp;quot;creation date&amp;quot; and &amp;quot;User Last Activity&amp;quot; time.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Session Rolling: &amp;lt;/b&amp;gt;Sessions are distributed to users as soon as they visit the application. However there are events within the application which can change the privilege level of the user. E.g. An anonymous user logs in. This event definitely changes the privilege level of the user. Now the user has access to more sensitive data before they were logged in. Most of the time, the session IDs are used to access data within the application which is logical because a session ID represents a user. Thus if sessions are not replaced at the time of these sensitive events, then an unprivileged session would be able to access data that it was not supposed to. So, this function &amp;quot;session rolling&amp;quot; is to be called whenever events like this happens. This function deletes the old session and copies that session's data to a new session. This ensures that the session IDs change every time a privilege promotion/demotion happens.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Session Management: &amp;lt;/b&amp;gt;With all the useful functions that makes our session implementation safe, we also have created other important functions to manage all the sessions. Some of these functions are to &amp;quot;delete a session&amp;quot;, &amp;quot;delete all sessions related to a user&amp;quot;, &amp;quot;get all sessions for a user from the DB&amp;quot;, &amp;quot;GET/STORE session data from the DB&amp;quot; etc. With all these functions, the task of session management reduces only to a few lines for the developers.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;Other Helpful Links:&amp;lt;/h4&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; https://www.owasp.org/index.php/Session_Management_Cheat_Sheet&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahul Chaudhary</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Session_Management_Library&amp;diff=155543</id>
		<title>Session Management Library</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Session_Management_Library&amp;diff=155543"/>
				<updated>2013-07-17T09:20:59Z</updated>
		
		<summary type="html">&lt;p&gt;Rahul Chaudhary: Created page with &amp;quot; == Session Management Library ==   &amp;lt;h4&amp;gt;Introduction&amp;lt;/h4&amp;gt; &amp;lt;p&amp;gt; A session management library is used to manage multiple sessions. Sessions are used in web-application to store s...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Session Management Library ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Introduction&amp;lt;/h4&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
A session management library is used to manage multiple sessions. Sessions are used in web-application to store some user data. Since HTTP connections are connection-less, the application needs a way to associate all transactions to its user to make the application dynamic in nature. For e.g. take the scenario of an online marketing website selling some goods. This application has many customs and they do a lot of transaction. Since the HTTP connection is connection-less, the application cannot differentiate between each connection and cannot know what the user did previously. Hence sessions are used on top of the HTTP protocol to remember data about clients. In sessions, during the client-server handshake process, the server allocates an unique ID to the client. After the first connection, the client can produce this ID to the server so that the server can pull records from the application about this user. This way the servers associate transactions with users in an application.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;With many users (each user can have multiple sessions) the task of keeping track of sessions, storing and retrieving data, expiring sessions, etc. become a challenging task. This is where &amp;quot;Session Management Library&amp;quot; steps in. Its sole purpose is to look and manage sessions in an application so that security risks can be mitigated from the abusive and careless use of sessions.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;Problems with Sessions&amp;lt;/h4&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
There is no denying that sessions give applications huge amount of power. But with great power comes great responsibility. Hence its important to keep the sessions safe. Failing to do so creates security holes in the application so severe that security of the whole application can be compromised. There are many reasons to keep the sessions safe:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sessions represents a user identity. If these gets leaked, then an attacker can pose as a legitimate client and can ask server for user data.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Several attacks such as &amp;quot;Session Hijacking&amp;quot; and &amp;quot;Session Fixation&amp;quot; persists.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sessions often are used with cookies. So session automatically is vulnerable to cookie attacks.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;PHPSEC Session Management Implementation&amp;lt;/h4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;Other Helpful Links:&amp;lt;/h4&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; https://www.owasp.org/index.php/Session_Management_Cheat_Sheet&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahul Chaudhary</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Projects/OWASP_PHP_Security_Project/Roadmap&amp;diff=155542</id>
		<title>Projects/OWASP PHP Security Project/Roadmap</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Projects/OWASP_PHP_Security_Project/Roadmap&amp;diff=155542"/>
				<updated>2013-07-17T09:19:30Z</updated>
		
		<summary type="html">&lt;p&gt;Rahul Chaudhary: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;OWASP PHP Security project’s objective is to secure PHP libraries, and provide a full featured framework of standalone libraries for secure web applications in PHP, releasing them both as separate decoupled libraries and as a whole secure web application framework; where sample configuration and usage can be observed. Many aspects of this project are already handled, and are either added or being added to OWASP.&lt;br /&gt;
&amp;lt;BR&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== At present following libraries are supported (In alphabetical order): ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Access Control Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; RBAC Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Database Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Secure Database Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Exception and Error Control Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Error Handler Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''HTTP Protocol Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; HTTP Request Handling Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; HTTP Response Handling Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Sensitive Date Protection Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Secure Application Configuration and State Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Session Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [[Session Management Library]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Time and Randomness Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Time and Randomness Management Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''User Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; User Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; User Management Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Basic Password Management Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Advanced Password Management Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahul Chaudhary</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Your_new_address&amp;diff=155538</id>
		<title>Your new address</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Your_new_address&amp;diff=155538"/>
				<updated>2013-07-17T09:07:08Z</updated>
		
		<summary type="html">&lt;p&gt;Rahul Chaudhary: Rahul Chaudhary moved page Your new address to Phpsec session management: This page belongs under docs in &amp;quot;phpsec&amp;quot; project.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Phpsec session management]]&lt;/div&gt;</summary>
		<author><name>Rahul Chaudhary</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Template:!&amp;diff=155511</id>
		<title>Template:!</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Template:!&amp;diff=155511"/>
				<updated>2013-07-16T00:03:43Z</updated>
		
		<summary type="html">&lt;p&gt;Rahul Chaudhary: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Rahul Chaudhary</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Template:!&amp;diff=155510</id>
		<title>Template:!</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Template:!&amp;diff=155510"/>
				<updated>2013-07-16T00:02:14Z</updated>
		
		<summary type="html">&lt;p&gt;Rahul Chaudhary: Blanked the page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Rahul Chaudhary</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Template:!&amp;diff=155509</id>
		<title>Template:!</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Template:!&amp;diff=155509"/>
				<updated>2013-07-16T00:01:33Z</updated>
		
		<summary type="html">&lt;p&gt;Rahul Chaudhary: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;|&lt;br /&gt;
Hello...what is this page ?&lt;/div&gt;</summary>
		<author><name>Rahul Chaudhary</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Projects/OWASP_PHP_Security_Project/Roadmap&amp;diff=155507</id>
		<title>Projects/OWASP PHP Security Project/Roadmap</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Projects/OWASP_PHP_Security_Project/Roadmap&amp;diff=155507"/>
				<updated>2013-07-15T23:56:55Z</updated>
		
		<summary type="html">&lt;p&gt;Rahul Chaudhary: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;OWASP PHP Security project’s objective is to secure PHP libraries, and provide a full featured framework of standalone libraries for secure web applications in PHP, releasing them both as separate decoupled libraries and as a whole secure web application framework; where sample configuration and usage can be observed. Many aspects of this project are already handled, and are either added or being added to OWASP.&lt;br /&gt;
&amp;lt;BR&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== At present following libraries are supported (In alphabetical order): ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Access Control Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; RBAC Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Database Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Secure Database Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Exception and Error Control Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Error Handler Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''HTTP Protocol Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; HTTP Request Handling Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; HTTP Response Handling Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Sensitive Date Protection Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Secure Application Configuration and State Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Session Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Session Management Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''Time and Randomness Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Time and Randomness Management Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
'''User Related Libraries:'''&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; User Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; User Management Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Basic Password Management Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Advanced Password Management Library.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahul Chaudhary</name></author>	</entry>

	</feed>