Seguridad¶
Elgg’s approach to the various security issues common to all web applications.
Truco
Para informar de una posible vulnerabilidad en Elgg, envíe un correo electrónico a security@elgg.org.
Contents
Contraseñas¶
Validación de contraseñas¶
The only restriction that Elgg places on a password is that it must be at least 6 characters long by default, though this may be changed
in /elgg-config/settings.php
.
Additional criteria can be added by a plugin by registering for the registeruser:validate:password
plugin hook.
Suma de la contraseña¶
Passwords are never stored in plain text, only salted hashes produced with bcrypt. This is done via the standard password_hash()
function.
On older systems, the password-compat
polyfill is used, but the algorithm is identical.
Elgg installations created before version 1.10 may have residual «legacy» password hashes created using salted MD5. These are migrated to bcrypt as users log in, and will be completely removed when a system is upgraded to Elgg 3.0. In the meantime we’re happy to assist site owners to manually remove these legacy hashes, though it would force those users to reset their passwords.
Regulador de accesos¶
Elgg cuenta con un mecanismo de regulación de accesos que dificulta en gran medida los ataques de diccionario desde el exterior. Los usuarios sólo pueden hacer hasta 5 intentos de acceder al sistema durante un período de 5 minutos.
Restablecimiento de contraseñas¶
Si un usuario se olvida de su contraseña, se puede solicitar una nueva contraseña generada aleatoriamente. Tras la solicitud, se envía un mensaje de correo electrónico al usuario con una URL única. Cuando el usuario visita la URL, se le envía una nueva contraseña aleatoria por correo electrónico.
Sesiones¶
Elgg uses PHP’s session handling with custom handlers. Session data is stored in the database. The session cookie contains the session id that links the user to the browser. The user’s metadata is stored in the session including GUID, username, email address.
The session’s lifetime is controlled through the server’s PHP configuration and additionally through options in the /elgg-config/settings.php
.
Fijación de la sesión¶
Elgg le protege contra la fijación de la sesión mediante la generación de un nuevo identificador de sesión cada vez que accede al sitio.
«Remember me» cookie¶
To allow users to stay logged in for a longer period of time regardless of whether the browser has been closed, Elgg uses a cookie
(default called elggperm
) that contains what could be considered a super session identifier. This identifier is stored in a cookies table.
When a session is being initiated, Elgg checks for the presence of the elggperm
cookie. If it exists and the session code in the cookie matches
the code in the cookies table, the corresponding user is automatically logged in.
When a user changes their password all existing permanent cookie codes are removed from the database.
The lifetime of the persistent cookie can be controlled in the /elgg-config/settings.php file. The default lifetime is 30 days. The database records for the persistent cookies will be removed after the lifetime expired.
Autenticación alternativa¶
Nota
Esta sección no es muy precisa.
To replace Elgg’s default user authentication system, a plugin could replace the default login
action with its own.
Better would be to register a PAM handler using register_pam_handler()
which handles the authentication of the user based on the new requirements.
HTTPS¶
Nota
Debe activar la compatibilidad con SSL en su servidor para que las siguientes técnicas funcionen.
You can serve your whole site over SSL by changing the site URL to include «https» instead of just «http».
XSS¶
En Elgg se utilizan filtros para dificultar ataques de secuencias de órdenes en sitios cruzados (XSS). EL propósito del filtrado es eliminar JavaScript y otros datos de entrada peligrosos de los usuarios.
El filtrado se realiza mediante la función filter_tags()
. Esta función recibe una cadena de texto y devuelve la misma cadena pero filtrada. La función desencadena un gancho de complementos validate, input
.
By default Elgg comes with the htmLawed filtering code. Developers can drop in any additional or replacement filtering code as a plugin.
A la función filter_tags()
se la llama para todos los datos introducidos por usuarios siempre que dichos datos se obtuviesen mediante una llamada a la función get_input()
. Si por lo que sea no se quiera realizar ese filtrado con algún dato introducido por un usuario, la función get_input()
cuenta con un parámetro que permite desactivar dicho filtrado.
CSRF / XSRF¶
Elgg generates security tokens to prevent cross-site request forgery. These are embedded in all forms and state-modifying AJAX requests as long as the correct API is used. Read more in the Forms + Actions developer guide.
Signed URLs¶
It’s possible to protect URLs with a unique signature. Read more in the Forms + Actions developer guide.
Inyección SQL¶
Elgg’s API sanitizes all input before issuing DB queries. Read more in the Base de datos design doc.
Privacidad¶
Elgg usa un sistema de listas de control de acceso (ACL) para controlar qué usuarios tienen accedo a distintos contenidos. Para más información, véase Base de datos.