mirror of
https://gitlab.com/kalilinux/packages/unix-privesc-check.git
synced 2025-07-11 17:00:46 +00:00
Imported Upstream version 1.4~svn361
This commit is contained in:
CHANGELOGCOPYING.GPLCOPYING.UNIX-PRIVESC-CHECKprivileged_cache.temp
docs
files_cache.templib
checks
credentialsdevices_optionsdevices_permissiongpg_agentgroup_writablehistory_readablehomedirs_executablehomedirs_writablejarkey_materialldap_authenticationnis_authenticationpasswd_hashespostgresql_configurationpostgresql_connectionpostgresql_trustprivileged_argumentsprivileged_bannedprivileged_change_privilegesprivileged_chrootprivileged_dependencyprivileged_environment_variablesprivileged_nxprivileged_pathprivileged_pieprivileged_randomprivileged_relroprivileged_rpathprivileged_sspprivileged_tmpprivileged_writablesetgidsetuidshadow_hashesssh_agentssh_keysudosystem_aslrsystem_configurationsystem_librariessystem_mmapsystem_nxsystem_selinuxworld_writable
enabled
all
credentialsgpg_agentgroup_writablehistory_readablehomedirs_executablehomedirs_writablejarkey_materialpasswd_hashesprivileged_bannedprivileged_change_privilegesprivileged_chrootprivileged_dependencyprivileged_nxprivileged_pathprivileged_pieprivileged_randomprivileged_relroprivileged_rpathprivileged_sspprivileged_tmpprivileged_writablesetgidsetuidshadow_hashesssh_agentssh_keysystem_aslrsystem_configurationsystem_librariessystem_mmapsystem_nxsystem_selinuxworld_writable
attack_surface
credentialshistory_readablehomedirs_executablekey_materialpasswd_hashesprivileged_change_privilegesprivileged_pathprivileged_rpathprivileged_writablesetgidsetuidshadow_hashesssh_keysystem_configurationworld_writable
sdl
misc
tools
unix-privesc-checkupc.sh
71
lib/checks/sudo
Executable file
71
lib/checks/sudo
Executable file
@ -0,0 +1,71 @@
|
||||
#!/bin/sh
|
||||
# $Revision: 307 $
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# (c) Tim Brown, 2012
|
||||
# <mailto:timb@nth-dimension.org.uk>
|
||||
# <http://www.nth-dimension.org.uk/> / <http://www.machine.org.uk/>
|
||||
#
|
||||
#
|
||||
|
||||
. lib/misc/stdio
|
||||
. lib/misc/sudo
|
||||
|
||||
sudo_init () {
|
||||
stdio_message_log "sudo" "Starting at: `date`"
|
||||
}
|
||||
|
||||
sudo_main () {
|
||||
if [ "`sudo_sudoers_check`" -eq 1 ]
|
||||
then
|
||||
if [ -n "`sudo_sudoers_list`" ]
|
||||
then
|
||||
stdio_message_warn "sudo" "/etc/sudoers is readable and configured"
|
||||
|
||||
# TODO: if privilegeduser is a group (e.g. %admin), notify the user accordingly
|
||||
sudo_sudoers_list | while read privilegeduser passwd filepath
|
||||
do
|
||||
asuser="`printf -- \"${passwd}\" | cut -f2 -d\"=\" | tr -d \"(\" | tr -d \")\"`"
|
||||
# for cases where the asuser is ALL:ALL (e.g. in Ubuntu there is always the following sudoers entry):
|
||||
# root ALL=(ALL:ALL) ALL
|
||||
if [ "${asuser}" = "ALL:ALL" ]
|
||||
then
|
||||
asuser="any user"
|
||||
else
|
||||
asuser="user ${asuser}"
|
||||
fi
|
||||
# for cases where the user can run any command. For example:
|
||||
# foobar ALL=NOPASSWD: ALL
|
||||
if [ "${filepath}" = "ALL" ]
|
||||
then
|
||||
filepath="any command"
|
||||
fi
|
||||
if [ -n "`printf -- \"${passwd}\" | egrep -- \"NOPASSWD\"`" ]
|
||||
then
|
||||
stdio_message_warn "sudo" "${privilegeduser} can run ${filepath} without providing a password"
|
||||
else
|
||||
stdio_message_log "sudo" "${privilegeduser} can run ${filepath} as ${asuser}"
|
||||
fi
|
||||
done
|
||||
else
|
||||
stdio_message_log "sudo" "/etc/sudoers is readable, but not configured"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
sudo_fini () {
|
||||
stdio_message_log "sudo" "Ending at: `date`"
|
||||
}
|
Reference in New Issue
Block a user