FreeBSD
TMA-FREEBSD-6.1.5
Ensure world writable files and directories are secured
Descripción
World writable files are the least secure. Data in world-writable files can be modified and compromised by any user on the system. World writable files may also indicate an incorrectly written script or program that could potentially be the cause of a larger compromise to the system's integrity. See the chmod(2) man page for more information. Audit: no world-writable files, and no world-writable directories without the sticky bit (outside /tmp and /proc); long running.
Cómo se verifica
Método de auditoría: Comando de shell
command -v find >/dev/null 2>&1 || exit 1; out=$( { find / \( -path /tmp -o -path /proc \) -prune -o -type f -perm -o=w -print; find / \( -path /tmp -o -path /proc \) -prune -o -type d -perm -o=w ! -perm -1000 -print ; } 2>/dev/null ); [ -z "$out" ] && echo compliant || printf '%s\n' "$out" | head -n 20- Salida esperada
compliant
Cómo se corrige
Método de corrección: Guía o parche de infraestructura
World Writable Files: o It is recommended that write access is removed from other with the command ( chmod o-w <filename> ), but always consult relevant vendor documentation to avoid breaking any application dependencies on a given file. World Writable Directories: o Set the sticky bit on all world writable directories with the command ( chmod a+t <directory_name> ) Run the following script to: Remove other write permission from any world writable files Add the sticky bit to all world writable directories #!/bin/sh # Define paths to exclude (space-separated) a_path_exclusions="! -path '/tmp/*' ! -path '/proc/*'" # Fix world-writable files by removing the write permission for "others" find / \( $a_path_exclusions \) -type f -perm -o=w -print -exec chmod o-w {} \; # Fix world-writable directories without the sticky bit find / \( $a_path_exclusions \) -type d -perm -o=w ! -perm -1000 -print -exec chmod +t,o-w {} \;
Propiedades
- Sistemas operativos
- Cualquiera
- Etiquetas
- freebsdpermissions
- Referencia
- CIS FreeBSD 14 Benchmark v1.0.1 - 6.1.5 Ensure world writable files and directories are secured
Verificar este host
Ejecute esto en un equipo que tenga permiso para auditar. El escaneo es de solo lectura.
tmaegis scan --target freebsd