cvs: phpdoc /nl Translators bookinfo.xml preface.xml /nl/chapters security.xml
| From: | Derick Rethans | Date: | Wed, 18 Oct 2000 21:59:11 +0000 |
| Subject: | cvs: phpdoc /nl Translators bookinfo.xml preface.xml /nl/chapters security.xml | ||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969332541@lists.php.net to get a copy of this message | ||
derick Wed Oct 18 14:59:11 2000 EDT
Modified files:
/phpdoc/nl Translators bookinfo.xml preface.xml
/phpdoc/nl/chapters security.xml
Log:
- Finished translating the security chapter, and change some small things.
Index: phpdoc/nl/Translators
diff -u phpdoc/nl/Translators:1.4 phpdoc/nl/Translators:1.5
--- phpdoc/nl/Translators:1.4 Wed Oct 11 14:33:58 2000
+++ phpdoc/nl/Translators Wed Oct 18 14:59:11 2000
@@ -26,10 +26,10 @@
regexp.xml Derick done
------- chapters ------------------------------------------------------------
config.xml
-copyright.xml Derick done
+copyright.xml Derick needs update
install.xml
-intro.xml Derick done
-security.xml Derick started
+intro.xml Derick needs update
+security.xml Derick done
------- features ------------------------------------------------------------
connection-handling.xml Mathieu done
cookies.xml Mathieu done
Index: phpdoc/nl/bookinfo.xml
diff -u phpdoc/nl/bookinfo.xml:1.2 phpdoc/nl/bookinfo.xml:1.3
--- phpdoc/nl/bookinfo.xml:1.2 Tue Oct 10 16:05:48 2000
+++ phpdoc/nl/bookinfo.xml Wed Oct 18 14:59:11 2000
@@ -40,7 +40,7 @@
<authorgroup id="editors">
<editor>
- <firstname>Matthieu</firstname><surname>Kooiman</surname>
+ <firstname>Mathieu</firstname><surname>Kooiman</surname>
</editor>
<editor>
<firstname>Derick</firstname><surname>Rethans</surname>
Index: phpdoc/nl/preface.xml
diff -u phpdoc/nl/preface.xml:1.2 phpdoc/nl/preface.xml:1.3
--- phpdoc/nl/preface.xml:1.2 Tue Oct 10 16:05:48 2000
+++ phpdoc/nl/preface.xml Wed Oct 18 14:59:11 2000
@@ -1,6 +1,6 @@
<preface id="preface">
- <title>Preface</title>
+ <title>Voorwoord</title>
<abstract>
<simpara>
Index: phpdoc/nl/chapters/security.xml
diff -u phpdoc/nl/chapters/security.xml:1.3 phpdoc/nl/chapters/security.xml:1.4
--- phpdoc/nl/chapters/security.xml:1.3 Sat Oct 14 06:26:33 2000
+++ phpdoc/nl/chapters/security.xml Wed Oct 18 14:59:11 2000
@@ -2,84 +2,86 @@
<title>Security</title>
<simpara>
- PHP is a powerful language and the interpreter, whether included
- in a web server as a module or executed as a separate
- <acronym>CGI</acronym> binary, is able to access files, execute
- commands and open network connections on the server. These
- properties make anything run on a web server insecure by default.
- PHP is designed specifically to be a more secure language for
- writing CGI programs than Perl or C, and with correct selection of
- compile-time and runtime configuration options, and proper coding
- practices, it can give you exactly the combination of freedom and
- security you need.
+ PHP is een krachtige taal en de interpreter, zowel als module
+ in een webserver, of uitgevoerd in een afzonderlijke
+ <acronym>CGI</acronym> binary, kan bestanden lezen, commando's
+ uitvoeren en netwerk connecties openen op de server. Deze
+ eigenschappen maken alles wat draait op een webserver onveilig als
+ default. PHP is ontworpen als een veiliger taal om CGI programma's
+ te maken dan Perl of C, en met de juiste selectie van compile-time
+ en runtime configuratie opties, en een goede coding stijl, kan het
+ je over de exacte combinatie van vrijheid en veiligheid beschikken
+ die jij nodig hebt.
</simpara>
<simpara>
- As there are many different ways of utilizing PHP, there are many
- configuration options controlling its behaviour. A large
- selection of options guarantees you can use PHP for a lot of
- purposes, but it also means there are combinations of these
- options and server configurations that result in an insecure
- setup.
+ Omdat er veel verschillende manieren zijn om PHP te gebruiken,
+ zijn er ook veel opties die het gedrag aanpassen. Een grote
+ keus aan opties garanderen dat PHP gebruikt kan worden voor
+ veel doeleinden, maar het betekend ook dat er combinaties zijn
+ van opties en server configuraties die resulteren in een slecht
+ beveiligde setup.
</simpara>
<simpara>
- The configuration flexibility of PHP is equally rivalled by the
- code flexibility. PHP can be used to build complete server
- applications, with all the power of a shell user, or it can be used
- for simple server-side includes with little risk in a tightly
- controlled environment. How you build that environment, and how
- secure it is, is largely up to the PHP developer.
+ De configureerbaarheid van PHP is evenredig met de felixibiliteit
+ van code schrijven. PHP kan gebruikt worden om complete server
+ applicaties te schrijven met de kracht van een shell user, maar ook
+ voor simpele server-side includes met weinig risico en een goed
+ te controleren omgeving. Hoe zo'n omgeving te creeren en hoe veilig
+ het is, hangt grotendeels af van de PHP ontwikkelaar.
</simpara>
<simpara>
- This chapter starts by explaining the different configuration
- option combinations and the situations they can be safely used. It
- then describes different considerations in coding for different
- levels of security, and ends with some general security advice.
+ Dit hoofdstuk start met het uitleggen van de verschillende combinaties
+ van opties en de situaties waarin deze veilig kunnen worden gebruikt.
+ Hierna zal het verschillende mates van beveiliging van de geprogrammeerde
+ scripts doornemen, en het zal eindigen met een algemeen beveiligins
+ advies.
</simpara>
<sect1 id="security.cgi">
- <title>Installed as CGI binary</title>
+ <title>Geïnstalleerd als CGI binary</title>
<sect2 id="security.cgi.attacks">
- <title>Possible attacks</title>
+ <title>Mogelijke aanvallen</title>
<simpara>
- Using PHP as a <acronym>CGI</acronym> binary is an option for
- setups that for some reason do not wish to integrate PHP as a
- module into server software (like Apache), or will use PHP with
- different kinds of CGI wrappers to create safe chroot and setuid
- environments for scripts. This setup usually involves installing
- executable PHP binary to the web server cgi-bin directory. CERT
- advisory <ulink url="&url.cert;">CA-96.11</ulink> recommends
- against placing any interpreters into cgi-bin. Even if the PHP
- binary can be used as a standalone interpreter, PHP is designed
- to prevent the attacks this setup makes possible:
+ PHP gebruiken als <acronym>CGI</acronym> binary is een optie voor
+ personen die om een of andere reden PHP niet willen integreren
+ als een module in server software (zoals Apache), of die PHP met
+ verschillende CGI wrappers willen gebruiken om zo een veilige
+ omgeving voor scripts te creën. Deze opzet vereist vaak het
+ instsalleren van de PHP binary in de web server's cgi-bin directory.
+ CERT advisory <ulink url="&url.cert;">CA-96.11</ulink> beveelt of
+ om interpreters in de cgi-bin te installeren. Zelfs als een
+ binary gebruikt wordt als een standalone interpreter, is PHP
+ ontworpen om een aantal aanvallen op deze setup te verijdelen:
</simpara>
<itemizedlist>
<listitem>
<simpara>
- Accessing system files: <filename
- role="url">http://my.host/cgi-bin/php?/etc/passwd</filename>
+ Het lezen van systeem bestanden: <filename
+ role="url">http://mijn.server/cgi-bin/php?/etc/passwd</filename>
</simpara>
<simpara>
- The query information in a url after the question mark (?) is
- passed as command line arguments to the interpreter by the CGI
- interface. Usually interpreters open and execute the file
- specified as the first argument on the command line.
+ De string in een URL na het vraagteken (?) wordt
+ doorgegeven als argumenten aan de interpreter door de CGI
+ interface. Gewoonlook openen interpreters het eerste argument
+ als het script dat ze proberen uit te voeren.
</simpara>
<simpara>
- When invoked as a CGI binary, PHP refuses to interpret the
- command line arguments.
+ Als PHP als CGI binary word gebruikt, dan vertikt hij het om
+ command line argumenten te accepteren.
</simpara>
</listitem>
<listitem>
<simpara>
- Accessing any web document on server: <filename
- role="url">http://my.host/cgi-bin/php/secret/doc.html</filename>
+ Het lezen van elk web document op de server: <filename
+ role="url">http://mijn.server/cgi-bin/php/geheim/doc.html</filename>
</simpara>
<simpara>
- The path information part of the url after the PHP binary name,
- <filename role="uri">/secret/doc.html</filename> is
- conventionally used to specify the name of the file to be
- opened and interpreted by the <acronym>CGI</acronym> program.
+ De bestandslocatie in de URL achter de PHP binary naam,
+ <filename role="uri">/geheim/doc.html</filename> wordt
+ normaal gebruikt om de naam van het uit te voeren bestand
+ aan te geven dat moet worden uitgeveord door het
+ <acronym>CGI</acronym> programma.
Usually some web server configuration directives (Apache:
Action) are used to redirect requests to documents like
<filename
@@ -98,288 +100,290 @@
protected document on the web server.
</simpara>
<simpara>
- In PHP, compile-time configuration option <link
+ In PHP, de compile-time configuratie optie <link
linkend="install.configure.enable-force-cgi-redirect">--enable-force-cgi-redirect</link>
- and runtime configuration directives <link
- linkend="ini.doc-root">doc_root</link> and <link
- linkend="ini.user-dir">user_dir</link> can be used to prevent
- this attack, if the server document tree has any directories
- with access restrictions. See below for full the explanation
- of the different combinations.
+ en de runtime configuration opties <link
+ linkend="ini.doc-root">doc_root</link> en <link
+ linkend="ini.user-dir">user_dir</link> kunnen worden gebruikt
+ om dit type aanval, als de web document tree enige directories
+ heeft met restricties. Zie hier onder voor een volledige uitleg
+ van alle verschillende combinaties.
</simpara>
</listitem>
</itemizedlist>
</sect2>
<sect2 id="security.cgi.default">
- <title>Case 1: only public files served</title>
+ <title>Case 1: alleen normale bestanden</title>
<simpara>
- If your server does not have any content that is not restricted
- by password or ip based access control, there is no need for
- these configuration options. If your web server does not allow
- you to do redirects, or the server does not have a way to
- communicate to the PHP binary that the request is a safely
- redirected request, you can specify the option <link
+ Als jouw server geen enkele beveiligde webpagina heeft, bijvoorbeeld
+ met een wachtwoord, of gebaseerd op IP, dan is het niet nodig om
+ deze configuratie opties te gebruiken. Indien jouw webserver het niet
+ toestaat om redirects te doen, of de server kan op geen enkele manier
+ communiceren met de PHP binary dat de informatie aanvraag is een veilig
+ geredirectioneerde aanvraag dan kun je de optie <link
linkend="install.configure.enable-force-cgi-redirect">--enable-force-cgi-redirect</link>
- to the configure script. You still have to make sure your PHP
- scripts do not rely on one or another way of calling the script,
- neither by directly <filename
- role="php">http://my.host/cgi-bin/php/dir/script.php3</filename>
- nor by redirection <filename
- role="php">http://my.host/dir/script.php3</filename>.
+ veilig toevoegen aan de configure regel. Je zult wel zelf moeten
+ controleren of jouw PHP scripts niet afhankelijk van elkaar zijn
+ bij het direct aanroepen <filename
+ role="php">http://mijn.server/cgi-bin/php/dir/script.php3</filename>
+ en via redirectie <filename
+ role="php">http://mijn.server/dir/script.php3</filename>.
</simpara>
<simpara>
- Redirection can be configured in Apache by using AddHandler and
- Action directives (see below).
+ Redirectie kan in Apache worden geconfigureerd met behulp van
+ AddHandler en Action regels (zie hieronder).
</simpara>
</sect2>
<sect2 id="security.cgi.force-redirect">
- <title>Case 2: using --enable-force-cgi-redirect</title>
+ <title>Case 2: gebruik maken van --enable-force-cgi-redirect</title>
<simpara>
- This compile-time option prevents anyone from calling PHP
- directly with a url like <filename
- role="php">http://my.host/cgi-bin/php/secretdir/script.php3</filename>.
- Instead, PHP will only parse in this mode if it has gone through
- a web server redirect rule.
+ Deze compile-time optie voorkomt het direct aanroepen van PHP
+ met een URL als volgende <filename
+ role="php">http://my.host/cgi-bin/php/geheimedir/script.php3</filename>.
+ In plaatse hiervan zal PHP het scripts alleen parsen in deze mode als
+ het via een web server's redirect rule wordt aangeboden.
</simpara>
<simpara>
- Usually the redirection in the Apache configuration is done with
- the following directives:
+ Normaal gesproken is redirectie in Apache te configureren met de
+ volgende directives:
</simpara>
<programlisting role="apache-conf">
Action php3-script /cgi-bin/php
AddHandler php3-script .php3
</programlisting>
<simpara>
- This option has only been tested with the Apache web server, and
- relies on Apache to set the non-standard CGI environment variable
- <envar>REDIRECT_STATUS</envar> on redirected requests. If your
- web server does not support any way of telling if the request is
- direct or redirected, you cannot use this option and you must use
- one of the other ways of running the CGI version documented
- here.
+ Deze opties is alleen getest met de Apache web server, en gaat ervan
+ uit dat Apache de niet standaard CGI environment variable
+ <envar>REDIRECT_STATUS</envar> gebruikt bij redirectioneerde
+ aanvragen. Als jouw web server geen manier heeft om door te
+ geven of een aanvraag is geredirectioneerd of niet, dan kun je
+ deze optie niet gebruiken en zal je een andere manier moeten vinden
+ om de CGI versie te runnen.
</simpara>
</sect2>
<sect2 id="security.cgi.doc-root">
- <title>Case 3: setting doc_root or user_dir</title>
+ <title>Case 3: het gebruik van doc_root of user_dir</title>
<simpara>
- To include active content, like scripts and executables, in the
- web server document directories is sometimes consider an insecure
- practice. If, because of some configuration mistake, the scripts
- are not executed but displayed as regular HTML documents, this
- may result in leakage of intellectual property or security
- information like passwords. Therefore many sysadmins will prefer
- setting up another directory structure for scripts that are
- accessible only through the PHP CGI, and therefore always
- interpreted and not displayed as such.
- </simpara>
- <simpara>
- Also if the method for making sure the requests are not
- redirected, as described in the previous section, is not
- available, it is necessary to set up a script doc_root that is
- different from web document root.
- </simpara>
- <simpara>
- You can set the PHP script document root by the configuration
- directive <link linkend="ini.doc-root">doc_root</link> in the
- <link linkend="configuration.file">configuration file</link>, or
- you can set the environment variable
- <envar>PHP_DOCUMENT_ROOT</envar>. If it is set, the CGI version
- of PHP will always construct the file name to open with this
- <parameter>doc_root</parameter> and the path information in the
- request, so you can be sure no script is executed outside this
- directory (except for <parameter>user_dir</parameter>
- below).
- </simpara>
- <simpara>
- Another option usable here is <link
- linkend="ini.user-dir">user_dir</link>. When user_dir is unset,
- only thing controlling the opened file name is
- <parameter>doc_root</parameter>. Opening an url like <filename
- role="url">http://my.host/~user/doc.php3</filename>
does not
- result in opening a file under users home directory, but a file
- called <filename role="uri">~user/doc.php3</filename> under
- doc_root (yes, a directory name starting with a tilde
+ Soms wordt in twijfel getrokken of het gebruiken van scrips of
+ programma's in de web server document directories wel veilig is.
+ Als namelijk, vanwege een configuratie foutje, de scripts niet
+ worden uitgevoerd, maar worden getoond als normale HTML documenten,
+ dan kan er copyrighted materiaal, of beveiliginsinformatie als
+ wachtwoorden beschikbaar komen voor onbevoegden. Hierom zullen
+ veel beheerders een apparte directory opzetten die altijd wordt
+ uitgevoerd door de PHP CGI, hierdoor komt de source van de PHP
+ scripts nooit beschikbaar komen voor onbevoegden.
+ </simpara>
+ <simpara>
+ Als er geen manier is om te controleren of een aanvraag is niet
+ doorverwezen, zoals bescrijven is in de vorige Case, dan is het ook
+ nodig om een doc_root op te zetten die verschillend is van de web
+ documenten root-directory.
+ </simpara>
+ <simpara>
+ Je kunt de document van een PHP script instellen met de configuratie
+ directive <link linkend="ini.doc-root">doc_root</link> in de
+ <link linkend="configuration.file">configuratie file</link>, of
+ met het setten van de environment variabele
+ <envar>PHP_DOCUMENT_ROOT</envar>. Als deze is ge-zet dan zal de CGI
+ versie van PHP altijd de bestandsnaam gebruiken met de
+ <parameter>doc_root</parameter> en path informatie van de aanvraag.
+ Op deze manier is het zeker dat geen script wordt uitgevoerd buiten
+ de directory (met uitzondering voor <parameter>user_dir</parameter>
+ die hieronder wordt beschreven).
+ </simpara>
+ <simpara>
+ Een andere bruikbare optie is de <link
+ linkend="ini.user-dir">user_dir</link>. Als user_dir niet getset is,
+ dan is het enige dat de geopende file beïnvloed de
+ <parameter>doc_root</parameter>. Het openen van een URL als <filename
+ role="url">http://mijn.server/~gebruiker/doc.php3</filename>
resulteerd
+ niet in het openen van een bestand in de home directory van de gebruiker,
+ maar van het openen van
+ <filename role="uri">~gebruiker/doc.php3</filename> in de doc_root
+ (een directory die met een tilde begint
[<literal>~</literal>]).
</simpara>
<simpara>
- If user_dir is set to for example <filename
- role="dir">public_php</filename>, a request like <filename
- role="url">http://my.host/~user/doc.php3</filename>
will open a
- file called <filename>doc.php3</filename> under the directory
- named <filename role="dir">public_php</filename> under the home
- directory of the user. If the home of the user is <filename
- role="dir">/home/user</filename>, the file executed is
- <filename>/home/user/public_php/doc.php3</filename>.
+ Als user_dir de waarde <filename
+ role="dir">public_php</filename> is, een aanvraag als <filename
+ role="url">http://mijn.server/~gebruiker/doc.php3</filename>
+ zal de file <filename>doc.php3</filename> in de directory genaamd
+ <filename role="dir">public_php</filename> openen in de home
+ directory van de gebruiker. Als de home directory van de gebruiker
+ <filename role="dir">/home/gebruiker</filename> is, dan zal het
uitgevoerde
+ bestand <filename>/home/gebruiker/public_php/doc.php3</filename> zijn.
</simpara>
<simpara>
- <parameter>user_dir</parameter> expansion happens regardless of
- the <parameter>doc_root</parameter> setting, so you can control
- the document root and user directory access
- separately.
+ <parameter>user_dir</parameter> expansie gebeurd onafkanelijk van de
+ waarde van <parameter>doc_root</parameter>. Dit maakt het mogelijk om
+ de document root en user directory toegang afzonderlijk te configureren.
</simpara>
</sect2>
<sect2 id="security.cgi.shell">
- <title>Case 4: PHP parser outside of web tree</title>
+ <title>Case 4: PHP parser buiten de of web tree</title>
<para>
- A very secure option is to put the PHP parser binary somewhere
- outside of the web tree of files. In <filename
- role="dir">/usr/local/bin</filename>, for example. The only real
- downside to this option is that you will now have to put a line
- similar to:
+ Een erg veilige optie is het plaatsen van de PHP binary buiten de
+ directory met web bestanden. De PHP binary wordt voor deze methode
+ vaak in <filename role="dir">/usr/local/bin</filename> geplaatst.
+ Het enige nadeel is hieraan dat je nu een regel moet toevoegen aan
+ een script. Deze regel moet de eerste zijn in een script en ziet
+ er als volgt uit:
<informalexample>
<programlisting>
#!/usr/local/bin/php
</programlisting>
</informalexample>
- as the first line of any file containing PHP tags. You will also
- need to make the file executable. That is, treat it exactly as
- you would treat any other CGI script written in Perl or sh or any
- other common scripting language which uses the
- <literal>#!</literal> shell-escape mechanism for launching
- itself.
+ Het is ook noodzakelijk dat het script uitvoerbaar wordt gemaakt.
+ Dit impliceerd dat je het script moet zien als elk ander script
+ dat gebruikt wordt in CGI, zoals in Perl, shellscript of elke andere
+ taal die het <literal>#!</literal> shell-escape mechanisme gebruikt
+ voor het starten van zichzelf.
</para>
<para>
- To get PHP to handle <envar>PATH_INFO</envar> and
- <envar>PATH_TRANSLATED</envar> information correctly with this
- setup, the php parser should be compiled with the <link
+ Om er voor te zorgen dat PHP <envar>PATH_INFO</envar> en
+ <envar>PATH_TRANSLATED</envar> information correct gebruikt in deze
+ setup, moet de PHP parser worden gecompileerd met de <link
linkend="install.configure.enable-discard-path">--enable-discard-path</link>
- configure option.
+ configure optie.
</para>
</sect2>
</sect1>
<sect1 id="security.apache">
- <title>Installed as an Apache module</title>
+ <title>Geïnstalleerd als een Apache module</title>
<simpara>
- When PHP is used as an Apache module it inherits Apache's user
- permissions (typically those of the "nobody" user). This has several
- impacts on security and authorization. For example, if you are using
- PHP to access a database, unless that database has built-in access
- control, you will have to make the database accessable to the
- "nobody" user. This means a malicious script could access and modify
- the databse, even without a username and password. It's entirely
- possible that a web spider could stumble across a database
- adminisitror's web page, and drop all of your databases. You can
- protect against this with Apache authorization, or you can design
- your own access model using LDAP, .htaccess files, etc. and include
- that code as part of your PHP scripts.
- </simpara>
- <simpara>
- Often, once security is established to the point where the PHP user
- (in this case, the apache user) has very little risk, it is
- discovered that PHP now has been prevented from writing virus files
- to user directories. Or perhaps it has been prevented from accessing
- or changing a non-public database. It has equally been secured from
- writing files that it should, or entering database transactions.
- </simpara>
- <simpara>
- A frequent security mistake made at this point is to allow apache
- root permissions.
- </simpara>
- <simpara>
- Escalating the Apache user's permissions to root is extremely
- dangerous and may compromise the entire system, so sudo'ing,
- chroot'ing ,or otherwise running as root should not be considered by
- those who are not security professionals.
+ Als PHP wordt gebruikt als een Apache module, dan erft het alle
+ permissies van de gebruiker waaronder Apache draait. (Dit is gewoonlijk
+ nobody). Dit heeft verschillende implicaties op beveiliging en
+ authorisatie. Bijvoorbeeld, als je PHP gebruikt om een database te
+ benaderen (en de database geen ingebouwde toegangscontrole heeft)
+ dan zal de database toegankelijk moeten worden gemaakt voor de
+ "nobody" gebruiker. Dit betekend dat een kwaadwillend script
+ toegang kan krijgen tot de database zonder enige vorm van authenticatie.
+ Het is helemaal mogelijk dat een web spider langs een database
+ administratie pagina komt en daarmee alle database verwijderd.
+ Je kunt dit beveiligen met Apache's authenticatie mechanismen,
+ maar het is ook mogelijk jouw toegangs policies aan te passen voor
+ gebruik met LDAP, .htaccess bestanden, e.d. en deze code dan toe te
+ voegen als onderdeel van jouw PHP scripts.
+ </simpara>
+ <simpara>
+ Vaak, nadat de beveiliging zo is geregeld dat de PHP gebruiker,
+ (in dit voorbeeld, de apache gebruiker) weinig risico's met zich
+ meebrengt, is PHP nu zo afgeschermd dat het niet mogelijk is om
+ kwaardaardige dingen te doen in een gebruikers directory.
+ </simpara>
+ <simpara>
+ Een veelvuldig gemaakte beveiligings dout op dit punt is het laten
+ runnen van Apache met root permissies.
+ </simpara>
+ <simpara>
+ Het geven van root permissies aan Apache is enorm gevaarlijk en
+ kan het totaly systeem onveilig maken, zo het gebruik van sudo,
+ chroot, of het laten runnen van Apache als root, wordt absoluut
+ afgeraden aan personen die geen beveiligings guru zijn.
</simpara>
</sect1>
<sect1 id="security.filesystem">
<title>Filesystem Security</title>
<simpara>
- PHP honors the security built into most server systems with respect
- to permissions on a file and directory basis. This allows you to
- control which files in the filesystem may be read. Care should be
- taken with any files which are world readable to ensure that they
- are safe for reading by all users who have access to that
- filesystem.
- </simpara>
- <simpara>
- Since PHP was designed to allow user level access to the filesystem,
- it's entirely possible to write a PHP script that will allow you
- to read system files such as /etc/password. This has some obvious
- implications, in that you need to ensure that the files that you
- read and write are the appropriate ones.
- </simpara>
- <simpara>
- Consider the following script, where a user indicates that they'd
- like to delete a file in their home directory. This assumes a
- situation where a PHP web interface is regularly used for file
- management, so the Apache user is allowed to delete files in
- the user home directories.
+ PHP houdt vast aan de meeste rechten die het server systeem gebruikt
+ voor permissies op bestanden en directories. Dit maakt het mogelijk dat
+ je kunt controleren welke bestanden op het systeem mogen worden gelezen.
+ Voorzichtigheid moet genomen worden met elke bestand dat world readable
+ is om ervoor te zorgen dat deze geen informatie bevat die niet
+ bedoeld zijn voor eventuele andere gebruikers die toegang hebben tot
+ dit bestand.
+ </simpara>
+ <simpara>
+ Omdat PHP is ontworpen met gebruikers level toegang tot het
+ bestandssysteem, is het helemaal mogelijk om een PHP script te
+ schrijven dat systeembestanden zoals /etc/password bewerkt. Dit geeft
+ een aantal implicaties; je moet namelijk goed controleren dat de
+ bestanden die je leest en schrijft ook diegene zijn die je denkt
+ dat je leest en schrijft.
+ </simpara>
+ <simpara>
+ Neem het volgende in gedachten: als een gebruikt te kennen geeft een
+ bestand in hun homedirectory te verwijderen. Neem aan dat dit een
+ situatie betreft waar een PHP web interface wordt gebruikt voor bestands
+ beheer. Hierom heeft de Apache gebruiker rechten om bestanden in de
+ home directory van de gebruiker aan te passen en te verwijderen.
</simpara>
<para>
<example>
- <title>Poor variable checking leads to....</title>
+ <title>Slechte variabele controle leidt tot...</title>
<programlisting role="php">
<?php
-// remove a file from the user's home directory
-$username = $user_submitted_name;
-$homedir = "/home/$username";
-$file_to_delete = "$userfile";
-unlink ($homedir/$userfile);
-echo "$file_to_delete has been deleted!";
+// Verwijder een bestand uit de gebruikers home directory
+$gebruiker = $aangegeven_naam;
+$homedir = "/home/$gebruiker";
+$te_verwijderen_bestand = "$bestandje";
+unlink ($homedir/$bestandje);
+echo "$te_verwijderen_bestand is verwijderd!";
?>
</programlisting>
</example>
- Since the username is postable from a user form, they can submit
- a username and file belonging to someone else, and delete files.
- In this case, you'd want to use some other form of authentication.
- Consider what could happen if the variables submitted were
- "../etc/" and "passwd". The code would then effectively read:
+ Omdat de gebruikersnaam is te posten vanuit een form, kunnen gebruikers
+ bestanden benaderen van iemand anders, en deze verwijderen.
+ In dit voorbeeld heb je enige vorm van authenticatie nodig. Neem in
+ gedachten wat er kan gebeuren als de geposte variabelen waren
+ "../etc/" en "passwd". De code zou dan effectief zijn:
<example>
- <title>... A filesystem attack</title>
+ <title>... Een aanval op het bestandssysteem</title>
<programlisting role="php">
<?php
-// removes a file from anywhere on the hard drive that
-// the PHP user has access to. If PHP has root access:
-$username = "../etc/";
+// verwijderen een bestanden ergens op de harde schijf waar
+// de PHP gebruiker toegang tot heeft. Als PHP root rechten heeft:
+$gebruiker = "../etc/";
$homedir = "/home/../etc/";
-$file_to_delete = "passwd";
+$te_verijwderen_bestand = "passwd";
unlink ("/home/../etc/passwd");
-echo "/home/../etc/passwd" has been deleted!";
+echo "/home/../etc/passwd" is verwijderd!";
?>
</programlisting>
- </example>
- There are two appropriate measures to prevent these issues.
+ </example>
+ Er zijn twee toepasbare manier om dit soort dingen tegen te gaan:
<itemizedlist>
<listitem>
<simpara>
- Only allow limited permissions to the PHP web user binary.
+ Sta alleen gelimiteerde rechten toe voor de PHP web user binary.
</simpara>
</listitem>
<listitem>
<simpara>
- Check all file-related variables which are submitted.
+ Controleer alle bestands gerelateerde variabelen.
</simpara>
</listitem>
</itemizedlist>
- Here is an improved script:
+ Hier is een verbeterd script:
<example>
- <title>More secure file name checking</title>
+ <title>Veiliger bestandsnaam controle</title>
<programlisting role="php">
<?php
-// removes a file from the hard drive that
-// the PHP user has access to.
-$username = $HTTP_REMOTE_USER; // use an authentication mechanisim
+// verwijders een bestand van de schijf waartoe de PHP gebruiker
+// toegang heeft.
+$gebruiker = $HTTP_REMOTE_USER; // use an authentication mechanisim
-$homedir = "/home/$username";
+$homedir = "/home/$gebruiker";
-$file_to_delete = basename("$userfile"); // strip paths
-unlink ($homedir/$file_to_delete);
+$te_verwijderen_bestand = basename("$bestand"); // stript directories
+unlink ($homedir/$te_verwijderen_bestand);
-$fp = fopen("/home/logging/filedelete.log","+a"); //log the deletion
-$logstring = "$HTTP_REMOTE_USER $homedir $file_to_delete";
+$fp = fopen("/home/logging/filedelete.log","+a"); //log de verwijdering
+$logstring = "$HTTP_REMOTE_USER $homedir $te_verwijderen_bestand";
fputs ($fp, $logstring);
fclose($fp);
-echo "$file_to_delete has been deleted!";
+echo "$te_verwijderen_bestand has been deleted!";
?>
</programlisting>
</example>
@@ -387,159 +391,161 @@
</sect1>
<sect1 id="security.errors">
- <title>Error Reporting</title>
+ <title>Het rapporteren van fouten</title>
<simpara>
- A standard attack tactic involves profiling a system by feeding
- it improper data, and checking for the kinds, and contexts, of the
- errors which are returned. This allows the system cracker to probe
- for information about the server, to determine possible weaknesses.
- </simpara>
- <simpara>
- The PHP errors which are normally returned can be quite helpful to a
- developer who is trying to debug a script, indicating such things
- as the function or file that failed, the PHP file it failed in,
- and the line number which the failure occured in. This is all
- information that can be exploited.
- </simpara>
- <simpara>
- For example, the very style of error indicates a system is running
- PHP. If the attacker was looking at an .html page, and wanted to
- probe for the back-end (to look for known weaknesses in the system),
- by feeding it the wrong data they may be able to determine that a
- system was built with PHP.
- </simpara>
- <simpara>
- A function error can indicate whether a system may be running a
- specific database engine, or give clues as to how a web page or
- programmed or designed. This allows for deeper investigation into
- open database ports, or to look for specific bugs or weaknesses
- in a web page. By feeding different pieces of bad data, for example,
- an attacker can determine the order of authentication in a script,
- (from the line number errors) as well as probe for exploits that
- may be exploited in different locations in the script.
- </simpara>
- <simpara>
- A filesystem or general PHP error can indicate what permissions
- the webserver has, as well as the structure and organization of
- files on the web server.
- </simpara>
- <simpara>
- There are three major solutions to this issue. The first is to
- scrutinize all functions, and attempt to compensate for the bulk
- of the errors. The second is to disable error reporting entirely
- on the running code. The third is to use PHP's custom error
- handling functions to create your own error handler. Depending
- on your security policy, you may find all three to be applicable
- to your situation.
+ Een standaard aanval taktiek is om het systeem te voorzien van
+ ongeldige gegevens, en zo te controleren op fouten en de context
+ waarin foutmeldingen worden teruggegeven. Dit voorzier de aanvaller
+ van informatie over de server waarmee deze mogelijke zwakheden kan
+ vinden.
+ </simpara>
+ <simpara>
+ De meldingen die PHP normaal teruggeeft kunnen erg nuttig zijn voor
+ een ontwikkelaar die aan het debuggen is, zoals dingen als de functie
+ of het bestand dat faalde, het PHP bestand dat fout liep, en het
+ regelnummer waar de fout optrad. Al deze informatie kan worden gebruikt
+ om het systeem te helpen kraken.
+ </simpara>
+ <simpara>
+ Als voorbeeld is de stijl van de foutmeldingen die PHP geeft. Als
+ een aanvaller naar een .html pagina kijkt, en wil weten wat voor
+ back-end er draait (om zwakheden in het systeem te vinden), kan hij,
+ door er foutieve gegevens heen te sturen, er misschien achter komen dat
+ het systeem is gebouwd met PHP.
+ </simpara>
+ <simpara>
+ Een functie foutmelding kan een indictatie zijn dat een systeem een
+ specifieke database engine draait, of kan aanwijzingen geven hoe de
+ website is geprogrammed of is ontworpen. Dit geeeft meer aanleiding tot
+ een verder onderzoek naar openstaande database porten, of om te kijken
+ naar speicifieke bugs in een website. Door verschillende stukken van
+ "slechte" gegevens te versturen, kan hij de manier van authenticatie
+ vinden (met behulp van de regelnummers in de foutmeldingen) alsook
+ op zoek gaan naar bugs in andere plaatsen in een script.
+ </simpara>
+ <simpara>
+ Een bestands of normale PHP fout kan aangeven wat voor permissies
+ de webserver heeft, alsmede de structuur en plaats van bestanden
+ op de web server.
+ </simpara>
+ <simpara>
+ Er zijn drie manieren van oplossingen voor dit soort zaken. De eerste
+ is om alle functies zo te maken, dat foutieve invoer in zijn geheel
+ wordt afgevangen. De tweede manier is om alle fout rapportage uit
+ te zetten en de derde is om PHP's eigen foutafhandeling te omzeilen
+ en deze te vervangen door gebruikers gedefineerde fout afhandelings
+ routines. Afhankelijk van je security policies, kan elk van de
+ genoemde drie toepasbaar zijn op jouw situatie.
</simpara>
</sect1>
<sect1 id="security.variables">
<title>User Submitted Data</title>
<para>
- The greatest weakness in many PHP programs is not inherent in the
- language itself, but merely an issue of code not being written with
- security in mind. For this reason, you should always take the time
- to consider the implications of a given piece of code, to ascertain
- the possible damage if an unexpected variable is submitted to it.
+ De grootste zwakheid in veel PHP programma's ligt niet in de taal
+ zelf, maar is meer een slechte stijl van programmeren zonder beveiliging
+ in gedachten. Om deze reden, zul je ALTIJD de tijd moeten nemen om
+ na te denken over de implicaties van elke stuk code, om te verzekeren
+ dat er geen schade kan worden aangericht omdat er een variabele verkeerd
+ staat.
<example>
- <title>Dangerous Variable Usage</title>
+ <title>Gevaarlijk gebruik van variabelen</title>
<programlisting role="php">
<?php
-// remove a file from the user's home directory... or maybe
-// somebody else's?
+// verwijder een bestand uit de home directory van een gebruiker,
+// of misschien die van iemand anders.
unlink ($evil_var);
-// Write logging of their access... or maybe not?
+// Log toegang, of misschien niet?
fputs ($fp, $evil_var);
-// Execute something trivial.. or rm -rf *?
+// Voer iets triviaals uit, of misschien "rm -rf *"?
system ($evil_var);
exec ($evil_var);
?>
</programlisting>
</example>
- You should always carefully examine your code to make sure that any
- variables being submitted from a web browser are being properly
- checked, and ask yourself the following questions:
+ Je zult altijd enorm voorzichtig moeten zijn om ervoor te zorgen dat
+ geen enkele variabele die is gesubmit vanuit een webbrowser grondig
+ is controleerd, met inachtneming van de volgende vragen:
<itemizedlist>
<listitem>
<simpara>
- Will this script only affect the intended files?
+ Zal dit script alleen de bedoelde bestanden benaderen?
</simpara>
</listitem>
<listitem>
<simpara>
- Can unusual or undesirable data be acted upon?
+ Kan er worden omgegeaan met niet gewenste gegevens?
</simpara>
</listitem>
<listitem>
<simpara>
- Can this script be used in unintended ways?
+ Kan dit script gebruikt worden voor niet bedoelde zaken?
</simpara>
</listitem>
<listitem>
<simpara>
- Can this be used in conjunction with other scripts in a negative
- manner?
+ Kan het gebruikt worden in samenwerking met andere scripts in
+ negatieve zin?
</simpara>
</listitem>
<listitem>
<simpara>
- Will any transactions be adequately logged?
+ Worden alle transactions voldoende gelogd?
</simpara>
</listitem>
</itemizedlist>
- By adequately asking these questions while writing the script,
- rather than later, you prevent an unfortunate re-write when you
- need to increase your security. By starting out with this mindset,
- you won't guarantee the security of your system, but you can help
- improve it.
+ Door jezelf de vragen te stellen tijdens het schrijven van een
+ script, voorkom je het herschrijven van scripts om de veiligheid
+ te vergroten. Met dit in gedachten, zul je niet de veiligheid van
+ een systeem kunnen garanderen, maar de beveiling zal zeker beter
+ zijn dan als je jezelf deze vragen niet stelt.
</para>
</sect1>
<sect1 id="security.general">
<title>General considerations</title>
<simpara>
- A completely secure system is a virtual impossibility, so an
- approach often used in the security profession is one of balancing
- risk and usability. If every variable submitted by a user required
- two forms of biometric validation (such as a retinal scan and a
- fingerprint), you would have an extremely high level of
- accountability. It would also take half an hour to fill out a fairly
- complex form, which would tend to encourage users to find ways of
- bypassing the security. The best security is often inobtrusive
- enough to suit the requirements without the user being prevented
- from accomplishing their work. Indeed, some security attacks are
- merely exploits of this kind of overly built security.
- </simpara>
- <simpara>
- A phrase worth remembering: A system is only as good as the weakest
- link in a chain. If all transactions are heavily logged based on
- time, location, transaction type, etc. but the user is only
- verified based on a single cookie, the validity of tying the users
- to the transaction log is severely weakened.
- </simpara>
- <simpara>
- When testing, keep in mind that you will not be able to test all
- possibilities for even the simplest of pages. The input you
- may expect will be completely unrelated to the input given by
- a disgruntled employee, a cracker with months of time on their
- hands, or a housecat walking across the keyboard. This is why it's
- best to look at the code from a logical perspective, to discern
- where unexpected data can be introduced, and then follow how it is
- modified, reduced, or amplified.
- </simpara>
- <simpara>
- The Internet is filled with people trying to make a name for
- themselves by breaking your code, crashing your site, posting
- inappropriate content, and otherwise making your day interesting.
- It doesn't matter if you have a small or large site, you are
- a target by simply being online, by having a server that can be
- connected to. Many cracking programs do not discern by size, they
- simply trawl massive IP blocks looking for victims. Try not to
- become one.
+ Een compleet veilig systeem is eigenlijk onmogelijk, maar een
+ aanpak die vaak wordt gebruikt bij beveiliging van systemen is het
+ uitbalanseren van risico en bruikbaarheid. Als elke geposte variabele
+ wordt gecontroleerd door een gebruiker twee vormen van biometrische
+ authenticatie te laten doen (zoals een netvliesscan en een vingerafdruk),
+ dan zou je een enorm veilig systeem hebben. Op deze manier zal het wel een
+ uur duren om een redelijk complex web formulier in te vullen. Op deze
+ manier zullen gebruikers een manier gaan zoeken om de beveiliging
+ te omzeilen om hun werk te doen. Sommige manieren van aanvallen
+ op systemen zijn zelfs ontstaan vanwege een overkill aan beveiliging.
+ </simpara>
+ <simpara>
+ Een regel om te onthouden: Een systeem is even veilig als de zwakste
+ schakel. Als alle transacties zwaar worden gelogd om basis van tijd,
+ locatie, transactie type, etc., maar de gebruiker wordt alleen maar
+ geverifieerd op bases van éé, dan is de controle op
+ de gebruiker in het transactie log redelijke onzin.
+ </simpara>
+ <simpara>
+ Houd tijdens het testen in gedachten dat je nooit alle mogelijkheden
+ kan testen voor zelfs de simpelste pagina. De invoer die je voor je
+ kiezen kan krijgen verschilt natuurlijk tussen een ontevreden
+ werknemer, een cracker, met maanden van onderzoek achter de
+ hand, of een huiskat die over het toetsenbord loopt. Daarom is het
+ belangrijk om vanuit een logisch perspectief te kijken en zo
+ uit te vinden waar vreemde gegevens tot stand kunnen komen, en wat
+ voor implicaties dit kan hebben op de rest van de code.
+ </simpara>
+ <simpara>
+ Het Internet zit vol met mensen die proberen naam te maken door
+ proberen in te breken in jouw code, het laten crashen van je site
+ of ongewenste teksten te plaatsen, om so je dag wat interesanter
+ te maken. Het maakt niet uit of je een kleine of grote website
+ hebt, je kunt alleen al worden aangevallen omdat je simpelweg online
+ bent en een server met internet toegang heeft. Veel cracking
+ programma's kijken niet naar de grote van een site, ze proberen
+ simpelweg massieve IP blokken door te zoeken naar mogelijke
+ slachtoffers. Zorg dat je er geen wordt.
</simpara>
</sect1>
</chapter>