Difference between revisions of "Least privilege"

From OWASP
Jump to: navigation, search
(Added template, and related controls)
(Reverting to last version not containing links to www.textnotace.com)
 
(7 intermediate revisions by 3 users not shown)
Line 2: Line 2:
  
 
{{Template:Stub}}
 
{{Template:Stub}}
 +
 +
<br>
 +
[[Category:OWASP ASDR Project]]
  
 
==Description==
 
==Description==
  
 
The principle of least privilege recommends that accounts have the least amount of privilege required to perform their business processes. This encompasses user rights, resource permissions such as CPU limits, memory, network, and file system permissions.  
 
The principle of least privilege recommends that accounts have the least amount of privilege required to perform their business processes. This encompasses user rights, resource permissions such as CPU limits, memory, network, and file system permissions.  
 
For example, if a middleware server only requires access to the network, read access to a database table, and the ability to write to a log, this describes all the permissions that should be granted. Under no circumstances should the middleware be granted administrative privileges.
 
  
  
 
==Examples==
 
==Examples==
  
===Short example name===
+
===Administrative Priviledges Granted to a Middleware Server===
: A short example description, small picture, or sample code with [http://www.site.com links]
+
: For example, if a middleware server only requires access to the network, read access to a database table, and the ability to write to a log, this describes all the permissions that should be granted. Under no circumstances should the middleware be granted administrative privileges.
  
===Short example name===
+
===Connecting to the Database as Root===
: A short example description, small picture, or sample code with [http://www.site.com links]
+
: In this example PHP code, only a SELECT statement from the database is issued. There is no reason to connect to the database as root. Instead, a user should be created with only the necessary access to the database that can be used to perform the SELECT query.
 +
<?php
 +
$host = 'localhost';
 +
$userID = 'root';
 +
$password = 'password';
 +
$db = mysql_connect($host, $userID, $password) or die ('Error connecting to mysql');
 +
$name = 'testdatabase';
 +
mysql_select_db($name);
 +
$sql="SELECT * FROM theTable";
 +
$result=mysql_query($sql);
 +
?>
  
  
 
==Related [[Vulnerabilities]]==
 
==Related [[Vulnerabilities]]==
  
* [[Vulnerability 1]]
+
* [[Failure to drop privileges when reasonable]]  
* [[Vulnerabiltiy 2]]
+
* [[Failure to check whether privileges were dropped successfully]]
 +
* [[Least Privilege Violation]]
  
  
 
==Related [[Controls]]==
 
==Related [[Controls]]==
  
* [[Access control]]
 
 
* [[Authorization]]
 
* [[Authorization]]
  
Line 33: Line 44:
 
==References==
 
==References==
  
* http://www.link1.com
+
* [http://web.mit.edu/Saltzer/www/publications/protection/ The Protection of Information in Computer Systems]
 +
 
 +
[[Category:Principle]]

Latest revision as of 13:30, 27 May 2009

This is a principle or a set of principles. To view all principles, please see the Principle Category page.

This article is a stub. You can help OWASP by expanding it or discussing it on its Talk page.



Description

The principle of least privilege recommends that accounts have the least amount of privilege required to perform their business processes. This encompasses user rights, resource permissions such as CPU limits, memory, network, and file system permissions.


Examples

Administrative Priviledges Granted to a Middleware Server

For example, if a middleware server only requires access to the network, read access to a database table, and the ability to write to a log, this describes all the permissions that should be granted. Under no circumstances should the middleware be granted administrative privileges.

Connecting to the Database as Root

In this example PHP code, only a SELECT statement from the database is issued. There is no reason to connect to the database as root. Instead, a user should be created with only the necessary access to the database that can be used to perform the SELECT query.
<?php
$host = 'localhost';
$userID = 'root';
$password = 'password';
$db = mysql_connect($host, $userID, $password) or die ('Error connecting to mysql');
$name = 'testdatabase';
mysql_select_db($name);
$sql="SELECT * FROM theTable";
$result=mysql_query($sql);
?> 


Related Vulnerabilities


Related Controls


References